Why does inv() work on a rank deficient matrix?
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Jacob Schaperow
le 6 Jan 2022
Commenté : Walter Roberson
le 6 Jan 2022
I have an nxn square matrix A with rank n-1. When I call inv(A), MATLAB computes the inverse without complaining. How is this possible? Shouldn't a matrix that is rank deficient be impossible to invert?
0 commentaires
Réponse acceptée
Walter Roberson
le 6 Jan 2022
If I recall correctly, inv() does not use rank() to detect rank deficiency.
"inv performs an LU decomposition of the input matrix (or an LDL decomposition if the input matrix is Hermitian). It then uses the results to form a linear system whose solution is the matrix inverse inv(X). For sparse inputs, inv(X) creates a sparse identity matrix and uses backslash, X\speye(size(X))."
These algorithms have their own internal settings as to whether they complain about a marginal matrix or not. Depending on the numeric noise in the calculations, sometimes they do not detect a matrix as singular when it is singular.
... You probably should not be using inv() anyhow.
2 commentaires
Walter Roberson
le 6 Jan 2022
Yes, and the tolerance of the backslash operator has changed in the not-so-distant past. Changed both ways: mostly to reject more problematic matrices, but it also started accepting some matrices it should probably have rejected.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Linear Algebra dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!