What is the difference between lu() and decomposition([],'lu')?
Afficher commentaires plus anciens
Hello Matlab-Community,
I have a matrix (called SystemMatrix see atteched file) which I want to decompose in L and U. Matlab has 2 functions to do this:
- [L,U] = lu(A)
- da = decomposition(A,'lu').
If I run the following code on my PC I can see that decomposition(,'lu') is much faster than lu() (about a factor of 137).
load('SystemMatrix.mat')
disp('Loading done')
disp('Start LU decomposition with lu()')
tic
[L,U] = lu(SystemMatrix);
toc
Elapsed time is 30.138829 seconds.
disp('Start LU decomposition with decomposition([],''lu'')')
tic
da = decomposition(SystemMatrix,'lu');
toc
Elapsed time is 0.221673 seconds.
This is only a smaller example of my system matrix. If I want to decompose my full matrix, than lu() uses more than 32 GB of RAM (the calculation stops because out of memory), while decomposition(,'lu') uses only 10 to 13 GB of RAM and is finished after ca. 1 minute.
Here are my questions:
Why is decomposition(A,'lu') so much faster than lu(A)? Didn't they use the same algorithm?
Is there any way to get L and U from the decomposition object da? Because I want to solve an equation system with the same coefficient matrix several times (in parallel on different Computers) and I don't want to decompose the matrix on every Computer again.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Linear Algebra dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!