Mercurial > octave
diff liboctave/array/dMatrix.cc @ 24195:d3dc76efb38b
Return correct value for pinv of zero vectors and scalars (bug #51246).
CMatrix.cc, dMatrix.cc (pseudo_inverse): Change any computed tolerance of 0 to
std::numeric_limits<double>::min() so that zero values are later dropped from
calculation.
fCMatrix.cc, fMatrix.cc (pseudo_inverse): Change calculation of default tolerance
to us the <float> version of std::numeric_limits::epsilon () rather than the
double version. Change any computed tolerance of 0 to
std::numeric_limits<float>::min() so that zero values are later dropped from
calculation.
* pinv.cc (Fpinv): Add BIST tests.
author | Rik <rik@octave.org> |
---|---|
date | Fri, 03 Nov 2017 10:03:36 -0700 |
parents | bc0aa7e18c96 |
children | 2b769c242188 |
line wrap: on
line diff
--- a/liboctave/array/dMatrix.cc Fri Nov 03 15:49:18 2017 +0100 +++ b/liboctave/array/dMatrix.cc Fri Nov 03 10:03:36 2017 -0700 @@ -672,6 +672,9 @@ tol = nr * sigma.elem (0) * std::numeric_limits<double>::epsilon (); else tol = nc * sigma.elem (0) * std::numeric_limits<double>::epsilon (); + + if (tol == 0) + tol = std::numeric_limits<double>::min (); } while (r >= 0 && sigma.elem (r) < tol)