Fix julia lu algorithm to handle singular matrices similarly to LAPACK.

I have tried to test this against LAPACK, but the factorisation is not stable for singular matrices and therefore it wasn't really feasible. (The regular case is already tested against LAPACK).