diff options
author | Gael Guennebaud <g.gael@free.fr> | 2011-12-27 16:38:05 +0100 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2011-12-27 16:38:05 +0100 |
commit | bdee0c9baa6a6b48ea4dee803152d5568bcefb58 (patch) | |
tree | 16084158bf1b7342eb4a4bf06b4aba0f2ed8299a /Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h | |
parent | 15ea999f84f65e7664fc9b662f79d37e2fb5fd4d (diff) |
set the default number of iteration to the size of the problem
Diffstat (limited to 'Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h')
-rw-r--r-- | Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h b/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h index 9a4eca1a1..bcf1669e2 100644 --- a/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +++ b/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h @@ -91,9 +91,9 @@ public: } /** \internal */ - Index rows() const { return mp_matrix->rows(); } + Index rows() const { return mp_matrix ? mp_matrix->rows() : 0; } /** \internal */ - Index cols() const { return mp_matrix->cols(); } + Index cols() const { return mp_matrix ? mp_matrix->cols() : 0; } /** \returns the tolerance threshold used by the stopping criteria */ RealScalar tolerance() const { return m_tolerance; } @@ -112,7 +112,10 @@ public: const Preconditioner& preconditioner() const { return m_preconditioner; } /** \returns the max number of iterations */ - int maxIterations() const { return m_maxIterations; } + int maxIterations() const + { + return (mp_matrix && m_maxIterations<0) ? mp_matrix->cols() : m_maxIterations; + } /** Sets the max number of iterations */ Derived& setMaxIterations(int maxIters) @@ -191,7 +194,7 @@ protected: void init() { m_isInitialized = false; - m_maxIterations = 1000; + m_maxIterations = -1; m_tolerance = NumTraits<Scalar>::epsilon(); } const MatrixType* mp_matrix; |