Inverse matrix (lud method)


sunil_josh1
08-18-2004, 10:57 AM
hi,
I am using LU decomposition code form inverse of a matrix.
I came through two probles:
[1] It is taking more than 8 hrs (still runing) for finding the inverse of a 7000x7000 matrix. Is there any way to speedup this code.
[2] Some time it is giving wrong values of inverse matrix, Like at each place of inverse matrix the numbers are very long. So far i think that it might be the problem of using float. If i am right ,then how to overcome from this problem.
with regards,
sunil_josh1

quanfusong
07-25-2005, 12:06 AM
hi,
I am also interested in LU decompsition. but , it seems much trouble to me. I found the result of LU decompsition may be not correct(Compare to that of Matlab). Do you meet such problem ?

I am eagerily await your replay! thanks.

sunil_josh1
07-25-2005, 03:08 AM
hi,
no i don't think there is any problem with LU code. i did not face any such problems that results are different from matlab
they should be same.
Thanks,
sunil_josh1:eek:

gaspari
07-26-2005, 10:15 AM
Uhmm..

7000 x 7000 matrix ... and you are computing the inverse using
LU...

You are joking, isn't it?


Regards

Massimo

sunil_josh1
07-26-2005, 10:26 AM
Yes,
The maximum size I used is
8973 X8973.
And it was working well. You have to use dynamic memorry allocations.
I did not found any problem with it.
I think so far, LU is the only fasted way to do such huge arrays.
thanks,
sunil

gaspari
07-26-2005, 03:11 PM
sunil_josh1 wrote:

>Yes,
>The maximum size I used is
>8973 X8973

So you are (solving a linear problem) computing 7.2 10^11 multiplication in single precision!!! Be serious.... :-))))

Sometimes it can work ...if you are lucky...

The only possibility to get reliable result is to consider trivial and
simple matrices. (like all zero or identity matrix)
In any case the required computing time will be the blocking factor.

Consider a numerical analysis textbook. (NR is not a textbook).


> And it was working well. You have to use dynamic memorry
> allocations.

Ok but the memory contents will be meaningless...my opinion
(if is really working well) is that you are solving a very large but very sparse matrix. In that case the NR's LU routine is not the better solution.


> I did not found any problem with it.
> I think so far, LU is the only fasted way to do such huge arrays.
> thanks,

seriously.... very big matrices are used in problem like discretizazion of partial differential equation. I that case people will use the sparsity of matrices to decrease the allocated memory
and computing time (i.e number of multiplication that are roughly n^3 for LU), just becasue a lot of matrix elements are zero or very close to zero.

Computing the inverse of so big matrix in single precision is (in REAL problem) meaningless, and is not required to solve PDE
problems.
If you love LU you may try SuperLU a LU algorithm written for sparse matrix (try google). Consider also iterative methods for
sparse matrix.

Regards
Max