Public Member Functions | Protected Member Functions | List of all members

Generic interface for sparse solvers to be coupled with ACADO Toolkit. More...

#include <sparse_solver.hpp>

Inheritance diagram for SparseSolver:
Inheritance graph
[legend]

Public Member Functions

virtual SparseSolverclone () const =0
 
virtual returnValue factorize ()=0
 
virtual int_t getNegativeEigenvalues ()
 
virtual int_t getRank ()
 
virtual returnValue getX (double *x)=0
 
virtual returnValue getZeroPivots (int_t *&zeroPivots)
 
virtual SparseSolveroperator= (const SparseSolver &rhs)
 
virtual returnValue reset ()
 
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 setMatrixData (int_t dim, int_t numNonzeros, const int_t *const airn, const int_t *const acjn, const real_t *const avals)=0
 
virtual returnValue setNumberOfEntries (const int &nDense_)=0
 
virtual returnValue setPrintLevel (PrintLevel PrintLevel_)=0
 
virtual returnValue setTolerance (double TOL)=0
 
virtual returnValue solve (int_t dim, const real_t *const rhs, real_t *const sol)=0
 
virtual returnValue solve (double *b)=0
 
virtual returnValue solveTranspose (double *b)
 
 SparseSolver ()
 
 SparseSolver (const SparseSolver &rhs)
 
 SparseSolver ()
 
virtual ~SparseSolver ()
 
virtual ~SparseSolver ()
 

Protected Member Functions

returnValue clear ()
 
returnValue copy (const SparseSolver &rhs)
 

Detailed Description

Generic interface for sparse solvers to be coupled with ACADO Toolkit.

Base class for linear solvers that are used in a Schur-complement implementation in qpOASES.

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.

Author
Boris Houska, Hans Joachim Ferreau
Andreas Waechter, Dennis Janka
Version
3.2
Date
2012-2015

Definition at line 66 of file sparse_solver.hpp.

Constructor & Destructor Documentation

BEGIN_NAMESPACE_QPOASES SparseSolver::SparseSolver ( )

Default constructor.

Definition at line 47 of file sparse_solver.cpp.

SparseSolver::~SparseSolver ( )
virtual

Destructor.

Definition at line 52 of file sparse_solver.cpp.

SparseSolver::SparseSolver ( )

Default constructor.

SparseSolver::SparseSolver ( const SparseSolver rhs)

Copy constructor (deep copy).

Parameters
rhsRhs object.

Definition at line 67 of file SparseSolver.cpp.

virtual SparseSolver::~SparseSolver ( )
virtual

Destructor.

Member Function Documentation

returnValue SparseSolver::clear ( )
protected

Frees all allocated memory.

Returns
SUCCESSFUL_RETURN

Definition at line 137 of file SparseSolver.cpp.

virtual SparseSolver* SparseSolver::clone ( ) const
pure virtual
returnValue SparseSolver::copy ( const SparseSolver rhs)
protected

Copies all members from given rhs object.

Returns
SUCCESSFUL_RETURN
Parameters
rhsRhs object.

Definition at line 146 of file SparseSolver.cpp.

virtual returnValue SparseSolver::factorize ( )
pure virtual

Compute factorization of current matrix. This method must be called before solve.

int_t SparseSolver::getNegativeEigenvalues ( )
virtual

Return the number of negative eigenvalues.

Definition at line 107 of file SparseSolver.cpp.

int_t SparseSolver::getRank ( )
virtual

Return the rank after a factorization

Definition at line 115 of file SparseSolver.cpp.

virtual returnValue SparseSolver::getX ( double *  x)
pure virtual

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

Returns
SUCCESSFUL_RETURN

Implemented in ACADOcsparse, and ConjugateGradientMethod.

returnValue SparseSolver::getZeroPivots ( int_t *&  zeroPivots)
virtual

Returns the zero pivots in case the matrix is rank deficient

Definition at line 123 of file SparseSolver.cpp.

SparseSolver & SparseSolver::operator= ( const SparseSolver rhs)
virtual

Assignment operator (deep copy).

Parameters
rhsRhs object.

Definition at line 85 of file SparseSolver.cpp.

returnValue SparseSolver::reset ( )
virtual

Clears all data structures.

Definition at line 99 of file SparseSolver.cpp.

virtual returnValue SparseSolver::setDimension ( const int &  n)
pure virtual

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

Returns
SUCCESSFUL_RETURN

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::setMatrixData ( int_t  dim,
int_t  numNonzeros,
const int_t *const  airn,
const int_t *const  acjn,
const real_t *const  avals 
)
pure virtual

Set new matrix data. The matrix is to be provided in the Harwell-Boeing format. Only the lower triangular part should be set.

Parameters
dimDimension of the linear system.
numNonzerosNumber of nonzeros in the matrix.
airnRow indices for each matrix entry.
acjnColumn indices for each matrix entry.
avalsValues for each matrix entry.
virtual returnValue SparseSolver::setNumberOfEntries ( const int &  nDense_)
pure virtual

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

Returns
SUCCESSFUL_RETURN

Implemented in ACADOcsparse, and ConjugateGradientMethod.

virtual returnValue SparseSolver::setPrintLevel ( PrintLevel  PrintLevel_)
pure virtual

Sets the print level.

Returns
SUCCESSFUL_RETURN

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.

Returns
SUCCESSFUL_RETURN

Implemented in ACADOcsparse, and ConjugateGradientMethod.

virtual returnValue SparseSolver::solve ( int_t  dim,
const real_t *const  rhs,
real_t *const  sol 
)
pure virtual

Solve linear system with most recently set matrix data.

Parameters
dimDimension of the linear system.
rhsValues for the right hand side.
solSolution of the linear system.
virtual returnValue SparseSolver::solve ( double *  b)
pure virtual

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

Returns
SUCCESSFUL_RETURN
RET_LINEAR_SYSTEM_NUMERICALLY_SINGULAR

Implemented in ACADOcsparse, and ConjugateGradientMethod.

returnValue SparseSolver::solveTranspose ( double *  b)
virtual

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

Returns
SUCCESSFUL_RETURN
RET_LINEAR_SYSTEM_NUMERICALLY_SINGULAR

Reimplemented in ACADOcsparse.

Definition at line 58 of file sparse_solver.cpp.


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


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Mon Jun 10 2019 12:35:26