Use ginv instead of qr.solve, so we could deal with non-square matrices
Add tests
More tests