> I have a question about solving a sparse linear system with
> a complex system matrix.
> The system I am solving is of the form
> A = (J + 1i * w * M)
> A * x = b
> where J and M are sparse real matrices, b is a real vector and
> w is a (small) real number.
> J is nonsingular, M is singular, A can be proven to be invertible
> (in exact arithmetics) for any value of w.
> What I am experiencing is the following: if I use mldivide I get
>>> A = (J + 1i * w * M);
>>> x1 = A \ res;
> warning: matrix singular to machine precision, rcond = 1.49212e-27
> and the contents of x1 are just garbage while, if I perform LU first, I
>>> [L, U, P, Q, R] = lu (A);
>>> x2 = Q * (U \ (L \ (P * (R \ res))));
> and x2 is the physically expected result.
> Can anyone comment about why the the two approaches differ?
> What are the underlying library methods invoked in the two cases?
> P.S. In case anyone would like to try the above examples, the matirces are
> available here:
Maybe you already found an answer, my conclusion is, that both algorithms
use UMFPACK of SuiteSparse and that \ uses the numeric factorization  and
lu the symbolic factorization  approach. To see where "\" and "lu" are
handled, I started a debugger (as explained in the wiki  + kdbg as
graphical frontend) and stepped though the code for your example for "w =