Savannah is a central point for development,
distribution and maintenance of free software,
both GNU and non-GNU.
The question now is:
what should the result of inv (A) be, with A a sparse
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.
I like the idea of splitting the special case of an empty matrix
(probably a mistake, and, in any case, no useful value to return)
from the more general singular matrix.