Why is the timing for decomposition and backsolve for M and M' so different?
古いコメントを表示
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 件のコメント
Stephen23
2025 年 11 月 9 日
Is there a particular reason why you are using the complex conjugate transpose of a real-valued matrix?
Francois
2025 年 11 月 9 日
Francois
2025 年 11 月 9 日
Torsten
2025 年 11 月 9 日
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
2025 年 11 月 9 日
Paul
2025 年 11 月 9 日
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
2025 年 11 月 10 日
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.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



