I would like to solve Ax = b where A is a sparse non-square array.
For example :
using SparseArrays
using LinearSolve
n = 3
m = 4
A = sparse(rand(ComplexF64, m, n))
b = rand(ComplexF64, m)
prob = LinearProblem(A, b)
sol = solve(prob)
sol.u
This works if A is sparse and square, or dense and non-square, but not sparse and non-square.
How can I solve this ?
Oh right thanks, I think the issue was coming form the fact that A was the transpose of another matrix C in my initial problem. Fixed it doing A=sparse(transpose(C)).
The example you gave is overdetermined (more rows than columns), so there is no solution to Ax = b. A \ b will give the least-squares solution (via sparse QR), which minimizes \Vert Ax - b \Vert but will not generally solve Ax = b.