|
"Hugo " <hugo@radtronics.com.au> wrote in message
news:it9l40$8se$1@newscl01ah.mathworks.com...
> "Matt J" wrote in message <iss37m$f27$1@newscl01ah.mathworks.com>...
>> "Hugo" wrote in message <isrkdc$9p0$1@newscl01ah.mathworks.com>...
>> > Hello,
>> >
>> > I want to solve a large system Ax=b, the size of A is 300,000, the
>> > matrix is sparse, square, symmetrical and diagonal dominant.
>> ======================
>>
>> The following iterative method sometimes works well for diagonally
>> dominant systems
>>
>> absA=abs(A);
>> C=absA*sum(absA,2);
>> x=initialValues;
>>
>> for ii=1:numIter
>>
>> x=x-A.'*(A*x-b)./C;
>>
>> end
>
> Thanks for your answer, Let me explain more about my problem so you can
> see where I'm getting "out of memory":
>
> N = 700
> Z = spalloc(N*N,N*N,nnz) % Z almost [500,000 x 500,000]
What is nnz?
> H = full vector [500,000 x 1]
> for x = 1:N
> for y = 1:N
> Z = Computation of Z;
I assume you're filling in elements in Z rather than simply overwriting?
Have you considered constructing vectors R, C, and D in the loop and
constructing Z from those vectors later on with sparse(R, C, D)?
> end
> end
> % The matrix Z is diagonal, symmetric, sparse, % all of its values are
> "10e+6", its form is three diagonal lines in the diagonal, one in the
> right side and one in the left side, both last ones separate from the
> center diagonal 700 points (hope this is clear)
>
> Y = Z\H : Out of memory
>
> [L,U] = luinc(Z,1e-7); : Out of memory
> [H,flag,relres,iter,resvec] = pcg(Z,H,1e-6,100,L,U);
>
> Is there any other preconditioner I could use?
Depending on what nnz is, it might be easier (and less memory intensive) to
write a function that accepts a vector x and computes Z*x (and possibly
Z'*x) without explicitly creating Z and pass a function handle to that
function into the iterative solvers like GMRES or LSQR. Given the
tridiagonal form you described above, that would be my next step. Look at
example 2 in the reference page for LSQR for an example you can adapt.
--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com
|