I have a square singular system A and vector b which is in range space of A. Because b is in range space of A and A is singular there are infinitely many solutions. Now what I want is some solution to Ax=b, not necessarily the minimum norm. As my system A is large I want to avoid svd based solutions(finding pseudo inverse). I was thinking of simply doing LU factorization and setting free variables to 0 but all the methods I tried failed to give me solution when A is singular.
I have tried scipy.linalg.solve but that requires system to be non-singular. I have also tried scipy lu_factor and lu_solve but while doing lu_factor it gave me runtime warning saying "Diagonal number %d is exactly zero. Singular matrix.".
So my question is this - Is there a way(using scipy) to find a solution to a singular system using LU factorization given b is in range space of A. Any suggestions are greatly appreciated. Thanks a lot.