Can LinearSolve.jl be used for non-square matrices?

Thanks for the replies. I tried to follow your advice and checked the list of solve-methods for least-square and least-norm approaches and found the methods KrylovJL_LSMR (for least squares) and KrylovJL_CRAIGMR (for least norm) and indeed the following code works:

using LinearSolve
lin_prob = LinearProblem(A, b)
x_least_squares = LinearSolve.solve(lin_prob,LinearSolve.KrylovJL_LSMR())
x_least_norm = LinearSolve.solve(lin_prob,LinearSolve.KrylovJL_CRAIGMR())

All other methods, that I tried returned errors, though I did not try all of them.

I did not find a method that does, what @stevengj described for A\b (first checking whether matrix is tall or wide and then acting accordingly).
Though one could of course do such things oneself, someone uninitiated might not know that this is the best approach and therefore I will open an issue, requesting to set something like this as the default for non-square matrices.

EDIT: I opened the issue here.

3 Likes