From 973b0a90db5e3f506ff7c745cd6d1a6b12cbe00d Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Thu, 25 Jun 2015 13:51:13 +0200 Subject: Clarify documentation of the tolerance and error returned in iterative solvers --- Eigen/src/IterativeLinearSolvers/BiCGSTAB.h | 2 ++ Eigen/src/IterativeLinearSolvers/ConjugateGradient.h | 2 ++ Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h | 14 +++++++++++--- 3 files changed, 15 insertions(+), 3 deletions(-) (limited to 'Eigen/src/IterativeLinearSolvers') diff --git a/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h b/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h index be98993f0..f6d54c5e7 100644 --- a/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +++ b/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h @@ -136,6 +136,8 @@ struct traits > * and setTolerance() methods. The defaults are the size of the problem for the maximal number of iterations * and NumTraits::epsilon() for the tolerance. * + * The tolerance is the relative residual error: |Ax-b|/|b| + * * This class can be used as the direct solver classes. Here is a typical usage example: * \include BiCGSTAB_simple.cpp * diff --git a/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h b/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h index 9e7dd1404..de576edc9 100644 --- a/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h +++ b/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h @@ -121,6 +121,8 @@ struct traits > * and setTolerance() methods. The defaults are the size of the problem for the maximal number of iterations * and NumTraits::epsilon() for the tolerance. * + * The tolerance is the relative residual error: |Ax-b|/|b| + * * This class can be used as the direct solver classes. Here is a typical usage example: \code int n = 10000; diff --git a/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h b/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h index 6477b9de2..22c602a91 100644 --- a/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +++ b/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h @@ -126,10 +126,16 @@ public: /** \internal */ Index cols() const { return mp_matrix.cols(); } - /** \returns the tolerance threshold used by the stopping criteria */ + /** \returns the tolerance threshold used by the stopping criteria. + * \sa setTolerance() + */ RealScalar tolerance() const { return m_tolerance; } - /** Sets the tolerance threshold used by the stopping criteria */ + /** Sets the tolerance threshold used by the stopping criteria. + * + * This value is used as an upper bound to the relative residual error: |Ax-b|/|b|. + * The default value is the machine precision given by NumTraits::epsilon() + */ Derived& setTolerance(const RealScalar& tolerance) { m_tolerance = tolerance; @@ -167,7 +173,9 @@ public: return m_iterations; } - /** \returns the tolerance error reached during the last solve */ + /** \returns the tolerance error reached during the last solve. + * It is a close approximation of the true relative residual error |Ax-b|/|b|. + */ RealScalar error() const { eigen_assert(m_isInitialized && "ConjugateGradient is not initialized."); -- cgit v1.2.3