Mercurial > octave-nkf
diff src/DLD-FUNCTIONS/det.cc @ 5070:1e6f653ef1e3 ss-2-1-61
[project @ 2004-11-06 00:33:38 by jwe]
author | jwe |
---|---|
date | Sat, 06 Nov 2004 00:33:38 +0000 |
parents | a6755bc45f15 |
children | 57077d0ddc8e |
line wrap: on
line diff
--- 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