aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/eigensolver_complex.cpp
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2009-09-01 16:35:23 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2009-09-01 16:35:23 +0200
commit5b8ffa4d46958d691042f2537cba4dd52f795bdc (patch)
tree839e4821a8838361fa58e2f734b507580928bd62 /test/eigensolver_complex.cpp
parent4d91229bdce3ab91ef25d853126989e4cd235b9f (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...
Diffstat (limited to 'test/eigensolver_complex.cpp')
-rw-r--r--test/eigensolver_complex.cpp21
1 files changed, 6 insertions, 15 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)) );
}
}