diff options
author | Gael Guennebaud <g.gael@free.fr> | 2009-09-01 16:35:23 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2009-09-01 16:35:23 +0200 |
commit | 5b8ffa4d46958d691042f2537cba4dd52f795bdc (patch) | |
tree | 839e4821a8838361fa58e2f734b507580928bd62 | |
parent | 4d91229bdce3ab91ef25d853126989e4cd235b9f (diff) |
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...
-rw-r--r-- | test/eigensolver_complex.cpp | 21 | ||||
-rw-r--r-- | test/product_extra.cpp | 2 |
2 files changed, 7 insertions, 16 deletions
diff --git a/test/eigensolver_complex.cpp b/test/eigensolver_complex.cpp index 32de327dd..dad5a69f8 100644 --- a/test/eigensolver_complex.cpp +++ b/test/eigensolver_complex.cpp @@ -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; - -// ComplexEigenSolver<MatrixType> ei0(symmA); + MatrixType symmA = a.adjoint() * a; -// VERIFY_IS_APPROX(symmA * ei0.eigenvectors(), ei0.eigenvectors() * ei0.eigenvalues().asDiagonal()); + ComplexEigenSolver<MatrixType> ei0(symmA); + 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)) ); } } diff --git a/test/product_extra.cpp b/test/product_extra.cpp index 526dd210e..fcec362a5 100644 --- a/test/product_extra.cpp +++ b/test/product_extra.cpp @@ -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); |