From ba5eecae53aa038374d1708573cf03a2df3f76f3 Mon Sep 17 00:00:00 2001 From: Jitse Niesen Date: Tue, 24 Jul 2012 15:17:59 +0100 Subject: Allow user to specify max number of iterations (bug #479). --- test/schur_real.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'test/schur_real.cpp') diff --git a/test/schur_real.cpp b/test/schur_real.cpp index e6351d94a..e81a28d7d 100644 --- a/test/schur_real.cpp +++ b/test/schur_real.cpp @@ -1,7 +1,7 @@ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // -// Copyright (C) 2010 Jitse Niesen +// Copyright (C) 2010,2012 Jitse Niesen // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed @@ -66,6 +66,24 @@ template void schur(int size = MatrixType::ColsAtCompileTim VERIFY_IS_EQUAL(rs1.matrixT(), rs2.matrixT()); VERIFY_IS_EQUAL(rs1.matrixU(), rs2.matrixU()); + // Test maximum number of iterations + RealSchur rs3; + rs3.compute(A, true, RealSchur::m_maxIterations * size); + VERIFY_IS_EQUAL(rs3.info(), Success); + VERIFY_IS_EQUAL(rs3.matrixT(), rs1.matrixT()); + VERIFY_IS_EQUAL(rs3.matrixU(), rs1.matrixU()); + if (size > 2) { + rs3.compute(A, true, 1); + VERIFY_IS_EQUAL(rs3.info(), NoConvergence); + } + + MatrixType Atriangular = A; + Atriangular.template triangularView().setZero(); + rs3.compute(Atriangular, true, 1); // triangular matrices do not need any iterations + VERIFY_IS_EQUAL(rs3.info(), Success); + VERIFY_IS_EQUAL(rs3.matrixT(), Atriangular); + VERIFY_IS_EQUAL(rs3.matrixU(), MatrixType::Identity(size, size)); + // Test computation of only T, not U RealSchur rsOnlyT(A, false); VERIFY_IS_EQUAL(rsOnlyT.info(), Success); -- cgit v1.2.3