|
qpOASES
3.1.1
|
Abstract base class for interfacing tailored matrix-vector operations. More...
#include <Matrices.hpp>

Public Member Functions | |
| Matrix () | |
| virtual | ~Matrix () |
| virtual void | free ()=0 |
| virtual Matrix * | duplicate () const =0 |
| virtual real_t | diag (int i) const =0 |
| virtual BooleanType | isDiag () const =0 |
| virtual real_t | getNorm (int type=2) const =0 |
| virtual real_t | getRowNorm (int rNum, int type=2) const =0 |
| virtual returnValue | getRow (int rNum, const Indexlist *const icols, real_t alpha, real_t *row) const =0 |
| virtual returnValue | getCol (int cNum, const Indexlist *const irows, real_t alpha, real_t *col) const =0 |
| virtual returnValue | times (int xN, real_t alpha, const real_t *x, int xLD, real_t beta, real_t *y, int yLD) const =0 |
| virtual returnValue | transTimes (int xN, real_t alpha, const real_t *x, int xLD, real_t beta, real_t *y, int yLD) const =0 |
| virtual returnValue | times (const Indexlist *const irows, const Indexlist *const icols, int xN, real_t alpha, const real_t *x, int xLD, real_t beta, real_t *y, int yLD, BooleanType yCompr=BT_TRUE) const =0 |
| virtual returnValue | transTimes (const Indexlist *const irows, const Indexlist *const icols, int xN, real_t alpha, const real_t *x, int xLD, real_t beta, real_t *y, int yLD) const =0 |
| virtual returnValue | addToDiag (real_t alpha)=0 |
| virtual real_t * | full () const =0 |
| virtual returnValue | print (const char *name=0) const =0 |
| BooleanType | needToFreeMemory () const |
| void | doFreeMemory () |
| void | doNotFreeMemory () |
Protected Attributes | |
| BooleanType | freeMemory |
Abstract base matrix class. Supplies interface to matrix vector products, including products with submatrices given by (ordered) working set index lists (see SubjectTo).
| Matrix::Matrix | ( | ) | [inline] |
Default constructor.
References doNotFreeMemory().
| virtual Matrix::~Matrix | ( | ) | [inline, virtual] |
Destructor.
| virtual returnValue Matrix::addToDiag | ( | real_t | alpha | ) | [pure virtual] |
Adds given offset to diagonal of matrix.
| alpha | Diagonal offset. |
Implemented in SparseMatrixRow, SparseMatrix, and DenseMatrix.
Referenced by QProblemB::regulariseHessian().
| virtual real_t Matrix::diag | ( | int | i | ) | const [pure virtual] |
Returns i-th diagonal entry.
| i | Index. |
Implemented in SparseMatrixRow, SparseMatrix, and DenseMatrix.
Referenced by QProblemB::determineHessianType(), QProblem::removeBound(), and QProblemB::removeBound().
| void Matrix::doFreeMemory | ( | ) | [inline] |
Enables de-allocation of internal memory.
References BT_TRUE, and freeMemory.
Referenced by QProblemB::createDiagSparseMat(), DenseMatrix::duplicate(), SparseMatrix::duplicate(), SparseMatrixRow::duplicate(), SymDenseMat::duplicateSym(), SymSparseMat::duplicateSym(), QProblemB::setupQPdataFromFile(), QProblem::setupQPdataFromFile(), solveOQPbenchmark(), SparseMatrix::SparseMatrix(), and SparseMatrixRow::SparseMatrixRow().
| void Matrix::doNotFreeMemory | ( | ) | [inline] |
Disables de-allocation of internal memory.
Referenced by SparseMatrix::free(), SparseMatrixRow::free(), Matrix(), SparseMatrix::SparseMatrix(), and SparseMatrixRow::SparseMatrixRow().
| virtual Matrix* Matrix::duplicate | ( | ) | const [pure virtual] |
Returns a deep-copy of the Matrix object.
Implemented in SymSparseMat, SparseMatrixRow, SparseMatrix, SymDenseMat, and DenseMatrix.
Referenced by QProblem::copy().
| virtual void Matrix::free | ( | ) | [pure virtual] |
Frees all internal memory.
Implemented in SparseMatrixRow, SparseMatrix, and DenseMatrix.
| virtual real_t* Matrix::full | ( | ) | const [pure virtual] |
Allocates and creates dense matrix array in row major format.
Note: Calling function has to free allocated memory!
Implemented in SparseMatrixRow, SparseMatrix, and DenseMatrix.
Referenced by SolutionAnalysis::getKktViolation(), and QProblem::writeQpDataIntoMatFile().
| virtual returnValue Matrix::getCol | ( | int | cNum, |
| const Indexlist *const | irows, | ||
| real_t | alpha, | ||
| real_t * | col | ||
| ) | const [pure virtual] |
Retrieve indexed entries of matrix column multiplied by alpha.
| cNum | Column number. |
| irows | Index list specifying rows. |
| alpha | Scalar factor. |
| col | Output column vector. |
Implemented in SparseMatrixRow, SparseMatrix, and DenseMatrix.
Referenced by QProblemB::computeCholesky(), QProblem::computeProjectedCholesky(), and QProblem::removeBound().
| virtual real_t Matrix::getNorm | ( | int | type = 2 | ) | const [pure virtual] |
Get the N-norm of the matrix
| type | Norm type, 1: one-norm, 2: Euclidean norm. |
Implemented in SparseMatrixRow, SparseMatrix, and DenseMatrix.
Referenced by QProblemB::regulariseHessian().
| virtual returnValue Matrix::getRow | ( | int | rNum, |
| const Indexlist *const | icols, | ||
| real_t | alpha, | ||
| real_t * | row | ||
| ) | const [pure virtual] |
Retrieve indexed entries of matrix row multiplied by alpha.
| rNum | Row number. |
| icols | Index list specifying columns. |
| alpha | Scalar factor. |
| row | Output row vector. |
Implemented in SparseMatrixRow, SparseMatrix, and DenseMatrix.
Referenced by QProblem::addConstraint(), QProblem::addConstraint_checkLI(), QProblem::addConstraint_ensureLI(), and QProblemB::removeBound().
| virtual real_t Matrix::getRowNorm | ( | int | rNum, |
| int | type = 2 |
||
| ) | const [pure virtual] |
Get the N-norm of a row
| rNum | Row number. |
| type | Norm type, 1: one-norm, 2: Euclidean norm. |
Implemented in SparseMatrixRow, SparseMatrix, and DenseMatrix.
Referenced by QProblem::setA().
| virtual BooleanType Matrix::isDiag | ( | ) | const [pure virtual] |
Checks whether matrix is square and diagonal.
Implemented in SparseMatrixRow, SparseMatrix, and DenseMatrix.
Referenced by QProblemB::determineHessianType().
| BooleanType Matrix::needToFreeMemory | ( | ) | const [inline] |
Returns whether internal memory needs to be de-allocated.
References freeMemory.
Referenced by DenseMatrix::duplicate(), SymDenseMat::duplicateSym(), DenseMatrix::~DenseMatrix(), SparseMatrix::~SparseMatrix(), and SparseMatrixRow::~SparseMatrixRow().
| virtual returnValue Matrix::print | ( | const char * | name = 0 | ) | const [pure virtual] |
Prints matrix to screen.
| name | Name of matrix. |
Implemented in SparseMatrixRow, SparseMatrix, and DenseMatrix.
| virtual returnValue Matrix::times | ( | int | xN, |
| real_t | alpha, | ||
| const real_t * | x, | ||
| int | xLD, | ||
| real_t | beta, | ||
| real_t * | y, | ||
| int | yLD | ||
| ) | const [pure virtual] |
Evaluate Y=alpha*A*X + beta*Y.
| xN | Number of vectors to multiply. |
| alpha | Scalar factor for matrix vector product. |
| x | Input vector to be multiplied. |
| xLD | Leading dimension of input x. |
| beta | Scalar factor for y. |
| y | Output vector of results. |
| yLD | Leading dimension of output y. |
Implemented in SparseMatrixRow, SparseMatrix, and DenseMatrix.
Referenced by QProblem::determineStepDirection(), QProblemB::determineStepDirection(), QProblem::ensureNonzeroCurvature(), QProblemB::getObjVal(), QProblem::performStep(), QProblem::printIteration(), QProblemB::printIteration(), QProblem::removeBound(), QProblem::removeConstraint(), QProblem::setA(), QProblem::setupAuxiliaryQP(), QProblem::setupAuxiliaryQPgradient(), QProblemB::setupAuxiliaryQPgradient(), and QProblem::setupAuxiliaryQPsolution().
| virtual returnValue Matrix::times | ( | const Indexlist *const | irows, |
| const Indexlist *const | icols, | ||
| int | xN, | ||
| real_t | alpha, | ||
| const real_t * | x, | ||
| int | xLD, | ||
| real_t | beta, | ||
| real_t * | y, | ||
| int | yLD, | ||
| BooleanType | yCompr = BT_TRUE |
||
| ) | const [pure virtual] |
Evaluate matrix vector product with submatrix given by Indexlist.
| irows | Index list specifying rows. |
| icols | Index list specifying columns. |
| xN | Number of vectors to multiply. |
| alpha | Scalar factor for matrix vector product. |
| x | Input vector to be multiplied. |
| xLD | Leading dimension of input x. |
| beta | Scalar factor for y. |
| y | Output vector of results. |
| yLD | Leading dimension of output y. |
| yCompr | Compressed storage for y. |
Implemented in SparseMatrixRow, SparseMatrix, and DenseMatrix.
| virtual returnValue Matrix::transTimes | ( | int | xN, |
| real_t | alpha, | ||
| const real_t * | x, | ||
| int | xLD, | ||
| real_t | beta, | ||
| real_t * | y, | ||
| int | yLD | ||
| ) | const [pure virtual] |
Evaluate Y=alpha*A'*X + beta*Y.
| xN | Number of vectors to multiply. |
| alpha | Scalar factor for matrix vector product. |
| x | Input vector to be multiplied. |
| xLD | Leading dimension of input x. |
| beta | Scalar factor for y. |
| y | Output vector of results. |
| yLD | Leading dimension of output y. |
Implemented in SparseMatrixRow, SparseMatrix, and DenseMatrix.
Referenced by QProblem::addBound_ensureLI(), QProblem::addConstraint_ensureLI(), QProblem::determineStepDirection(), QProblem::printIteration(), and QProblem::setupAuxiliaryQPgradient().
| virtual returnValue Matrix::transTimes | ( | const Indexlist *const | irows, |
| const Indexlist *const | icols, | ||
| int | xN, | ||
| real_t | alpha, | ||
| const real_t * | x, | ||
| int | xLD, | ||
| real_t | beta, | ||
| real_t * | y, | ||
| int | yLD | ||
| ) | const [pure virtual] |
Evaluate matrix transpose vector product.
| irows | Index list specifying rows. |
| icols | Index list specifying columns. |
| xN | Number of vectors to multiply. |
| alpha | Scalar factor for matrix vector product. |
| x | Input vector to be multiplied. |
| xLD | Leading dimension of input x. |
| beta | Scalar factor for y. |
| y | Output vector of results. |
| yLD | Leading dimension of output y. |
Implemented in SparseMatrixRow, SparseMatrix, and DenseMatrix.
BooleanType Matrix::freeMemory [protected] |
Indicating whether internal memory needs to be de-allocated.
Referenced by doFreeMemory(), and needToFreeMemory().
1.7.6.1