Generic interface for sparse solvers to be coupled with ACADO Toolkit. More...
#include <sparse_solver.hpp>
Public Member Functions | |
virtual SparseSolver * | clone () const =0 |
virtual returnValue | getX (double *x)=0 |
virtual returnValue | setDimension (const int &n)=0 |
virtual returnValue | setIndices (const int *rowIdx_, const int *colIdx_)=0 |
virtual returnValue | setMatrix (double *A_)=0 |
virtual returnValue | setNumberOfEntries (const int &nDense_)=0 |
virtual returnValue | setPrintLevel (PrintLevel PrintLevel_)=0 |
virtual returnValue | setTolerance (double TOL)=0 |
virtual returnValue | solve (double *b)=0 |
virtual returnValue | solveTranspose (double *b) |
SparseSolver () | |
virtual | ~SparseSolver () |
Generic interface for sparse solvers to be coupled with ACADO Toolkit.
The class SparseSolver is a generic interface for sparse solver to be coupled with ACADO Toolkit.
A SparseSolver deals with linear equations of the form
A * x = b
where A is (a possibly large but sparse) given matrix and b a given vector. Here, the non-zero elements of A need to be specified by one of the routines that are provided in this class. The aim of the sparse solver is to find the vector x, which is assumed to be uniquely defined by the above equation. For solving the linear equation the zero entries of the matrix A are used efficiently.
Definition at line 66 of file sparse_solver.hpp.
Default constructor.
Definition at line 47 of file sparse_solver.cpp.
SparseSolver::~SparseSolver | ( | ) | [virtual] |
Destructor.
Definition at line 52 of file sparse_solver.cpp.
virtual SparseSolver* SparseSolver::clone | ( | ) | const [pure virtual] |
Clone operator (deep copy).
Implemented in ACADOcsparse, SymmetricConjugateGradientMethod, NormalConjugateGradientMethod, and ConjugateGradientMethod.
virtual returnValue SparseSolver::getX | ( | double * | x | ) | [pure virtual] |
Returns the solution of the equation A*x = b if solved.
Implemented in ACADOcsparse, and ConjugateGradientMethod.
virtual returnValue SparseSolver::setDimension | ( | const int & | n | ) | [pure virtual] |
Defines the dimension n of A R^{n n}
Implemented in ACADOcsparse, and ConjugateGradientMethod.
virtual returnValue SparseSolver::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.
Implemented in ACADOcsparse, ConjugateGradientMethod, SymmetricConjugateGradientMethod, and NormalConjugateGradientMethod.
virtual returnValue SparseSolver::setMatrix | ( | double * | A_ | ) | [pure 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.
Implemented in ACADOcsparse, and ConjugateGradientMethod.
virtual returnValue SparseSolver::setNumberOfEntries | ( | const int & | nDense_ | ) | [pure virtual] |
Defines the number of non-zero elements in the
matrix A
Implemented in ACADOcsparse, and ConjugateGradientMethod.
virtual returnValue SparseSolver::setPrintLevel | ( | PrintLevel | PrintLevel_ | ) | [pure virtual] |
Sets the print level.
Implemented in ACADOcsparse, and ConjugateGradientMethod.
virtual returnValue SparseSolver::setTolerance | ( | double | TOL | ) | [pure virtual] |
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.
Implemented in ACADOcsparse, and ConjugateGradientMethod.
virtual returnValue SparseSolver::solve | ( | double * | b | ) | [pure virtual] |
Solves the system A*x = b for the specified data.
Implemented in ACADOcsparse, and ConjugateGradientMethod.
returnValue SparseSolver::solveTranspose | ( | double * | b | ) | [virtual] |
Solves the system A^T*x = b for the specified data.
Reimplemented in ACADOcsparse.
Definition at line 58 of file sparse_solver.cpp.