|Subject:||What should the inverse of a singular sparse matrix be?|
|Date:||Fri, 10 May 2019 08:07:29 +0000|
it was recently fixed a nasty segmentation fault while trying to invert a sparse singular matrix
The question now is: what should the result of inv (A) be, with A a sparse singular matrix?
A is a full singular matrix: both Octave and Matlab return inv (A) as a full matrix of the same dimension of A with Inf as elements, that is Inf (size (A)), plus a warning.
A is a sparse singular matrix: Matlab returns, in most cases, a *full* matrix with +/- Inf and/or NaN. Not clear to find a pattern. Octave returns a "division by zero" error.
My proposal, for A sparse singular, is to return a matrix with the same sparsity pattern of A, with Inf as elements, plus a warning. This solution has the advantage to not return a full useless matrix for a sparse singular input. The drawback is that the inverse of the sparse null matrix would be the input itself. In this specific case, I propose to turn the warning to a dedicated error. Additionally, I propose to extend this last behavior to the full null case. I cannot imagine a situation in which a user wants to invert the null matrix, except for a coding mistake.
Other opinions or comments are welcome.
|[Prev in Thread]||Current Thread||[Next in Thread]|