Mercurial > octave-nkf
diff liboctave/array/fDiagMatrix.cc @ 20603:f61c67865d9f
Don't return A for inv (A) when A is a singular Diagonal matrix (bug #46103).
* dDiagMatrix.cc (inverse), fDiagMatrix.cc (inverse): return octave_Inf for the
inverse of a diagonal element whose value is 0.
* test/diag-perm.tst: Add tests for new behavior.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 07 Oct 2015 07:41:44 -0700 |
parents | a9574e3c6e9e |
children |
line wrap: on
line diff
--- a/liboctave/array/fDiagMatrix.cc Tue Oct 06 22:14:41 2015 +0200 +++ b/liboctave/array/fDiagMatrix.cc Wed Oct 07 07:41:44 2015 -0700 @@ -280,10 +280,7 @@ for (octave_idx_type i = 0; i < len; i++) { if (elem (i, i) == 0.0) - { - info = -1; - return *this; - } + retval.elem (i, i) = octave_Inf; else retval.elem (i, i) = 1.0 / elem (i, i); }