linsolve behaviour for SYM true and POSDEF false

Does linsolve use an LDL factoring if the options are SYM true and POSDEF false?

댓글 수: 7

Sylvan
Sylvan 2024년 9월 29일
이동: John D'Errico 2024년 9월 29일
Thorsten answered my question. RTFM, I guess. Thanks
Sylvan
Sylvan 2024년 9월 29일
이동: Torsten 2024년 9월 29일
What does "Moved: John D'Errico" mean, please? I'm a newbie to this forum.
Torsten
Torsten 2024년 9월 29일
편집: Torsten 2024년 9월 29일
Your contribution
Thorsten answered my question. RTFM, I guess. Thanks
was not an answer, but just a comment (like your contribution now:
What does "Moved: John D'Errico" mean, please? I'm a newbie to this forum.
)
So @ John D'Errico and me changed the classification from "answer" to "comment".
Concerning your question again:
I read
Description
X = linsolve(A,B) solves the linear system AX = B using one of these methods:
  • When A is square, linsolve uses LU factorization with partial pivoting.
  • For all other cases, linsolve uses QR factorization with column pivoting.
linsolve warns if A is ill conditioned (for square matrices) or rank deficient (for rectangular matrices).
But then I saw that you can additionally use an "opts" structure in which you describe special properties of the matrix. So I'm no longer sure if using the "opts" structure makes linsolve switch to more specialized algorithms not mentionned in detail (like chol, e.g., for Hermitian positive definite matrices A).
Following the flowchart under
it seems that for symmetric indefinite matrices LU is used.
A literal reading of the documentation is that QR is used for SYM true, POSDEF false but LDL is a possibility for that case if you don't take it literally. But LDL can be unstable so maybe the QR factoring is used to avoid problems. The reason I ask is that linsolve with those options takes longer that LU on a sparse example I ran so that's consistent with QR being used because I'd expect LDL to be faster than LU.
What does "Moved: John D'Errico" mean, please? I'm a newbie to this forum.
John D'Errico used tools available to moderators, to move your contribution from where it was, into becoming a comment on the Question. The system automatically attached a notation that the contribution was moved and who moved it.
Torsten
Torsten 2024년 9월 30일
편집: Torsten 2024년 9월 30일
linsolve will use the same solver as mldivide if you specify that your matrix is symmetric indefinite, and according to the flowchart of solvers under
mldivide would use LU for full matrices and LDL for sparse matrices. But better you recheck the yes/no cases in the two flowcharts in the "Algorithms" section.
To be sure you could also contact MATLAB support directly:
Thanks for all the comments.
Background: I am comparing computation times for solution of 2 sparse systems: one is SYM, INDEF and invertible and the other is square and invertible. I am now comparing the times of LU and LDL so there is no checking of matrix structure by Matlab before solving and the timings reflect only the solution process times.
Thanks again.

댓글을 달려면 로그인하십시오.

답변 (1개)

Vandit
Vandit 2024년 9월 29일
편집: Vandit 2024년 9월 29일

0 개 추천

Hello Sylvan,
The "linsolve" function does not use LDL factorization if the options are set to 'SYM' true and 'POSDEF' false. Instead, it will use the appropriate solver based on the properties specified in the options structure. If 'SYM' is true, it will typically use a method suitable for symmetric matrices, but without the positive definiteness condition, it won't specifically apply LDL factorization.
For more information on "linsolve" function, please refer to the below documentation:
Hope this helps.

댓글 수: 2

I guess it does answer the question. Thank you. What I really should have asked is "which factoring does linsove use in that case?"
I ask because I could not see an answer to that question in the documentation.

댓글을 달려면 로그인하십시오.

카테고리

제품

릴리스

R2024a

질문:

2024년 9월 29일

댓글:

2024년 9월 30일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by