BUG: Deal with non-square matrix
Add a test for non-square matrix