diff options
author | Jitse Niesen <jitse@maths.leeds.ac.uk> | 2010-06-02 17:31:02 +0100 |
---|---|---|
committer | Jitse Niesen <jitse@maths.leeds.ac.uk> | 2010-06-02 17:31:02 +0100 |
commit | 38d8352b7bc6c839297aee11a91e64aff4d51aff (patch) | |
tree | 0c795f85ae660036912853aeb428a7aeca2c3e7b /Eigen/src/Eigenvalues/RealSchur.h | |
parent | 9ff0d67156377e4d7a39669a415f120b61846901 (diff) |
Add field m_maxIterations; break loop when this limit is exceeded.
Diffstat (limited to 'Eigen/src/Eigenvalues/RealSchur.h')
-rw-r--r-- | Eigen/src/Eigenvalues/RealSchur.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/Eigen/src/Eigenvalues/RealSchur.h b/Eigen/src/Eigenvalues/RealSchur.h index 41f74e530..584b1d05e 100644 --- a/Eigen/src/Eigenvalues/RealSchur.h +++ b/Eigen/src/Eigenvalues/RealSchur.h @@ -176,6 +176,12 @@ template<typename _MatrixType> class RealSchur */ RealSchur& compute(const MatrixType& matrix, bool computeU = true); + /** \brief Maximum number of iterations. + * + * Maximum number of iterations allowed for an eigenvalue to converge. + */ + static const int m_maxIterations = 40; + private: MatrixType m_matT; @@ -244,14 +250,19 @@ RealSchur<MatrixType>& RealSchur<MatrixType>::compute(const MatrixType& matrix, Vector3s firstHouseholderVector, shiftInfo; computeShift(iu, iter, exshift, shiftInfo); iter = iter + 1; // (Could check iteration count here.) + if (iter >= m_maxIterations) break; Index im; initFrancisQRStep(il, iu, shiftInfo, im, firstHouseholderVector); performFrancisQRStep(il, im, iu, computeU, firstHouseholderVector, workspace); } } - m_isInitialized = true; - m_matUisUptodate = computeU; + if(iter < m_maxIterations) + { + m_isInitialized = true; + m_matUisUptodate = computeU; + } + return *this; } |