Efficient way to solve for X in AX=B in MATLAB when both A and B are big matrices
I have this problem which requires solving for X in AX=B . A is of the order 15000 x 15000 and is sparse and symmetric. B is 15000 X 7500 and is NOT sparse. What is the fastest way to solve for X? I can think of 2 ways. Simplest possible way, X = A\B Using for loop, invA = A\speye(size(A)) for i = 1:size(B,2) X(:,i) = invA*B(:,i); end Is there a better way than the above two? If not, which one is best between the two I mentioned? angainor First things first - never, ever compute inverse of A. That is never sparse except when A is a diagonal matrix. Try it for a simple tridiagonal matrix. That