diff --git a/doc/QuickReference.dox b/doc/QuickReference.dox index 3310d390a..31b8030f4 100644 --- a/doc/QuickReference.dox +++ b/doc/QuickReference.dox @@ -490,7 +490,7 @@ Read-write access to sub-vectors: \code vec1.head(n)\endcode\code vec1.head()\endcodethe first \c n coeffs \code vec1.tail(n)\endcode\code vec1.tail()\endcodethe last \c n coeffs \code vec1.segment(pos,n)\endcode\code vec1.segment(pos)\endcode - the \c n coeffs in \n the range [\c pos : \c pos + \c n [ + the \c n coeffs in the \n range [\c pos : \c pos + \c n - 1] Read-write access to sub-matrices: diff --git a/doc/examples/QuickStart_example2_dynamic.cpp b/doc/examples/QuickStart_example2_dynamic.cpp index 672ac82e9..ff6746e21 100644 --- a/doc/examples/QuickStart_example2_dynamic.cpp +++ b/doc/examples/QuickStart_example2_dynamic.cpp @@ -6,10 +6,10 @@ using namespace std; int main() { - MatrixXf m = MatrixXf::Random(3,3); - m = (m + MatrixXf::Constant(3,3,1.2)) * 50; + MatrixXd m = MatrixXd::Random(3,3); + m = (m + MatrixXd::Constant(3,3,1.2)) * 50; cout << "m =" << endl << m << endl; - VectorXf v(3); + VectorXd v(3); v << 1, 2, 3; cout << "m * v =" << endl << m * v << endl; } diff --git a/doc/examples/QuickStart_example2_fixed.cpp b/doc/examples/QuickStart_example2_fixed.cpp index edf3268cd..d91175273 100644 --- a/doc/examples/QuickStart_example2_fixed.cpp +++ b/doc/examples/QuickStart_example2_fixed.cpp @@ -6,10 +6,10 @@ using namespace std; int main() { - Matrix3f m = Matrix3f::Random(); - m = (m + Matrix3f::Constant(1.2)) * 50; + Matrix3d m = Matrix3d::Random(); + m = (m + Matrix3d::Constant(1.2)) * 50; cout << "m =" << endl << m << endl; - Vector3f v(1,2,3); + Vector3d v(1,2,3); cout << "m * v =" << endl << m * v << endl; } diff --git a/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h b/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h index 5eebb102a..f237b9cdc 100644 --- a/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h +++ b/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h @@ -173,10 +173,11 @@ int MatrixLogarithmAtomic::getPadeDegree(float normTminusI) { const float maxNormForPade[] = { 2.5111573934555054e-1 /* degree = 3 */ , 4.0535837411880493e-1, 5.3149729967117310e-1 }; - for (int degree = 3; degree <= maxPadeDegree; ++degree) + int degree = 3; + for (; degree <= maxPadeDegree; ++degree) if (normTminusI <= maxNormForPade[degree - minPadeDegree]) - return degree; - assert(false); // this line should never be reached + break; + return degree; } /* \brief Get suitable degree for Pade approximation. (specialized for RealScalar = double) */ @@ -185,10 +186,11 @@ int MatrixLogarithmAtomic::getPadeDegree(double normTminusI) { const double maxNormForPade[] = { 1.6206284795015624e-2 /* degree = 3 */ , 5.3873532631381171e-2, 1.1352802267628681e-1, 1.8662860613541288e-1, 2.642960831111435e-1 }; - for (int degree = 3; degree <= maxPadeDegree; ++degree) + int degree = 3; + for (; degree <= maxPadeDegree; ++degree) if (normTminusI <= maxNormForPade[degree - minPadeDegree]) - return degree; - assert(false); // this line should never be reached + break; + return degree; } /* \brief Get suitable degree for Pade approximation. (specialized for RealScalar = long double) */ @@ -215,10 +217,11 @@ int MatrixLogarithmAtomic::getPadeDegree(long double normTminusI) 3.6688019729653446926585242192447447e-2L, 5.9290962294020186998954055264528393e-2L, 8.6998436081634343903250580992127677e-2L, 1.1880960220216759245467951592883642e-1L }; #endif - for (int degree = 3; degree <= maxPadeDegree; ++degree) + int degree = 3 + for (; degree <= maxPadeDegree; ++degree) if (normTminusI <= maxNormForPade[degree - minPadeDegree]) - return degree; - assert(false); // this line should never be reached + break; + return degree; } /* \brief Compute Pade approximation to matrix logarithm */ @@ -424,7 +427,7 @@ void MatrixLogarithmAtomic::computePade11(MatrixType& result, const * This class holds the argument to the matrix function until it is * assigned or evaluated for some other reason (so the argument * should not be changed in the meantime). It is the return type of - * matrixBase::log() and most of the time this is the only way it + * MatrixBase::log() and most of the time this is the only way it * is used. */ template class MatrixLogarithmReturnValue diff --git a/unsupported/Eigen/src/MatrixFunctions/MatrixPower.h b/unsupported/Eigen/src/MatrixFunctions/MatrixPower.h index 23561a1e3..918db63b4 100644 --- a/unsupported/Eigen/src/MatrixFunctions/MatrixPower.h +++ b/unsupported/Eigen/src/MatrixFunctions/MatrixPower.h @@ -462,11 +462,11 @@ template ::getPadeDegree(float normIminusT) { const float maxNormForPade[] = { 2.7996156e-1f /* degree = 3 */ , 4.3268868e-1f }; - - for (int degree = 3; degree <= 4; degree++) + int degree = 3; + for (; degree <= 4; degree++) if (normIminusT <= maxNormForPade[degree - 3]) - return degree; - assert(false); // this line should never be reached + break; + return degree; } template @@ -474,11 +474,11 @@ inline int MatrixPower::getPadeDegr { const double maxNormForPade[] = { 1.882832775783710e-2 /* degree = 3 */ , 6.036100693089536e-2, 1.239372725584857e-1, 1.998030690604104e-1, 2.787629930861592e-1 }; - - for (int degree = 3; degree <= 7; degree++) + int degree = 3; + for (; degree <= 7; degree++) if (normIminusT <= maxNormForPade[degree - 3]) - return degree; - assert(false); // this line should never be reached + break; + return degree; } template @@ -508,11 +508,11 @@ inline int MatrixPower::getPadeDegr 3.907876732697568523164749432441966e-2L, 6.266303975524852476985111609267074e-2L, 9.133823549851655878933476070874651e-2L }; #endif - - for (int degree = 3; degree <= maxPadeDegree; degree++) + int degree = 3; + for (; degree <= maxPadeDegree; degree++) if (normIminusT <= maxNormForPade[degree - 3]) - return degree; - assert(false); // this line should never be reached + break; + return degree; } template void MatrixPower::computePade(const int& degree, const ComplexMatrix& IminusT)