Mercurial > octave
diff test/diag-perm.tst @ 27093:6e18f0ce268c
Inverse of a sparse/diagonal singular matrix should be a sparse/diagonal matrix of Infs.
* liboctave/array/CSparse.cc(inverse): if the matrix is null, return an error.
If it is singular, return a sparse matrix of Infs.
* liboctave/array/dSparse.cc(inverse): if the matrix is null, return an error.
If it is singular, return a sparse matrix of Infs.
* liboctave/array/CDiagMatrix.cc(inverse): if the matrix is null, return
an error. If it is singular, return a diagonal matrix of Infs.
* liboctave/array/dDiagMatrix.cc(inverse): if the matrix is null, return
an error. If it is singular, return a diagonal matrix of Infs.
* libinterp/corefcn/inv.cc: set rcond to zero for singular diagonal matrices.
Add tests for the above cases.
* test/diag-perm.tst: modify a test for the inversion of a singular diagonal
matrix.
author | marco.caliari@univr.it |
---|---|
date | Tue, 14 May 2019 17:00:52 +0200 |
parents | 00f796120a6d |
children | b442ec6dda5c |
line wrap: on
line diff
--- a/test/diag-perm.tst Sat May 18 13:18:00 2019 +0200 +++ b/test/diag-perm.tst Tue May 14 17:00:52 2019 +0200 @@ -265,11 +265,12 @@ %! assert (full (D - A), D - full (A)); ## inverse preserves diagonal structure even for singular matrices (bug #46103) +## but set all the diagonal elements to Inf (bug #56232) %!test %! x = diag (1:3); %! assert (inv (x), diag ([1 1/2 1/3])); -%! x = diag (0:2); -%! assert (inv (x), diag ([Inf 1 1/2])); +%!warning <matrix singular> A = inv (diag (0:2)); +%! assert (A, diag ([Inf Inf Inf])); ## assignment to diagonal elements preserves diagonal structure (bug #36932) %!test