Mercurial > hg > octave-avbm
changeset 7973:e69bca367ed7
DLD-FUNCTIONS/det.cc (Fdet): return calculated determinant for numerically singular matrices
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 25 Jul 2008 15:20:39 -0400 |
parents | 5bf4e2c13ed8 |
children | fcaddd090f98 |
files | src/ChangeLog src/DLD-FUNCTIONS/det.cc |
diffstat | 2 files changed, 9 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2008-07-25 John W. Eaton <jwe@octave.org> + * DLD-FUNCTIONS/det.cc (Fdet): Return calculated determinant for + numerically singular matrices, not 0. + * symtab.cc (get_dispatch_type): New function. (symbol_table::fcn_info::fcn_info_rep::find): Use it.
--- a/src/DLD-FUNCTIONS/det.cc +++ b/src/DLD-FUNCTIONS/det.cc @@ -91,9 +91,7 @@ { FloatDET det = m.determinant (info, rcond); retval(1) = rcond; - volatile float xrcond = rcond; - xrcond += 1.0; - retval(0) = ((info == -1 || xrcond == 1.0) ? static_cast<float>(0.0) : det.value ()); + retval(0) = info == -1 ? static_cast<float>(0.0) : det.value (); } } else if (arg.is_complex_type ()) @@ -107,11 +105,7 @@ { FloatComplexDET det = m.determinant (info, rcond); retval(1) = rcond; - volatile float xrcond = rcond; - xrcond += 1.0; - retval(0) = ((info == -1 || xrcond == 1.0) - ? FloatComplex (0.0) : det.value ()); - + retval(0) = info == -1 ? FloatComplex (0.0) : det.value (); } } } @@ -130,9 +124,7 @@ { 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 ()); + retval(0) = info == -1 ? 0.0 : det.value (); } } else @@ -142,9 +134,7 @@ { 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 ()); + retval(0) = info == -1 ? 0.0 : det.value (); } } } @@ -161,10 +151,7 @@ { 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 ()); + retval(0) = info == -1 ? Complex (0.0) : det.value (); } } else @@ -174,11 +161,7 @@ { 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 ()); - + retval(0) = info == -1 ? Complex (0.0) : det.value (); } } }