Rename LSCG to LeastSquaresConjugateGradient

This commit is contained in:
Gael Guennebaud 2015-03-05 10:16:32 +01:00
parent 7550107028
commit 4c8b95d5c5
5 changed files with 14 additions and 14 deletions

View File

@ -12,7 +12,7 @@
* This module currently provides iterative methods to solve problems of the form \c A \c x = \c b, where \c A is a squared matrix, usually very large and sparse. * This module currently provides iterative methods to solve problems of the form \c A \c x = \c b, where \c A is a squared matrix, usually very large and sparse.
* Those solvers are accessible via the following classes: * Those solvers are accessible via the following classes:
* - ConjugateGradient for selfadjoint (hermitian) matrices, * - ConjugateGradient for selfadjoint (hermitian) matrices,
* - LSCG for rectangular least-square problems, * - LeastSquaresConjugateGradient for rectangular least-square problems,
* - BiCGSTAB for general square matrices. * - BiCGSTAB for general square matrices.
* *
* These iterative solvers are associated with some preconditioners: * These iterative solvers are associated with some preconditioners:

View File

@ -102,7 +102,7 @@ class DiagonalPreconditioner
}; };
/** \ingroup IterativeLinearSolvers_Module /** \ingroup IterativeLinearSolvers_Module
* \brief Jacobi preconditioner for LSCG * \brief Jacobi preconditioner for LeastSquaresConjugateGradient
* *
* This class allows to approximately solve for A' A x = A' b problems assuming A' A is a diagonal matrix. * This class allows to approximately solve for A' A x = A' b problems assuming A' A is a diagonal matrix.
* In other words, this preconditioner neglects all off diagonal entries and, in Eigen's language, solves for: * In other words, this preconditioner neglects all off diagonal entries and, in Eigen's language, solves for:
@ -114,7 +114,7 @@ class DiagonalPreconditioner
* *
* The diagonal entries are pre-inverted and stored into a dense vector. * The diagonal entries are pre-inverted and stored into a dense vector.
* *
* \sa class LSCG, class DiagonalPreconditioner * \sa class LeastSquaresConjugateGradient, class DiagonalPreconditioner
*/ */
template <typename _Scalar> template <typename _Scalar>
class LeastSquareDiagonalPreconditioner : public DiagonalPreconditioner<_Scalar> class LeastSquareDiagonalPreconditioner : public DiagonalPreconditioner<_Scalar>

View File

@ -139,7 +139,7 @@ struct traits<ConjugateGradient<_MatrixType,_UpLo,_Preconditioner> >
* By default the iterations start with x=0 as an initial guess of the solution. * By default the iterations start with x=0 as an initial guess of the solution.
* One can control the start using the solveWithGuess() method. * One can control the start using the solveWithGuess() method.
* *
* \sa class LSCG, class SimplicialCholesky, DiagonalPreconditioner, IdentityPreconditioner * \sa class LeastSquaresConjugateGradient, class SimplicialCholesky, DiagonalPreconditioner, IdentityPreconditioner
*/ */
template< typename _MatrixType, int _UpLo, typename _Preconditioner> template< typename _MatrixType, int _UpLo, typename _Preconditioner>
class ConjugateGradient : public IterativeSolverBase<ConjugateGradient<_MatrixType,_UpLo,_Preconditioner> > class ConjugateGradient : public IterativeSolverBase<ConjugateGradient<_MatrixType,_UpLo,_Preconditioner> >

View File

@ -95,12 +95,12 @@ void least_square_conjugate_gradient(const MatrixType& mat, const Rhs& rhs, Dest
template< typename _MatrixType, template< typename _MatrixType,
typename _Preconditioner = LeastSquareDiagonalPreconditioner<typename _MatrixType::Scalar> > typename _Preconditioner = LeastSquareDiagonalPreconditioner<typename _MatrixType::Scalar> >
class LSCG; class LeastSquaresConjugateGradient;
namespace internal { namespace internal {
template< typename _MatrixType, typename _Preconditioner> template< typename _MatrixType, typename _Preconditioner>
struct traits<LSCG<_MatrixType,_Preconditioner> > struct traits<LeastSquaresConjugateGradient<_MatrixType,_Preconditioner> >
{ {
typedef _MatrixType MatrixType; typedef _MatrixType MatrixType;
typedef _Preconditioner Preconditioner; typedef _Preconditioner Preconditioner;
@ -129,7 +129,7 @@ struct traits<LSCG<_MatrixType,_Preconditioner> >
VectorXd x(n), b(m); VectorXd x(n), b(m);
SparseMatrix<double> A(m,n); SparseMatrix<double> A(m,n);
// fill A and b // fill A and b
LSCG<SparseMatrix<double> > lscg; LeastSquaresConjugateGradient<SparseMatrix<double> > lscg;
lscg.compute(A); lscg.compute(A);
x = lscg.solve(b); x = lscg.solve(b);
std::cout << "#iterations: " << lscg.iterations() << std::endl; std::cout << "#iterations: " << lscg.iterations() << std::endl;
@ -144,9 +144,9 @@ struct traits<LSCG<_MatrixType,_Preconditioner> >
* \sa class ConjugateGradient, SparseLU, SparseQR * \sa class ConjugateGradient, SparseLU, SparseQR
*/ */
template< typename _MatrixType, typename _Preconditioner> template< typename _MatrixType, typename _Preconditioner>
class LSCG : public IterativeSolverBase<LSCG<_MatrixType,_Preconditioner> > class LeastSquaresConjugateGradient : public IterativeSolverBase<LeastSquaresConjugateGradient<_MatrixType,_Preconditioner> >
{ {
typedef IterativeSolverBase<LSCG> Base; typedef IterativeSolverBase<LeastSquaresConjugateGradient> Base;
using Base::mp_matrix; using Base::mp_matrix;
using Base::m_error; using Base::m_error;
using Base::m_iterations; using Base::m_iterations;
@ -161,7 +161,7 @@ public:
public: public:
/** Default constructor. */ /** Default constructor. */
LSCG() : Base() {} LeastSquaresConjugateGradient() : Base() {}
/** Initialize the solver with matrix \a A for further \c Ax=b solving. /** Initialize the solver with matrix \a A for further \c Ax=b solving.
* *
@ -173,9 +173,9 @@ public:
* this class becomes invalid. Call compute() to update it with the new * this class becomes invalid. Call compute() to update it with the new
* matrix A, or modify a copy of A. * matrix A, or modify a copy of A.
*/ */
explicit LSCG(const MatrixType& A) : Base(A) {} explicit LeastSquaresConjugateGradient(const MatrixType& A) : Base(A) {}
~LSCG() {} ~LeastSquaresConjugateGradient() {}
/** \internal */ /** \internal */
template<typename Rhs,typename Dest> template<typename Rhs,typename Dest>

View File

@ -12,8 +12,8 @@
template<typename T> void test_lscg_T() template<typename T> void test_lscg_T()
{ {
LSCG<SparseMatrix<T> > lscg_colmajor_diag; LeastSquaresConjugateGradient<SparseMatrix<T> > lscg_colmajor_diag;
LSCG<SparseMatrix<T>, IdentityPreconditioner> lscg_colmajor_I; LeastSquaresConjugateGradient<SparseMatrix<T>, IdentityPreconditioner> lscg_colmajor_I;
CALL_SUBTEST( check_sparse_square_solving(lscg_colmajor_diag) ); CALL_SUBTEST( check_sparse_square_solving(lscg_colmajor_diag) );
CALL_SUBTEST( check_sparse_square_solving(lscg_colmajor_I) ); CALL_SUBTEST( check_sparse_square_solving(lscg_colmajor_I) );