From 5eefca637e1c964426e8515b2493fbed816a789a Mon Sep 17 00:00:00 2001 From: Jitse Niesen Date: Fri, 17 Aug 2012 14:49:18 +0100 Subject: [PATCH 1/3] Documentation fixes. Thanks to Rodney Sparapani for reporting these. --- doc/AsciiQuickReference.txt | 4 ++-- doc/examples/QuickStart_example2_dynamic.cpp | 6 +++--- doc/examples/QuickStart_example2_fixed.cpp | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/AsciiQuickReference.txt b/doc/AsciiQuickReference.txt index d2e973f5d..c53ca10ea 100644 --- a/doc/AsciiQuickReference.txt +++ b/doc/AsciiQuickReference.txt @@ -43,8 +43,8 @@ x.head(n) // x(1:n) x.head() // x(1:n) x.tail(n) // N = rows(x); x(N - n: N) x.tail() // N = rows(x); x(N - n: N) -x.segment(i, n) // x(i+1 : i+n) -x.segment(i) // x(i+1 : i+n) +x.segment(i, n) // x(i+1 : i+n+1) +x.segment(i) // x(i+1 : i+n+1) P.block(i, j, rows, cols) // P(i+1 : i+rows, j+1 : j+cols) P.block(i, j) // P(i+1 : i+rows, j+1 : j+cols) P.topLeftCorner(rows, cols) // P(1:rows, 1:cols) 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; } From dee866a99a372dbbdcc8777e9a35da37ae3776a8 Mon Sep 17 00:00:00 2001 From: Jitse Niesen Date: Fri, 17 Aug 2012 15:36:37 +0100 Subject: [PATCH 2/3] Undo incorrect fix in previous commit, and fix real mistake instead. --- doc/AsciiQuickReference.txt | 4 ++-- doc/QuickReference.dox | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/AsciiQuickReference.txt b/doc/AsciiQuickReference.txt index c53ca10ea..d2e973f5d 100644 --- a/doc/AsciiQuickReference.txt +++ b/doc/AsciiQuickReference.txt @@ -43,8 +43,8 @@ x.head(n) // x(1:n) x.head() // x(1:n) x.tail(n) // N = rows(x); x(N - n: N) x.tail() // N = rows(x); x(N - n: N) -x.segment(i, n) // x(i+1 : i+n+1) -x.segment(i) // x(i+1 : i+n+1) +x.segment(i, n) // x(i+1 : i+n) +x.segment(i) // x(i+1 : i+n) P.block(i, j, rows, cols) // P(i+1 : i+rows, j+1 : j+cols) P.block(i, j) // P(i+1 : i+rows, j+1 : j+cols) P.topLeftCorner(rows, cols) // P(1:rows, 1:cols) 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: From 42c1b9a8ddc1f2003ebf754ddd35a5bd2f151491 Mon Sep 17 00:00:00 2001 From: Hauke Heibel Date: Sat, 18 Aug 2012 10:18:31 +0200 Subject: [PATCH 3/3] Ensured that all branches of MatrixLogarithmAtomic::getPadeDegree return values. --- .../src/MatrixFunctions/MatrixLogarithm.h | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h b/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h index 3a50514b9..3154e6efc 100644 --- a/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h +++ b/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h @@ -172,10 +172,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) */ @@ -184,10 +185,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) */ @@ -214,10 +216,11 @@ int MatrixLogarithmAtomic::getPadeDegree(long double normTminusI) 3.6688019729653446926585242192447447e-2, 5.9290962294020186998954055264528393e-2, 8.6998436081634343903250580992127677e-2, 1.1880960220216759245467951592883642e-1 }; #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 */