# HG changeset patch # User jwe # Date 819457369 0 # Node ID 5a8ad3d12304e5541aa10633b59a2168bf336d3f # Parent 593fff2e7e39c35c41eea4e16f7e23ee9e054c35 [project @ 1995-12-20 10:58:39 by jwe] diff --git a/liboctave/CMatrix.cc b/liboctave/CMatrix.cc --- a/liboctave/CMatrix.cc +++ b/liboctave/CMatrix.cc @@ -774,7 +774,7 @@ } ComplexMatrix -ComplexMatrix::inverse (int& info, double& rcond) const +ComplexMatrix::inverse (int& info, double& rcond, int force) const { int nr = rows (); int nc = cols (); @@ -794,7 +794,7 @@ F77_FCN (zgeco, ZGECO) (tmp_data, nr, nc, ipvt, rcond, z); volatile double rcond_plus_one = rcond + 1.0; - if (rcond_plus_one == 1.0) + if (rcond_plus_one == 1.0 && ! force) { info = -1; copy (tmp_data, data (), len); // Restore contents. diff --git a/liboctave/CMatrix.h b/liboctave/CMatrix.h --- a/liboctave/CMatrix.h +++ b/liboctave/CMatrix.h @@ -124,7 +124,7 @@ ComplexMatrix inverse (void) const; ComplexMatrix inverse (int& info) const; - ComplexMatrix inverse (int& info, double& rcond) const; + ComplexMatrix inverse (int& info, double& rcond, int force = 0) const; ComplexMatrix pseudo_inverse (double tol = 0.0); diff --git a/liboctave/dMatrix.cc b/liboctave/dMatrix.cc --- a/liboctave/dMatrix.cc +++ b/liboctave/dMatrix.cc @@ -503,7 +503,7 @@ } Matrix -Matrix::inverse (int& info, double& rcond) const +Matrix::inverse (int& info, double& rcond, int force) const { int nr = rows (); int nc = cols (); @@ -523,7 +523,7 @@ F77_FCN (dgeco, DGECO) (tmp_data, nr, nc, ipvt, rcond, z); volatile double rcond_plus_one = rcond + 1.0; - if (rcond_plus_one == 1.0) + if (rcond_plus_one == 1.0 && ! force) { info = -1; copy (tmp_data, data (), len); // Restore matrix contents. diff --git a/liboctave/dMatrix.h b/liboctave/dMatrix.h --- a/liboctave/dMatrix.h +++ b/liboctave/dMatrix.h @@ -108,7 +108,7 @@ Matrix inverse (void) const; Matrix inverse (int& info) const; - Matrix inverse (int& info, double& rcond) const; + Matrix inverse (int& info, double& rcond, int force = 0) const; Matrix pseudo_inverse (double tol = 0.0); diff --git a/src/inv.cc b/src/inv.cc --- a/src/inv.cc +++ b/src/inv.cc @@ -76,7 +76,7 @@ int info; double rcond = 0.0; - retval = m.inverse (info, rcond); + retval = m.inverse (info, rcond, 1); if (info == -1) warning ("inverse: matrix singular to machine precision,\ @@ -92,7 +92,7 @@ int info; double rcond = 0.0; - retval = m.inverse (info, rcond); + retval = m.inverse (info, rcond, 1); if (info == -1) warning ("inverse: matrix singular to machine precision,\ diff --git a/src/xpow.cc b/src/xpow.cc --- a/src/xpow.cc +++ b/src/xpow.cc @@ -206,7 +206,7 @@ int info; double rcond = 0.0; - atmp = a.inverse (info, rcond); + atmp = a.inverse (info, rcond, 1); if (info == -1) warning ("inverse: matrix singular to machine\ @@ -399,7 +399,7 @@ int info; double rcond = 0.0; - atmp = a.inverse (info, rcond); + atmp = a.inverse (info, rcond, 1); if (info == -1) warning ("inverse: matrix singular to machine\