How to determine which algorithm mldivide (A\b) uses

조회 수: 24 (최근 30일)
Jonathan
Jonathan 2015년 10월 27일
답변: Grzegorz Knor 2017년 4월 19일
I have a sparse, banded matrix, A, for which I am solving the linear system Ax=b using A\b in Matlab.
The documentation for mldivide shows a flow chart that explains which solver it will use. However, I would like to automate the process of determining the best algorithm. Therefore, I would really just like to know which algorithm mldivide chooses for different inputs. Is there a way to get this information out?

답변 (3개)

Grzegorz Knor
Grzegorz Knor 2017년 4월 19일
For sparse matrices check function spparms :
spparms('spumoni',2)
sparse(rand(3))\rand(3,1)
On my computer it produces:
sp\: bandwidth = 2+1+2.
sp\: is A diagonal? no.
sp\: is band density (1) > bandden (0.5) to try banded solver? yes.
sp\: is LAPACK's banded solver successful? yes.

the cyclist
the cyclist 2015년 10월 27일
Look at the Algorithms section of this documentation page.
  댓글 수: 1
Jonathan
Jonathan 2015년 10월 27일
편집: Jonathan 2015년 10월 27일
Yes, thanks, as I stated in my question, I already looked at that. However, what I what to know is if I can give mldivide various inputs and have it automatically tell me which algorithm it choses.
In other words, I want to automate this process.

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


Jan
Jan 2015년 10월 27일
편집: Jan 2015년 10월 27일
I'm not sure if I understand your question. You explain:
The documentation for mldivide shows a flow chart that explains which solver it will use.
Is this not a valid answer of your question already? Or are you looking for the name of the library function instead of the name of the solver? Matlab does not offer the source code for mldivide.
  댓글 수: 3
Jan
Jan 2015년 10월 30일
The function mldivide willnot tell you, which algorithm is used. This is not the purpose of this command. You can write such a function by your own translating the flow chart of the documentation to a bunch of IF statements.
Steven Lord
Steven Lord 2015년 10월 30일
Even if it DID tell you, for what purpose would you use that information?
Perhaps you would be better served by the LINSOLVE function, which allows you to specify various properties of the coefficient matrix for the system you're trying to solve. This can avoid some of the testing for those matrix properties (which for large matrices could be expensive.)

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

카테고리

Help CenterFile Exchange에서 Operating on Diagonal Matrices에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by