fixing #1868 Misc accumulated fixes

Added fixes to their new file locations and added a small fix for a failing test

Finish gh-1868
As this opt only work on op that is in nlinalg, I would move this optimization to that file "tensor/nlinalg.py"