mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-11-27 06:30:28 +08:00
Judge unitary-ness relative to scaling.
This commit is contained in:
parent
9000b37677
commit
c1d637433e
@ -25,6 +25,7 @@ void selfadjointeigensolver_essential_check(const MatrixType& m) {
|
|||||||
VERIFY_IS_EQUAL(eiSymm.info(), Success);
|
VERIFY_IS_EQUAL(eiSymm.info(), Success);
|
||||||
|
|
||||||
RealScalar scaling = m.cwiseAbs().maxCoeff();
|
RealScalar scaling = m.cwiseAbs().maxCoeff();
|
||||||
|
RealScalar unitary_error_factor = RealScalar(16);
|
||||||
|
|
||||||
if (scaling < (std::numeric_limits<RealScalar>::min)()) {
|
if (scaling < (std::numeric_limits<RealScalar>::min)()) {
|
||||||
VERIFY(eiSymm.eigenvalues().cwiseAbs().maxCoeff() <= (std::numeric_limits<RealScalar>::min)());
|
VERIFY(eiSymm.eigenvalues().cwiseAbs().maxCoeff() <= (std::numeric_limits<RealScalar>::min)());
|
||||||
@ -33,7 +34,7 @@ void selfadjointeigensolver_essential_check(const MatrixType& m) {
|
|||||||
(eiSymm.eigenvectors() * eiSymm.eigenvalues().asDiagonal()) / scaling);
|
(eiSymm.eigenvectors() * eiSymm.eigenvalues().asDiagonal()) / scaling);
|
||||||
}
|
}
|
||||||
VERIFY_IS_APPROX(m.template selfadjointView<Lower>().eigenvalues(), eiSymm.eigenvalues());
|
VERIFY_IS_APPROX(m.template selfadjointView<Lower>().eigenvalues(), eiSymm.eigenvalues());
|
||||||
VERIFY_IS_UNITARY(eiSymm.eigenvectors());
|
VERIFY(eiSymm.eigenvectors().isUnitary(test_precision<RealScalar>() * unitary_error_factor));
|
||||||
|
|
||||||
if (m.cols() <= 4) {
|
if (m.cols() <= 4) {
|
||||||
SelfAdjointEigenSolver<MatrixType> eiDirect;
|
SelfAdjointEigenSolver<MatrixType> eiDirect;
|
||||||
@ -56,7 +57,7 @@ void selfadjointeigensolver_essential_check(const MatrixType& m) {
|
|||||||
VERIFY_IS_APPROX(m.template selfadjointView<Lower>().eigenvalues() / scaling, eiDirect.eigenvalues() / scaling);
|
VERIFY_IS_APPROX(m.template selfadjointView<Lower>().eigenvalues() / scaling, eiDirect.eigenvalues() / scaling);
|
||||||
}
|
}
|
||||||
|
|
||||||
VERIFY_IS_UNITARY(eiDirect.eigenvectors());
|
VERIFY(eiDirect.eigenvectors().isUnitary(test_precision<RealScalar>() * unitary_error_factor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user