From 01190b3544cd0a674be6475185d5dd8e4b7890c5 Mon Sep 17 00:00:00 2001 From: Chen-Pang He Date: Sun, 21 Jul 2013 18:09:11 +0800 Subject: [PATCH] Directly code failing example, or it breaks `make doc`. --- unsupported/Eigen/MatrixFunctions | 23 ++++++++++++++++++- .../doc/examples/MatrixPower_failure.cpp | 20 ---------------- 2 files changed, 22 insertions(+), 21 deletions(-) delete mode 100644 unsupported/doc/examples/MatrixPower_failure.cpp diff --git a/unsupported/Eigen/MatrixFunctions b/unsupported/Eigen/MatrixFunctions index ff466a519..0b12aaffb 100644 --- a/unsupported/Eigen/MatrixFunctions +++ b/unsupported/Eigen/MatrixFunctions @@ -264,7 +264,28 @@ where \f$ T_1 \f$ is invertible. Then \f$ T^p \f$ is given by \warning Fractional power of a matrix with a non-semisimple zero eigenvalue is not well-defined. We introduce an assertion failure -against inaccurate result, e.g. \include MatrixPower_failure.cpp +against inaccurate result, e.g. \code +#include +#include + +int main() +{ + Eigen::Matrix4d A; + A << 0, 0, 2, 3, + 0, 0, 4, 5, + 0, 0, 6, 7, + 0, 0, 8, 9; + std::cout << A.pow(0.37) << std::endl; + + // The 1 makes eigenvalue 0 non-semisimple. + A.coeffRef(0, 1) = 1; + + // This fails if EIGEN_NO_DEBUG is undefined. + std::cout << A.pow(0.37) << std::endl; + + return 0; +} +\endcode Details of the algorithm can be found in: Nicholas J. Higham and Lijing Lin, "A Schur-Padé algorithm for fractional powers of a diff --git a/unsupported/doc/examples/MatrixPower_failure.cpp b/unsupported/doc/examples/MatrixPower_failure.cpp deleted file mode 100644 index d20de78a0..000000000 --- a/unsupported/doc/examples/MatrixPower_failure.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include - -int main() -{ - Eigen::Matrix4d A; - A << 0, 0, 2, 3, - 0, 0, 4, 5, - 0, 0, 6, 7, - 0, 0, 8, 9; - std::cout << A.pow(0.37) << std::endl; - - // The 1 makes eigenvalue 0 non-semisimple. - A.coeffRef(0, 1) = 1; - - // This fails if EIGEN_NO_DEBUG is undefined. - std::cout << A.pow(0.37) << std::endl; - - return 0; -}