Mercurial > octave-libgccjit
diff liboctave/dMatrix.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/dMatrix.cc Wed Jan 26 04:08:07 2000 +0000 +++ b/liboctave/dMatrix.cc Wed Jan 26 06:16:44 2000 +0000 @@ -612,7 +612,7 @@ Matrix Matrix::pseudo_inverse (double tol) { - SVD result (*this); + SVD result (*this, SVD::economy); DiagMatrix S = result.singular_values (); Matrix U = result.left_singular_matrix (); @@ -938,6 +938,13 @@ Matrix Matrix::solve (const Matrix& b, int& info, double& rcond) const { + return solve (b, info, rcond, 0); +} + +Matrix +Matrix::solve (const Matrix& b, int& info, double& rcond, + solve_singularity_handler sing_handler) const +{ Matrix retval; int nr = rows (); @@ -970,6 +977,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 { @@ -1019,6 +1033,14 @@ return tmp.solve (b, info, rcond); } +ComplexMatrix +Matrix::solve (const ComplexMatrix& b, int& info, double& rcond, + solve_singularity_handler sing_handler) const +{ + ComplexMatrix tmp (*this); + return tmp.solve (b, info, rcond, sing_handler); +} + ColumnVector Matrix::solve (const ColumnVector& b) const { @@ -1036,6 +1058,13 @@ ColumnVector Matrix::solve (const ColumnVector& b, int& info, double& rcond) const { + return solve (b, info, rcond, 0); +} + +ColumnVector +Matrix::solve (const ColumnVector& b, int& info, double& rcond, + solve_singularity_handler sing_handler) const +{ ColumnVector retval; int nr = rows (); @@ -1069,6 +1098,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 { @@ -1108,6 +1144,14 @@ return tmp.solve (b, info, rcond); } +ComplexColumnVector +Matrix::solve (const ComplexColumnVector& b, int& info, double& rcond, + solve_singularity_handler sing_handler) const +{ + ComplexMatrix tmp (*this); + return tmp.solve (b, info, rcond, sing_handler); +} + Matrix Matrix::lssolve (const Matrix& b) const {