Finding inv(A) for Ax=b system
Mostrar comentarios más antiguos
I tried 3 methods to solve the system for inv(A), where A is highly sparse matrix spy(A) is given below:
1) pinv(A)......... Matlab solve it in 190 sec without any warnings.
2) A\b............. Matlab took only 10 sec but gives warning "Matrix is singular to working precision"
3) [L,U]=lu(A); inv(L)*inv(U) .......... Matlab took 50 sec but give the same warning as in 2nd method.
Is there anyway, I can get inv(A) without warnings.

3 comentarios
Did you read the inv documentation? It states: "It is seldom necessary to form the explicit inverse of a matrix. A frequent misuse of inv arises when solving the system of linear equations Ax = b. One way to solve the equation is with x = inv(A)*b. A better way, from the standpoint of both execution time and numerical accuracy, is to use the matrix backslash operator x = A\b. This produces the solution using Gaussian elimination, without explicitly forming the inverse. See mldivide for further information."
So really the best answer to your question is to stop using inv. Using inv is almost always the wrong way to solve a problem.
@Asif Arshid: What is your question? You observed that the slash operator has a different sensitivity to detect near to singular matrices than lu and inv(L)*inv(U). What is the condition number of the matrix? Do you think that slash is to pessimistic or the lu method too sloppy? Or are you surprised by the speed of the slash operator?
Asif Arshid
el 27 de Jul. de 2017
Respuestas (1)
Star Strider
el 27 de Jul. de 2017
0 votos
4 comentarios
Asif Arshid
el 27 de Jul. de 2017
Walter Roberson
el 27 de Jul. de 2017
The 4th parameter to lsqr() allows you to specify a higher number of iterations.
Star Strider
el 27 de Jul. de 2017
@Walter — Thank you.
M.Shaarawy
el 20 de Mayo de 2019
Is there regularized parameterized trust region sub problem (RPTRS) in MATLAB to solve this kind of problem?
Categorías
Más información sobre Sparse Matrices en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!