# HG changeset patch # User jwe # Date 1099701218 0 # Node ID 1e6f653ef1e332fbaab48ac44149b0eb2d3bcfc8 # Parent b9dae14b5ada74efa35ee53ed5347e1cafe1f478 [project @ 2004-11-06 00:33:38 by jwe] diff -r b9dae14b5ada -r 1e6f653ef1e3 src/ChangeLog --- a/src/ChangeLog Fri Nov 05 16:18:12 2004 +0000 +++ b/src/ChangeLog Sat Nov 06 00:33:38 2004 +0000 @@ -2,6 +2,9 @@ * version.h (OCTAVE_VERSION): Now 2.1.61. + * DLD-FUNCTIONS/det.cc (det): Always compute rcond so we can + detect numerically singular matrices. + 2004-11-04 John W. Eaton * pt-colon.cc (tree_colon_expression::line, diff -r b9dae14b5ada -r 1e6f653ef1e3 src/DLD-FUNCTIONS/det.cc --- a/src/DLD-FUNCTIONS/det.cc Fri Nov 05 16:18:12 2004 +0000 +++ b/src/DLD-FUNCTIONS/det.cc Sat Nov 06 00:33:38 2004 +0000 @@ -79,26 +79,16 @@ if (! error_state) { + // Always compute rcond, so we can detect numerically + // singular matrices. + int info; double rcond = 0.0; - - if (nargout > 1) - { - DET det = m.determinant (info, rcond); - retval(1) = rcond; - volatile double xrcond = rcond; - xrcond += 1.0; - retval(0) = ((info == -1 || xrcond == 1.0) - ? 0.0 : det.value ()); - } - else - { - DET det = m.determinant (info); - volatile double xrcond = rcond; - xrcond += 1.0; - retval(0) = ((info == -1 || xrcond == 1.0) - ? 0.0 : det.value ()); - } + DET det = m.determinant (info, rcond); + retval(1) = rcond; + volatile double xrcond = rcond; + xrcond += 1.0; + retval(0) = ((info == -1 || xrcond == 1.0) ? 0.0 : det.value ()); } } else if (arg.is_complex_type ()) @@ -107,26 +97,17 @@ if (! error_state) { + // Always compute rcond, so we can detect numerically + // singular matrices. + int info; double rcond = 0.0; - - if (nargout > 1) - { - ComplexDET det = m.determinant (info, rcond); - retval(1) = rcond; - volatile double xrcond = rcond; - xrcond += 1.0; - retval(0) = ((info == -1 || xrcond == 1.0) - ? Complex (0.0) : det.value ()); - } - else - { - ComplexDET det = m.determinant (info); - volatile double xrcond = rcond; - xrcond += 1.0; - retval(0) = ((info == -1 || xrcond == 1.0) - ? Complex (0.0) : det.value ()); - } + ComplexDET det = m.determinant (info, rcond); + retval(1) = rcond; + volatile double xrcond = rcond; + xrcond += 1.0; + retval(0) = ((info == -1 || xrcond == 1.0) + ? Complex (0.0) : det.value ()); } } else