Public Member Functions | Protected Member Functions | Protected Attributes

Implements a conjugate gradient method as sparse linear algebra solver. More...

#include <conjugate_gradient_method.hpp>

Inheritance diagram for ConjugateGradientMethod:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual SparseSolverclone () const =0
 ConjugateGradientMethod ()
 ConjugateGradientMethod (const ConjugateGradientMethod &arg)
virtual returnValue getX (double *x_)
virtual returnValue setDimension (const int &n)
virtual returnValue setIndices (const int *rowIdx_, const int *colIdx_)=0
virtual returnValue setMatrix (double *A_)
virtual returnValue setNumberOfEntries (const int &nDense_)
virtual returnValue setPrintLevel (PrintLevel printLevel_)
virtual returnValue setTolerance (double TOL_)
virtual returnValue solve (double *b)
virtual ~ConjugateGradientMethod ()

Protected Member Functions

virtual returnValue applyInversePreconditioner (double *x_)=0
virtual returnValue applyPreconditioner (double *b)=0
virtual returnValue computePreconditioner (double *A_)=0
virtual void multiply (double *xx, double *result)=0
double scalarProduct (double *aa, double *bb)

Protected Attributes

double * A
double * condScale
int dim
int nDense
double * norm2
double ** p
int pCounter
PrintLevel printLevel
double * r
double TOL
double * x

Detailed Description

Implements a conjugate gradient method as sparse linear algebra solver.

The class ConjugateGradientMethod implements a special sparse
linear algebra solver. After the application of an preconditioner
an iterative conjugate basis of the sparse data matrix A is
computed. The algotithm stops if the required tolerance is achieved.

Author:
Boris Houska, Hans Joachim Ferreau

Definition at line 57 of file conjugate_gradient_method.hpp.


Constructor & Destructor Documentation

Default constructor.

Definition at line 48 of file conjugate_gradient_method.cpp.

Copy constructor (deep copy).

Definition at line 64 of file conjugate_gradient_method.cpp.

Destructor.

Definition at line 126 of file conjugate_gradient_method.cpp.


Member Function Documentation

virtual returnValue ConjugateGradientMethod::applyInversePreconditioner ( double *  x_) [protected, pure virtual]

Applies the inverse of the preconditioner to the vector x (only internal use)

Implemented in SymmetricConjugateGradientMethod, and NormalConjugateGradientMethod.

virtual returnValue ConjugateGradientMethod::applyPreconditioner ( double *  b) [protected, pure virtual]

Applies the preconditioner to the vector b (only internal use)

Implemented in SymmetricConjugateGradientMethod, and NormalConjugateGradientMethod.

virtual SparseSolver* ConjugateGradientMethod::clone ( ) const [pure virtual]

Clone operator (deep copy).

Implements SparseSolver.

Implemented in SymmetricConjugateGradientMethod, and NormalConjugateGradientMethod.

virtual returnValue ConjugateGradientMethod::computePreconditioner ( double *  A_) [protected, pure virtual]

Computes the preconditioner and Applies it to the input matrix.

Implemented in SymmetricConjugateGradientMethod, and NormalConjugateGradientMethod.

returnValue ConjugateGradientMethod::getX ( double *  x_) [virtual]

Returns the solution of the equation A*x = b if solved.

Returns:
SUCCESSFUL_RETURN

Implements SparseSolver.

Definition at line 329 of file conjugate_gradient_method.cpp.

virtual void ConjugateGradientMethod::multiply ( double *  xx,
double *  result 
) [protected, pure virtual]

Evaluates the matrix-vector product result = A*xx efficiently. (only internal use)

Implemented in SymmetricConjugateGradientMethod, and NormalConjugateGradientMethod.

double ConjugateGradientMethod::scalarProduct ( double *  aa,
double *  bb 
) [protected]

Returns the scalar product of aa and bb. (only internal use)

Definition at line 355 of file conjugate_gradient_method.cpp.

returnValue ConjugateGradientMethod::setDimension ( const int &  n) [virtual]

Defines the dimension n of A R^{n n}

Returns:
SUCCESSFUL_RETURN

Implements SparseSolver.

Definition at line 252 of file conjugate_gradient_method.cpp.

virtual returnValue ConjugateGradientMethod::setIndices ( const int *  rowIdx_,
const int *  colIdx_ 
) [pure virtual]

Sets an index list containing the positions of the
non-zero elements in the matrix A.

Implements SparseSolver.

Implemented in SymmetricConjugateGradientMethod, and NormalConjugateGradientMethod.

returnValue ConjugateGradientMethod::setMatrix ( double *  A_) [virtual]

Sets the non-zero elements of the matrix A. The double* A
is assumed to contain nDense entries corresponding to
non-zero elements of A.

Implements SparseSolver.

Definition at line 315 of file conjugate_gradient_method.cpp.

returnValue ConjugateGradientMethod::setNumberOfEntries ( const int &  nDense_) [virtual]

Defines the number of non-zero elements in the
matrix A

Returns:
SUCCESSFUL_RETURN

Implements SparseSolver.

Definition at line 300 of file conjugate_gradient_method.cpp.

Sets the print level.

Returns:
SUCCESSFUL_RETURN

Implements SparseSolver.

Definition at line 342 of file conjugate_gradient_method.cpp.

Sets the required tolerance (accuracy) for the solution of
the linear equation. For large tolerances an iterative
algorithm might converge earlier.

Requires || A*x - b || <= TOL

The norm || . || is possibly scaled by a preconditioner.

Returns:
SUCCESSFUL_RETURN

Implements SparseSolver.

Definition at line 335 of file conjugate_gradient_method.cpp.

returnValue ConjugateGradientMethod::solve ( double *  b) [virtual]

Solves the system A*x = b for the specified data.

Returns:
SUCCESSFUL_RETURN
RET_LINEAR_SYSTEM_NUMERICALLY_SINGULAR

Implements SparseSolver.

Definition at line 149 of file conjugate_gradient_method.cpp.


Member Data Documentation

double* ConjugateGradientMethod::A [protected]

Definition at line 183 of file conjugate_gradient_method.hpp.

Definition at line 193 of file conjugate_gradient_method.hpp.

Definition at line 178 of file conjugate_gradient_method.hpp.

Definition at line 179 of file conjugate_gradient_method.hpp.

double* ConjugateGradientMethod::norm2 [protected]

Definition at line 189 of file conjugate_gradient_method.hpp.

double** ConjugateGradientMethod::p [protected]

Definition at line 190 of file conjugate_gradient_method.hpp.

Definition at line 192 of file conjugate_gradient_method.hpp.

Definition at line 197 of file conjugate_gradient_method.hpp.

double* ConjugateGradientMethod::r [protected]

Definition at line 191 of file conjugate_gradient_method.hpp.

double ConjugateGradientMethod::TOL [protected]

Definition at line 196 of file conjugate_gradient_method.hpp.

double* ConjugateGradientMethod::x [protected]

Definition at line 184 of file conjugate_gradient_method.hpp.


The documentation for this class was generated from the following files:


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Sat Jun 8 2019 19:40:23