For Programmers: Free Programming Magazines  


Home > Archive > Matlab > July 2006 > inverse of sparse matrix









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author inverse of sparse matrix
akhil

2006-07-31, 8:03 am

Can any one help me please...

I am solving some fem problem and have 12800 x 12800 matrix.I am
storing it in sparse form in the matrix.
Matlab does not give error while dealing with sparse matrix but while
taking inverse it is showing out of memory error......

How shoul i proceed...I am at critical stage of my work so I want to
use only matlab for this...

please see to it...
John D'Errico

2006-07-31, 7:17 pm

In article <ef3d01c.-1@webcrossing.raydaftYaTP>, akhil <akhouri.akhil@gmail.com> wrote:

> Can any one help me please...
>
> I am solving some fem problem and have 12800 x 12800 matrix.I am
> storing it in sparse form in the matrix.
> Matlab does not give error while dealing with sparse matrix but while
> taking inverse it is showing out of memory error......
>
> How shoul i proceed...I am at critical stage of my work so I want to
> use only matlab for this...
>
> please see to it...



Very often one actually does not need to compute
a matrix inverse, despite the presence of the
inverse in your formula. There are often far
better ways around it.

Since the inverse of a sparse matrix will almost
never be sparse, computation of the inverse will
generate just too large of a matrix. Thats life.
There are some problems that one simply cannot
solve with the computational power available to
you.

So the solution is for you to investigate your
alternatives to computing the matrix inverse.
I can't say much more, since I don't know what
you are doing.

HTH,
John D'Errico


--
The best material model of a cat is another, or preferably the same, cat.
A. Rosenblueth, Philosophy of Science, 1945

Those who can't laugh at themselves leave the job to others.
Anonymous
akhil

2006-07-31, 7:17 pm

John D'Errico wrote:
>
>
> In article <ef3d01c.-1@webcrossing.raydaftYaTP>, akhil
> <akhouri.akhil@gmail.com> wrote:
>
am[color=darkred]
> while
want[color=darkred]
> to
>
>
> Very often one actually does not need to compute
> a matrix inverse, despite the presence of the
> inverse in your formula. There are often far
> better ways around it.
>
> Since the inverse of a sparse matrix will almost
> never be sparse, computation of the inverse will
> generate just too large of a matrix. Thats life.
> There are some problems that one simply cannot
> solve with the computational power available to
> you.
>
> So the solution is for you to investigate your
> alternatives to computing the matrix inverse.
> I can't say much more, since I don't know what
> you are doing.
>
> HTH,
> John D'Errico
>
>
> --
> The best material model of a cat is another, or preferably the
> same, cat.
> A. Rosenblueth, Philosophy of Science, 1945
>
> Those who can't laugh at themselves leave the job to others.
> Anonymous
>

Thank you john for your fast reply and showing interest in my
problem..
what I am doing is that I am finding finite element equation
Ku=f
in this I have created sparse(K)...having the size of some 8000 by
8000 or even more..I have to find u which is displacement...
How can I proceed for this problem when matlab storage problem
persists...?

I am not thinking about any numerical sensibility of the solution
....right now LU factorization I am using but don't know whether my
approach is right or wrong?
John D'Errico

2006-07-31, 7:17 pm

In article <ef3d01c.2@webcrossing.raydaftYaTP>, akhil <akhouri.akhil@gmail.com> wrote:

> Thank you john for your fast reply and showing interest in my
> problem..
> what I am doing is that I am finding finite element equation
> Ku=f
> in this I have created sparse(K)...having the size of some 8000 by
> 8000 or even more..I have to find u which is displacement...
> How can I proceed for this problem when matlab storage problem
> persists...?
>
> I am not thinking about any numerical sensibility of the solution
> ...right now LU factorization I am using but don't know whether my
> approach is right or wrong?


This is why I suggested that the inverse is rarely
needed.

Are you forming the sparse LU factorization, then
using inv to solve it? Use backslash (\).

u = K\f;

Alternatively, if you form

[L,U] = lu(K);

then use \ to solve it still. Since K = L*U, then

u = U\(L\f);

Note that Matlab can do these back and forward
substitutions very quickly.

If K is a stiffness matrix, then it should be
symmetric. Are they also positive definite? (I can't
recall off the top of my head. Sorry.) If so, then
use chol instead of lu.

In either event, you will find that symmamd or
colamd will be effective in reducing the extent
of fillin in the sparse factors. This can help
dramatically.

Finally, you may find the use of an iterative
solver more efficient than any of these approaches
for large problems. Perhaps symmlq. Some iterative
solvers require a preconditioner to converge well.

John


--
The best material model of a cat is another, or preferably the same, cat.
A. Rosenblueth, Philosophy of Science, 1945

Those who can't laugh at themselves leave the job to others.
Anonymous
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com