From 9178e2bd54f64febb43025b9710387d2e98fea34 Mon Sep 17 00:00:00 2001 From: Jitse Niesen Date: Thu, 3 Jun 2010 22:59:57 +0100 Subject: Add info() method which can be queried to check whether iteration converged. --- test/schur_complex.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/schur_complex.cpp') diff --git a/test/schur_complex.cpp b/test/schur_complex.cpp index cc8174d00..67c41d41f 100644 --- a/test/schur_complex.cpp +++ b/test/schur_complex.cpp @@ -23,6 +23,7 @@ // Eigen. If not, see . #include "main.h" +#include #include template void schur(int size = MatrixType::ColsAtCompileTime) @@ -34,6 +35,7 @@ template void schur(int size = MatrixType::ColsAtCompileTim for(int counter = 0; counter < g_repeat; ++counter) { MatrixType A = MatrixType::Random(size, size); ComplexSchur schurOfA(A); + VERIFY_IS_EQUAL(schurOfA.info(), Success); ComplexMatrixType U = schurOfA.matrixU(); ComplexMatrixType T = schurOfA.matrixT(); for(int row = 1; row < size; ++row) { @@ -48,19 +50,28 @@ template void schur(int size = MatrixType::ColsAtCompileTim ComplexSchur csUninitialized; VERIFY_RAISES_ASSERT(csUninitialized.matrixT()); VERIFY_RAISES_ASSERT(csUninitialized.matrixU()); + VERIFY_RAISES_ASSERT(csUninitialized.info()); // Test whether compute() and constructor returns same result MatrixType A = MatrixType::Random(size, size); ComplexSchur cs1; cs1.compute(A); ComplexSchur cs2(A); + VERIFY_IS_EQUAL(cs1.info(), Success); + VERIFY_IS_EQUAL(cs2.info(), Success); VERIFY_IS_EQUAL(cs1.matrixT(), cs2.matrixT()); VERIFY_IS_EQUAL(cs1.matrixU(), cs2.matrixU()); // Test computation of only T, not U ComplexSchur csOnlyT(A, false); + VERIFY_IS_EQUAL(csOnlyT.info(), Success); VERIFY_IS_EQUAL(cs1.matrixT(), csOnlyT.matrixT()); VERIFY_RAISES_ASSERT(csOnlyT.matrixU()); + + // Test matrix with NaN + A(0,0) = std::numeric_limits::quiet_NaN(); + ComplexSchur csNaN(A); + VERIFY_IS_EQUAL(csNaN.info(), NoConvergence); } void test_schur_complex() -- cgit v1.2.3