clean a bit the previous commit which came from a patch queue,

and since it was my first try of the patch queue feature I did not
managed to apply it with a good commit message, so here you go:
* Add a ComplexSchur decomposition class built on top of HessenbergDecomposition
* Add a ComplexEigenSolver built on top of ComplexSchur
There are still a couple of FIXME but at least they work for any reasonable matrices,
still have to extend the unit tests to stress them with nasty matrices...
This commit is contained in:
Gael Guennebaud 2009-09-01 16:35:23 +02:00
parent 4d91229bdc
commit 5b8ffa4d46
2 changed files with 7 additions and 16 deletions

View File

@ -29,7 +29,7 @@
template<typename MatrixType> void eigensolver(const MatrixType& m)
{
/* this test covers the following files:
ComplexEigenSolver.h
ComplexEigenSolver.h, and indirectly ComplexSchur.h
*/
int rows = m.rows();
int cols = m.cols();
@ -40,20 +40,13 @@ template<typename MatrixType> void eigensolver(const MatrixType& m)
typedef Matrix<RealScalar, MatrixType::RowsAtCompileTime, 1> RealVectorType;
typedef typename std::complex<typename NumTraits<typename MatrixType::Scalar>::Real> Complex;
// RealScalar largerEps = 10*test_precision<RealScalar>();
MatrixType a = MatrixType::Random(rows,cols);
MatrixType a1 = MatrixType::Random(rows,cols);
MatrixType symmA = a.adjoint() * a + a1.adjoint() * a1;
MatrixType symmA = a.adjoint() * a;
// ComplexEigenSolver<MatrixType> ei0(symmA);
ComplexEigenSolver<MatrixType> ei0(symmA);
VERIFY_IS_APPROX(symmA * ei0.eigenvectors(), ei0.eigenvectors() * ei0.eigenvalues().asDiagonal());
// VERIFY_IS_APPROX(symmA * ei0.eigenvectors(), ei0.eigenvectors() * ei0.eigenvalues().asDiagonal());
// a.imag().setZero();
// std::cerr << a << "\n\n";
ComplexEigenSolver<MatrixType> ei1(a);
// exit(1);
VERIFY_IS_APPROX(a * ei1.eigenvectors(), ei1.eigenvectors() * ei1.eigenvalues().asDiagonal());
}
@ -61,10 +54,8 @@ template<typename MatrixType> void eigensolver(const MatrixType& m)
void test_eigensolver_complex()
{
for(int i = 0; i < g_repeat; i++) {
// CALL_SUBTEST( eigensolver(Matrix4cf()) );
// CALL_SUBTEST( eigensolver(MatrixXcd(4,4)) );
CALL_SUBTEST( eigensolver(MatrixXcd(6,6)) );
// CALL_SUBTEST( eigensolver(MatrixXd(14,14)) );
CALL_SUBTEST( eigensolver(Matrix4cf()) );
CALL_SUBTEST( eigensolver(MatrixXcd(14,14)) );
}
}

View File

@ -59,7 +59,7 @@ template<typename MatrixType> void product_extra(const MatrixType& m)
// r0 = ei_random<int>(0,rows/2-1),
// r1 = ei_random<int>(rows/2,rows);
VERIFY_IS_APPROX(m3.noalias() = m1 * m2.adjoint(), m1 * m2.adjoint().eval());
VERIFY_IS_APPROX(m3.noalias() = m1 * m2.adjoint(), m1 * m2.adjoint().eval());
VERIFY_IS_APPROX(m3.noalias() = m1.adjoint() * square.adjoint(), m1.adjoint().eval() * square.adjoint().eval());
VERIFY_IS_APPROX(m3.noalias() = m1.adjoint() * m2, m1.adjoint().eval() * m2);
VERIFY_IS_APPROX(m3.noalias() = (s1 * m1.adjoint()) * m2, (s1 * m1.adjoint()).eval() * m2);