MATLAB: Solving large linear systems

iterative solverslinear systemsMATLABmldividepreconditionersparse matrices

Hello,
I want to solve a large system Ax=b, the size of A is 300,000, the matrix is sparse and diagonal dominant.
Backslash is not more viable, so I'm trying to use "ilu" and "luinc" as a preconditioner within an iterative solver (bicg, gmres, pcg) but I get "out of memory" in the ilu/luinc computation.
Is there any suggestion you could give me? Is there any other function?
Thank you!

Best Answer

With the information you have provided, it is difficult to diagnose your problem. Do you get an "out of memory" error if you run the following commands?
n = 300000;
e = rand(n,1);
A = spdiags([e -2*e e], -1:1, n, n);
b = rand(n,1);
y = A\b;
EDIT: Here is code based on the new details you have provided:
N = 700;
B = 1e6*ones(N*N,3);
d = [-N 0 N]; % This might be [-N-1 0 N+1], depending on what "separate" means
Z = spdiags(B,d,N*N,N*N);
H = rand(N*N,1);
Y=Z\H;
This took my computer 2.3 seconds and I had no memory problems.