ndarray implementation of main-diagonal fixed

In the documentation it is stated that `main-diagonal` should work on square and rectangular matrices both.