Mercurial > octave
changeset 21719:ff054947d132
use bool instead of int for some logical flags
* CMatrix.cc, CMatrix.h, CSparse.cc, CSparse.h, dMatrix.cc, dMatrix.h,
dSparse.cc, dSparse.h, fCMatrix.cc, fCMatrix.h, fMatrix.cc, fMatrix.h:
Use bool instead of int for logical flags calc_cond,
columns_are_real_only, and force.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 16 May 2016 23:26:07 -0400 |
parents | 601ee461f231 |
children | b28c26ae737c |
files | liboctave/array/CMatrix.cc liboctave/array/CMatrix.h liboctave/array/CSparse.cc liboctave/array/CSparse.h liboctave/array/dMatrix.cc liboctave/array/dMatrix.h liboctave/array/dSparse.cc liboctave/array/dSparse.h liboctave/array/fCMatrix.cc liboctave/array/fCMatrix.h liboctave/array/fMatrix.cc liboctave/array/fMatrix.h |
diffstat | 12 files changed, 75 insertions(+), 74 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/array/CMatrix.cc Mon May 16 22:21:19 2016 -0700 +++ b/liboctave/array/CMatrix.cc Mon May 16 23:26:07 2016 -0400 @@ -933,8 +933,8 @@ } ComplexMatrix -ComplexMatrix::inverse (octave_idx_type& info, double& rcon, int force, - int calc_cond) const +ComplexMatrix::inverse (octave_idx_type& info, double& rcon, bool force, + bool calc_cond) const { MatrixType mattype (*this); return inverse (mattype, info, rcon, force, calc_cond); @@ -957,7 +957,7 @@ ComplexMatrix ComplexMatrix::tinverse (MatrixType &mattype, octave_idx_type& info, - double& rcon, int force, int calc_cond) const + double& rcon, bool force, bool calc_cond) const { ComplexMatrix retval; @@ -1012,7 +1012,7 @@ ComplexMatrix ComplexMatrix::finverse (MatrixType &mattype, octave_idx_type& info, - double& rcon, int force, int calc_cond) const + double& rcon, bool force, bool calc_cond) const { ComplexMatrix retval; @@ -1095,7 +1095,7 @@ ComplexMatrix ComplexMatrix::inverse (MatrixType &mattype, octave_idx_type& info, - double& rcon, int force, int calc_cond) const + double& rcon, bool force, bool calc_cond) const { int typ = mattype.type (false); ComplexMatrix ret; @@ -1519,7 +1519,7 @@ ComplexDET ComplexMatrix::determinant (octave_idx_type& info, double& rcon, - int calc_cond) const + bool calc_cond) const { MatrixType mattype (*this); return determinant (mattype, info, rcon, calc_cond); @@ -1528,7 +1528,7 @@ ComplexDET ComplexMatrix::determinant (MatrixType& mattype, octave_idx_type& info, double& rcon, - int calc_cond) const + bool calc_cond) const { ComplexDET retval (1.0); @@ -3762,13 +3762,13 @@ for (octave_idx_type j = 0; j < nc; j++) { - int columns_are_real_only = 1; + bool columns_are_real_only = true; for (octave_idx_type i = 0; i < nr; i++) { octave_quit (); if (std::imag (a(i, j)) != 0.0 || std::imag (b(i, j)) != 0.0) { - columns_are_real_only = 0; + columns_are_real_only = false; break; } } @@ -3847,13 +3847,13 @@ for (octave_idx_type j = 0; j < nc; j++) { - int columns_are_real_only = 1; + bool columns_are_real_only = true; for (octave_idx_type i = 0; i < nr; i++) { octave_quit (); if (std::imag (a(i, j)) != 0.0 || std::imag (b(i, j)) != 0.0) { - columns_are_real_only = 0; + columns_are_real_only = false; break; } }
--- a/liboctave/array/CMatrix.h Mon May 16 22:21:19 2016 -0700 +++ b/liboctave/array/CMatrix.h Mon May 16 23:26:07 2016 -0400 @@ -189,22 +189,22 @@ private: ComplexMatrix tinverse (MatrixType &mattype, octave_idx_type& info, - double& rcon, int force, int calc_cond) const; + double& rcon, bool force, bool calc_cond) const; ComplexMatrix finverse (MatrixType &mattype, octave_idx_type& info, - double& rcon, int force, int calc_cond) const; + double& rcon, bool force, bool calc_cond) const; public: ComplexMatrix inverse (void) const; ComplexMatrix inverse (octave_idx_type& info) const; - ComplexMatrix inverse (octave_idx_type& info, double& rcon, int force = 0, - int calc_cond = 1) const; + ComplexMatrix inverse (octave_idx_type& info, double& rcon, + bool force = false, bool calc_cond = true) const; ComplexMatrix inverse (MatrixType &mattype) const; ComplexMatrix inverse (MatrixType &mattype, octave_idx_type& info) const; ComplexMatrix inverse (MatrixType &mattype, octave_idx_type& info, - double& rcon, int force = 0, - int calc_cond = 1) const; + double& rcon, bool force = false, + bool calc_cond = true) const; ComplexMatrix pseudo_inverse (double tol = 0.0) const; @@ -217,9 +217,9 @@ ComplexDET determinant (void) const; ComplexDET determinant (octave_idx_type& info) const; ComplexDET determinant (octave_idx_type& info, double& rcon, - int calc_cond = 1) const; + bool calc_cond = true) const; ComplexDET determinant (MatrixType &mattype, octave_idx_type& info, - double& rcon, int calc_cond = 1) const; + double& rcon, bool calc_cond = true) const; double rcond (void) const; double rcond (MatrixType &mattype) const;
--- a/liboctave/array/CSparse.cc Mon May 16 22:21:19 2016 -0700 +++ b/liboctave/array/CSparse.cc Mon May 16 23:26:07 2016 -0400 @@ -1057,7 +1057,7 @@ SparseComplexMatrix SparseComplexMatrix::inverse (MatrixType& mattype, octave_idx_type& info, - double& rcond, int, int calc_cond) const + double& rcond, bool, bool calc_cond) const { int typ = mattype.type (false); SparseComplexMatrix ret; @@ -1138,7 +1138,7 @@ ComplexDET SparseComplexMatrix::determinant (octave_idx_type& err, double& rcond, - int) const + bool) const { ComplexDET retval;
--- a/liboctave/array/CSparse.h Mon May 16 22:21:19 2016 -0700 +++ b/liboctave/array/CSparse.h Mon May 16 23:26:07 2016 -0400 @@ -164,13 +164,13 @@ SparseComplexMatrix inverse (MatrixType& mattype, octave_idx_type& info) const; SparseComplexMatrix inverse (MatrixType& mattype, octave_idx_type& info, - double& rcond, int force = 0, - int calc_cond = 1) const; + double& rcond, bool force = false, + bool calc_cond = true) const; ComplexDET determinant (void) const; ComplexDET determinant (octave_idx_type& info) const; ComplexDET determinant (octave_idx_type& info, double& rcond, - int calc_cond = 1) const; + bool calc_cond = true) const; private: // Diagonal matrix solvers
--- a/liboctave/array/dMatrix.cc Mon May 16 22:21:19 2016 -0700 +++ b/liboctave/array/dMatrix.cc Mon May 16 23:26:07 2016 -0400 @@ -625,8 +625,8 @@ } Matrix -Matrix::inverse (octave_idx_type& info, double& rcon, int force, - int calc_cond) const +Matrix::inverse (octave_idx_type& info, double& rcon, bool force, + bool calc_cond) const { MatrixType mattype (*this); return inverse (mattype, info, rcon, force, calc_cond); @@ -649,7 +649,7 @@ Matrix Matrix::tinverse (MatrixType &mattype, octave_idx_type& info, double& rcon, - int force, int calc_cond) const + bool force, bool calc_cond) const { Matrix retval; @@ -705,7 +705,7 @@ Matrix Matrix::finverse (MatrixType &mattype, octave_idx_type& info, double& rcon, - int force, int calc_cond) const + bool force, bool calc_cond) const { Matrix retval; @@ -785,7 +785,7 @@ Matrix Matrix::inverse (MatrixType &mattype, octave_idx_type& info, double& rcon, - int force, int calc_cond) const + bool force, bool calc_cond) const { int typ = mattype.type (false); Matrix ret; @@ -1202,7 +1202,7 @@ } DET -Matrix::determinant (octave_idx_type& info, double& rcon, int calc_cond) const +Matrix::determinant (octave_idx_type& info, double& rcon, bool calc_cond) const { MatrixType mattype (*this); return determinant (mattype, info, rcon, calc_cond); @@ -1210,7 +1210,7 @@ DET Matrix::determinant (MatrixType& mattype, - octave_idx_type& info, double& rcon, int calc_cond) const + octave_idx_type& info, double& rcon, bool calc_cond) const { DET retval (1.0);
--- a/liboctave/array/dMatrix.h Mon May 16 22:21:19 2016 -0700 +++ b/liboctave/array/dMatrix.h Mon May 16 23:26:07 2016 -0400 @@ -149,21 +149,21 @@ private: Matrix tinverse (MatrixType &mattype, octave_idx_type& info, double& rcon, - int force, int calc_cond) const; + bool force, bool calc_cond) const; Matrix finverse (MatrixType &mattype, octave_idx_type& info, double& rcon, - int force, int calc_cond) const; + bool force, bool calc_cond) const; public: Matrix inverse (void) const; Matrix inverse (octave_idx_type& info) const; - Matrix inverse (octave_idx_type& info, double& rcon, int force = 0, - int calc_cond = 1) const; + Matrix inverse (octave_idx_type& info, double& rcon, bool force = false, + bool calc_cond = true) const; Matrix inverse (MatrixType &mattype) const; Matrix inverse (MatrixType &mattype, octave_idx_type& info) const; Matrix inverse (MatrixType &mattype, octave_idx_type& info, double& rcon, - int force = 0, int calc_cond = 1) const; + bool force = false, bool calc_cond = true) const; Matrix pseudo_inverse (double tol = 0.0) const; @@ -176,9 +176,9 @@ DET determinant (void) const; DET determinant (octave_idx_type& info) const; DET determinant (octave_idx_type& info, double& rcon, - int calc_cond = 1) const; + bool calc_cond = true) const; DET determinant (MatrixType &mattype, octave_idx_type& info, - double& rcon, int calc_cond = 1) const; + double& rcon, bool calc_cond = true) const; double rcond (void) const; double rcond (MatrixType &mattype) const;
--- a/liboctave/array/dSparse.cc Mon May 16 22:21:19 2016 -0700 +++ b/liboctave/array/dSparse.cc Mon May 16 23:26:07 2016 -0400 @@ -1147,7 +1147,7 @@ SparseMatrix SparseMatrix::inverse (MatrixType &mattype, octave_idx_type& info, - double& rcond, int, int calc_cond) const + double& rcond, bool, bool calc_cond) const { int typ = mattype.type (false); SparseMatrix ret; @@ -1224,7 +1224,7 @@ } DET -SparseMatrix::determinant (octave_idx_type& err, double& rcond, int) const +SparseMatrix::determinant (octave_idx_type& err, double& rcond, bool) const { DET retval;
--- a/liboctave/array/dSparse.h Mon May 16 22:21:19 2016 -0700 +++ b/liboctave/array/dSparse.h Mon May 16 23:26:07 2016 -0400 @@ -164,12 +164,13 @@ SparseMatrix inverse (MatrixType& mattype) const; SparseMatrix inverse (MatrixType& mattype, octave_idx_type& info) const; SparseMatrix inverse (MatrixType& mattype, octave_idx_type& info, - double& rcond, int force = 0, int calc_cond = 1) const; + double& rcond, bool force = false, + bool calc_cond = true) const; DET determinant (void) const; DET determinant (octave_idx_type& info) const; DET determinant (octave_idx_type& info, double& rcond, - int calc_cond = 1) const; + bool calc_cond = true) const; private: // Diagonal matrix solvers
--- a/liboctave/array/fCMatrix.cc Mon May 16 22:21:19 2016 -0700 +++ b/liboctave/array/fCMatrix.cc Mon May 16 23:26:07 2016 -0400 @@ -939,8 +939,8 @@ } FloatComplexMatrix -FloatComplexMatrix::inverse (octave_idx_type& info, float& rcon, int force, - int calc_cond) const +FloatComplexMatrix::inverse (octave_idx_type& info, float& rcon, bool force, + bool calc_cond) const { MatrixType mattype (*this); return inverse (mattype, info, rcon, force, calc_cond); @@ -963,7 +963,7 @@ FloatComplexMatrix FloatComplexMatrix::tinverse (MatrixType &mattype, octave_idx_type& info, - float& rcon, int force, int calc_cond) const + float& rcon, bool force, bool calc_cond) const { FloatComplexMatrix retval; @@ -1018,7 +1018,7 @@ FloatComplexMatrix FloatComplexMatrix::finverse (MatrixType &mattype, octave_idx_type& info, - float& rcon, int force, int calc_cond) const + float& rcon, bool force, bool calc_cond) const { FloatComplexMatrix retval; @@ -1098,7 +1098,7 @@ FloatComplexMatrix FloatComplexMatrix::inverse (MatrixType &mattype, octave_idx_type& info, - float& rcon, int force, int calc_cond) const + float& rcon, bool force, bool calc_cond) const { int typ = mattype.type (false); FloatComplexMatrix ret; @@ -1520,7 +1520,7 @@ FloatComplexDET FloatComplexMatrix::determinant (octave_idx_type& info, float& rcon, - int calc_cond) const + bool calc_cond) const { MatrixType mattype (*this); return determinant (mattype, info, rcon, calc_cond); @@ -1529,7 +1529,7 @@ FloatComplexDET FloatComplexMatrix::determinant (MatrixType& mattype, octave_idx_type& info, float& rcon, - int calc_cond) const + bool calc_cond) const { FloatComplexDET retval (1.0); @@ -3778,13 +3778,13 @@ for (octave_idx_type j = 0; j < nc; j++) { - int columns_are_real_only = 1; + bool columns_are_real_only = true; for (octave_idx_type i = 0; i < nr; i++) { octave_quit (); if (std::imag (a(i, j)) != 0.0 || std::imag (b(i, j)) != 0.0) { - columns_are_real_only = 0; + columns_are_real_only = false; break; } } @@ -3863,13 +3863,13 @@ for (octave_idx_type j = 0; j < nc; j++) { - int columns_are_real_only = 1; + bool columns_are_real_only = true; for (octave_idx_type i = 0; i < nr; i++) { octave_quit (); if (std::imag (a(i, j)) != 0.0 || std::imag (b(i, j)) != 0.0) { - columns_are_real_only = 0; + columns_are_real_only = false; break; } }
--- a/liboctave/array/fCMatrix.h Mon May 16 22:21:19 2016 -0700 +++ b/liboctave/array/fCMatrix.h Mon May 16 23:26:07 2016 -0400 @@ -194,22 +194,22 @@ private: FloatComplexMatrix tinverse (MatrixType &mattype, octave_idx_type& info, - float& rcon, int force, int calc_cond) const; + float& rcon, bool force, bool calc_cond) const; FloatComplexMatrix finverse (MatrixType &mattype, octave_idx_type& info, - float& rcon, int force, int calc_cond) const; + float& rcon, bool force, bool calc_cond) const; public: FloatComplexMatrix inverse (void) const; FloatComplexMatrix inverse (octave_idx_type& info) const; FloatComplexMatrix inverse (octave_idx_type& info, float& rcon, - int force = 0, int calc_cond = 1) const; + bool force = false, bool calc_cond = true) const; FloatComplexMatrix inverse (MatrixType &mattype) const; FloatComplexMatrix inverse (MatrixType &mattype, octave_idx_type& info) const; FloatComplexMatrix inverse (MatrixType &mattype, octave_idx_type& info, - float& rcon, int force = 0, - int calc_cond = 1) const; + float& rcon, bool force = false, + bool calc_cond = true) const; FloatComplexMatrix pseudo_inverse (float tol = 0.0) const; @@ -222,9 +222,9 @@ FloatComplexDET determinant (void) const; FloatComplexDET determinant (octave_idx_type& info) const; FloatComplexDET determinant (octave_idx_type& info, float& rcon, - int calc_cond = 1) const; + bool calc_cond = true) const; FloatComplexDET determinant (MatrixType &mattype, octave_idx_type& info, - float& rcon, int calc_cond = 1) const; + float& rcon, bool calc_cond = true) const; float rcond (void) const; float rcond (MatrixType &mattype) const;
--- a/liboctave/array/fMatrix.cc Mon May 16 22:21:19 2016 -0700 +++ b/liboctave/array/fMatrix.cc Mon May 16 23:26:07 2016 -0400 @@ -632,8 +632,8 @@ } FloatMatrix -FloatMatrix::inverse (octave_idx_type& info, float& rcon, int force, - int calc_cond) const +FloatMatrix::inverse (octave_idx_type& info, float& rcon, bool force, + bool calc_cond) const { MatrixType mattype (*this); return inverse (mattype, info, rcon, force, calc_cond); @@ -656,7 +656,7 @@ FloatMatrix FloatMatrix::tinverse (MatrixType &mattype, octave_idx_type& info, float& rcon, - int force, int calc_cond) const + bool force, bool calc_cond) const { FloatMatrix retval; @@ -712,7 +712,7 @@ FloatMatrix FloatMatrix::finverse (MatrixType &mattype, octave_idx_type& info, float& rcon, - int force, int calc_cond) const + bool force, bool calc_cond) const { FloatMatrix retval; @@ -792,7 +792,7 @@ FloatMatrix FloatMatrix::inverse (MatrixType &mattype, octave_idx_type& info, float& rcon, - int force, int calc_cond) const + bool force, bool calc_cond) const { int typ = mattype.type (false); FloatMatrix ret; @@ -1212,7 +1212,7 @@ FloatDET FloatMatrix::determinant (octave_idx_type& info, float& rcon, - int calc_cond) const + bool calc_cond) const { MatrixType mattype (*this); return determinant (mattype, info, rcon, calc_cond); @@ -1221,7 +1221,7 @@ FloatDET FloatMatrix::determinant (MatrixType& mattype, octave_idx_type& info, float& rcon, - int calc_cond) const + bool calc_cond) const { FloatDET retval (1.0);
--- a/liboctave/array/fMatrix.h Mon May 16 22:21:19 2016 -0700 +++ b/liboctave/array/fMatrix.h Mon May 16 23:26:07 2016 -0400 @@ -153,21 +153,21 @@ private: FloatMatrix tinverse (MatrixType &mattype, octave_idx_type& info, - float& rcon, int force, int calc_cond) const; + float& rcon, bool force, bool calc_cond) const; FloatMatrix finverse (MatrixType &mattype, octave_idx_type& info, - float& rcon, int force, int calc_cond) const; + float& rcon, bool force, bool calc_cond) const; public: FloatMatrix inverse (void) const; FloatMatrix inverse (octave_idx_type& info) const; - FloatMatrix inverse (octave_idx_type& info, float& rcon, int force = 0, - int calc_cond = 1) const; + FloatMatrix inverse (octave_idx_type& info, float& rcon, bool force = false, + bool calc_cond = true) const; FloatMatrix inverse (MatrixType &mattype) const; FloatMatrix inverse (MatrixType &mattype, octave_idx_type& info) const; FloatMatrix inverse (MatrixType &mattype, octave_idx_type& info, float& rcon, - int force = 0, int calc_cond = 1) const; + bool force = false, bool calc_cond = true) const; FloatMatrix pseudo_inverse (float tol = 0.0) const; @@ -180,9 +180,9 @@ FloatDET determinant (void) const; FloatDET determinant (octave_idx_type& info) const; FloatDET determinant (octave_idx_type& info, float& rcon, - int calc_cond = 1) const; + bool calc_cond = true) const; FloatDET determinant (MatrixType &mattype, octave_idx_type& info, - float& rcon, int calc_cond = 1) const; + float& rcon, bool calc_cond = true) const; float rcond (void) const; float rcond (MatrixType &mattype) const;