mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-01-30 17:40:05 +08:00
Warn about power of a matrix with non-semisimple 0 eigenvalue.
This commit is contained in:
parent
1191949e87
commit
51573da3a4
@ -262,6 +262,10 @@ where \f$ T_1 \f$ is invertible. Then \f$ T^p \f$ is given by
|
||||
0 & 0
|
||||
\end{array}. \right] \f]
|
||||
|
||||
\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
|
||||
|
||||
Details of the algorithm can be found in: Nicholas J. Higham and
|
||||
Lijing Lin, "A Schur-Padé algorithm for fractional powers of a
|
||||
matrix," <em>SIAM J. %Matrix Anal. Applic.</em>,
|
||||
|
20
unsupported/doc/examples/MatrixPower_failure.cpp
Normal file
20
unsupported/doc/examples/MatrixPower_failure.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
#include <unsupported/Eigen/MatrixFunctions>
|
||||
#include <iostream>
|
||||
|
||||
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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user