Mercurial > hg > octave-nkf
diff liboctave/CMatrix.cc @ 3480:45742a3b1f7c
[project @ 2000-01-26 06:16:41 by jwe]
author | jwe |
---|---|
date | Wed, 26 Jan 2000 06:16:44 +0000 |
parents | fe0c38ca9d82 |
children | d14c483b3c12 |
line wrap: on
line diff
--- a/liboctave/CMatrix.cc +++ b/liboctave/CMatrix.cc @@ -918,7 +918,7 @@ { ComplexMatrix retval; - ComplexSVD result (*this); + ComplexSVD result (*this, SVD::economy); DiagMatrix S = result.singular_values (); ComplexMatrix U = result.left_singular_matrix (); @@ -1233,21 +1233,28 @@ { int info; double rcond; - return solve (b, info, rcond); + return solve (b, info, rcond, 0); } ComplexMatrix ComplexMatrix::solve (const Matrix& b, int& info) const { double rcond; - return solve (b, info, rcond); + return solve (b, info, rcond, 0); } ComplexMatrix ComplexMatrix::solve (const Matrix& b, int& info, double& rcond) const { + return solve (b, info, rcond, 0); +} + +ComplexMatrix +ComplexMatrix::solve (const Matrix& b, int& info, double& rcond, + solve_singularity_handler sing_handler) const +{ ComplexMatrix tmp (b); - return solve (tmp, info, rcond); + return solve (tmp, info, rcond, sing_handler); } ComplexMatrix @@ -1255,18 +1262,26 @@ { int info; double rcond; - return solve (b, info, rcond); + return solve (b, info, rcond, 0); } ComplexMatrix ComplexMatrix::solve (const ComplexMatrix& b, int& info) const { double rcond; - return solve (b, info, rcond); + return solve (b, info, rcond, 0); } + ComplexMatrix ComplexMatrix::solve (const ComplexMatrix& b, int& info, double& rcond) const { + return solve (b, info, rcond, 0); +} + +ComplexMatrix +ComplexMatrix::solve (const ComplexMatrix& b, int& info, double& rcond, + solve_singularity_handler sing_handler) const +{ ComplexMatrix retval; int nr = rows (); @@ -1299,6 +1314,13 @@ if (rcond_plus_one == 1.0) { info = -2; + + if (sing_handler) + sing_handler (rcond); + else + (*current_liboctave_error_handler) + ("matrix singular to machine precision, rcond = %g", + rcond); } else { @@ -1332,20 +1354,28 @@ { int info; double rcond; - return solve (b, info, rcond); + return solve (b, info, rcond, 0); } ComplexColumnVector ComplexMatrix::solve (const ComplexColumnVector& b, int& info) const { double rcond; - return solve (b, info, rcond); + return solve (b, info, rcond, 0); } ComplexColumnVector ComplexMatrix::solve (const ComplexColumnVector& b, int& info, double& rcond) const { + return solve (b, info, rcond, 0); +} + +ComplexColumnVector +ComplexMatrix::solve (const ComplexColumnVector& b, int& info, + double& rcond, + solve_singularity_handler sing_handler) const +{ ComplexColumnVector retval; int nr = rows (); @@ -1379,6 +1409,13 @@ if (rcond_plus_one == 1.0) { info = -2; + + if (sing_handler) + sing_handler (rcond); + else + (*current_liboctave_error_handler) + ("matrix singular to machine precision, rcond = %g", + rcond); } else {