Mercurial > hg > octave-nkf
changeset 5063:1c4a00f4bfb9
[project @ 2004-11-04 16:15:10 by jwe]
author | jwe |
---|---|
date | Thu, 04 Nov 2004 16:15:10 +0000 |
parents | 4114f428d682 |
children | a6755bc45f15 |
files | src/ChangeLog src/DLD-FUNCTIONS/det.cc src/DLD-FUNCTIONS/inv.cc |
diffstat | 3 files changed, 19 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2004-11-04 John W. Eaton <jwe@octave.org> + + * DLD-FUNCTIONS/inv.cc (Finv): Declare rcond volatile and check value. + * DLD-FUNCTIONS/det.cc (Fdet): Likewise. + 2004-11-03 John W. Eaton <jwe@octave.org> * data.cc (Fsize): Return 1 if requested dimension is larger than
--- a/src/DLD-FUNCTIONS/det.cc +++ b/src/DLD-FUNCTIONS/det.cc @@ -80,19 +80,21 @@ if (! error_state) { int info; - double rcond = 0.0; + volatile double rcond = 0.0; if (nargout > 1) { DET det = m.determinant (info, rcond); retval(1) = rcond; - retval(0) = (info == -1 ? 0.0 : det.value ()); + retval(0) = ((info == -1 || 1.0 + rcond == 1.0) + ? 0.0 : det.value ()); } else { DET det = m.determinant (info); - retval(0) = (info == -1 ? 0.0 : det.value ()); + retval(0) = ((info == -1 || 1.0 + rcond == 1.0) + ? 0.0 : det.value ()); } } } @@ -103,18 +105,20 @@ if (! error_state) { int info; - double rcond = 0.0; + volatile double rcond = 0.0; if (nargout > 1) { ComplexDET det = m.determinant (info, rcond); retval(1) = rcond; - retval(0) = (info == -1 ? Complex (0.0) : det.value ()); + retval(0) = ((info == -1 || 1.0 + rcond == 1.0) + ? Complex (0.0) : det.value ()); } else { ComplexDET det = m.determinant (info); - retval(0) = (info == -1 ? Complex (0.0) : det.value ()); + retval(0) = ((info == -1 | 1.0 + rcond == 1.0) + ? Complex (0.0) : det.value ()); } } }
--- a/src/DLD-FUNCTIONS/inv.cc +++ b/src/DLD-FUNCTIONS/inv.cc @@ -74,7 +74,7 @@ if (! error_state) { int info; - double rcond = 0.0; + volatile double rcond = 0.0; Matrix result = m.inverse (info, rcond, 1); @@ -83,7 +83,7 @@ retval(0) = result; - if (nargout < 2 && info == -1) + if (nargout < 2 && (info == -1 || 1.0 + rcond == 1.0)) warning ("inverse: matrix singular to machine precision,\ rcond = %g", rcond); } @@ -95,7 +95,7 @@ if (! error_state) { int info; - double rcond = 0.0; + volatile double rcond = 0.0; ComplexMatrix result = m.inverse (info, rcond, 1); @@ -104,7 +104,7 @@ retval(0) = result; - if (nargout < 2 && info == -1) + if (nargout < 2 && (info == -1 || 1.0 + rcond == 1.0)) warning ("inverse: matrix singular to machine precision,\ rcond = %g", rcond); }