Why is the timing for decomposition and backsolve for M and M' so different?
Ältere Kommentare anzeigen
Question: Why is the timing for doing lu decomposition and back solve so different for M versus M'?
Background: I have a non-symmetric 377544 x 377544 sparse real valued matrix with the sparsity pattern shown in the spy plot below.
FM = decomposition(M);
Takes about 36 seconds, but
FadjM = decomposition(M');
Takes about 42 minutes!
On the other hand for F a 377544 x 12 real dense matrix,
test = FM \ F;
Takes about 23 seconds, but
test = FM' \ F;
Takes only 8.5 seconds.
If I try to decompose the transpose of M and then test the backsolves I find that
test = FadjM \ F;
takes about 300 seconds, while
test = FadjM' \ F;
also takes about 300 seconds.
Does anyone have any insights into what is going on? If anyone is interested in investigating more deeply, I'm happy to upload M.
Thank you,
Francois

12 Kommentare
Stephen23
am 9 Nov. 2025
Is there a particular reason why you are using the complex conjugate transpose of a real-valued matrix?
Francois
am 9 Nov. 2025
Francois
am 9 Nov. 2025
Torsten
am 9 Nov. 2025
If anyone is interested in investigating more deeply, I'm happy to upload M.
I think nobody will be able to give a useful answer to your question without the matrix M. So if the size of the matrix is not too large for "Answers", you should include it here as a .mat - file.
Francois
am 9 Nov. 2025
Paul
am 9 Nov. 2025
Can you generate an M and F with reduced size but the same structure that still illustrates the problem but can be uploaded?
Running here to verify similar behavior on Answers and that both decompositions are of the same type.
load MandF
tic; FM = decomposition(M); toc, FM.Type
tic; FadjM = decomposition(M'); toc, FadjM.Type
tic,issparse(M');toc % just to make sure nothing nefarious when transposing
tic; test = FM \ F; toc
tic; test = FM' \ F; toc
tic; test = FadjM \ F; toc
tic; test = FadjM' \ F; toc
Even though FadjM uses lu, maybe the structure of M' makes the the algorithm for selecting lu take longer to get there.
Force lu
tic,Foo = decomposition(M','lu');toc
So that's not it.
Not an answer why decomposing A' takes so much longer, but using that if A = L*U, then A' = U' * L', you can use the LU factorization for A to get one for A':
A = rand(3)+1i*rand(3);
[L1,U1] = lu(A);
A'- U1'*L1'
A - L1*U1
Francois
am 10 Nov. 2025
Maybe it's best to address this question directly to the MATLAB developers:
We are only MATLAB users who don't have insight into implementation details.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Sparse Matrices finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



