|
qpOASES
3.1.1
|
Interfaces matrix-vector operations tailored to general dense matrices. More...
#include <Matrices.hpp>

Public Member Functions | |
| DenseMatrix () | |
| DenseMatrix (int m, int n, int lD, real_t *v) | |
| virtual | ~DenseMatrix () |
| virtual void | free () |
| virtual Matrix * | duplicate () const |
| virtual real_t | diag (int i) const |
| virtual BooleanType | isDiag () const |
| virtual real_t | getNorm (int type=2) const |
| virtual real_t | getRowNorm (int rNum, int type=2) const |
| virtual returnValue | getRow (int rNum, const Indexlist *const icols, real_t alpha, real_t *row) const |
| virtual returnValue | getCol (int cNum, const Indexlist *const irows, real_t alpha, real_t *col) const |
| virtual returnValue | times (int xN, real_t alpha, const real_t *x, int xLD, real_t beta, real_t *y, int yLD) const |
| virtual returnValue | transTimes (int xN, real_t alpha, const real_t *x, int xLD, real_t beta, real_t *y, int yLD) const |
| 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 |
| 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 |
| virtual returnValue | addToDiag (real_t alpha) |
| virtual real_t * | full () const |
| virtual returnValue | print (const char *name=0) const |
| BooleanType | needToFreeMemory () const |
| void | doFreeMemory () |
| void | doNotFreeMemory () |
Protected Attributes | |
| int | nRows |
| int | nCols |
| int | leaDim |
| real_t * | val |
| BooleanType | freeMemory |
Dense matrix class (row major format).
| DenseMatrix::DenseMatrix | ( | ) | [inline] |
Default constructor.
Referenced by duplicate().
| DenseMatrix::DenseMatrix | ( | int | m, |
| int | n, | ||
| int | lD, | ||
| real_t * | v | ||
| ) | [inline] |
Constructor from vector of values. Caution: Data pointer must be valid throughout lifetime
| m | Number of rows. |
| n | Number of columns. |
| lD | Leading dimension. |
| v | Values. |
| BEGIN_NAMESPACE_QPOASES DenseMatrix::~DenseMatrix | ( | ) | [virtual] |
Destructor.
References BT_TRUE, free(), and Matrix::needToFreeMemory().
| returnValue DenseMatrix::addToDiag | ( | real_t | alpha | ) | [virtual] |
| real_t DenseMatrix::diag | ( | int | i | ) | const [virtual] |
| void Matrix::doFreeMemory | ( | ) | [inline, inherited] |
Enables de-allocation of internal memory.
References BT_TRUE, and Matrix::freeMemory.
Referenced by QProblemB::createDiagSparseMat(), duplicate(), SparseMatrix::duplicate(), SparseMatrixRow::duplicate(), SymDenseMat::duplicateSym(), SymSparseMat::duplicateSym(), QProblemB::setupQPdataFromFile(), QProblem::setupQPdataFromFile(), solveOQPbenchmark(), SparseMatrix::SparseMatrix(), and SparseMatrixRow::SparseMatrixRow().
| void Matrix::doNotFreeMemory | ( | ) | [inline, inherited] |
Disables de-allocation of internal memory.
Referenced by SparseMatrix::free(), SparseMatrixRow::free(), Matrix::Matrix(), SparseMatrix::SparseMatrix(), and SparseMatrixRow::SparseMatrixRow().
| Matrix * DenseMatrix::duplicate | ( | ) | const [virtual] |
Returns a deep-copy of the Matrix object.
Implements Matrix.
Reimplemented in SymDenseMat.
References BT_TRUE, DenseMatrix(), Matrix::doFreeMemory(), nCols, Matrix::needToFreeMemory(), nRows, real_t, and val.
| void DenseMatrix::free | ( | ) | [virtual] |
| real_t * DenseMatrix::full | ( | ) | const [virtual] |
| returnValue DenseMatrix::getCol | ( | int | cNum, |
| const Indexlist *const | irows, | ||
| real_t | alpha, | ||
| real_t * | col | ||
| ) | const [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. |
Implements Matrix.
References BT_TRUE, isEqual(), leaDim, Indexlist::length, Indexlist::number, SUCCESSFUL_RETURN, and val.
| real_t DenseMatrix::getNorm | ( | int | type = 2 | ) | const [virtual] |
Get the N-norm of the matrix
| type | Norm type, 1: one-norm, 2: Euclidean norm. |
Implements Matrix.
References nCols, nRows, REFER_NAMESPACE_QPOASES, and val.
Referenced by getRowNorm().
| returnValue DenseMatrix::getRow | ( | int | rNum, |
| const Indexlist *const | icols, | ||
| real_t | alpha, | ||
| real_t * | row | ||
| ) | const [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. |
Implements Matrix.
References BT_TRUE, isEqual(), leaDim, Indexlist::length, nCols, Indexlist::number, SUCCESSFUL_RETURN, and val.
| real_t DenseMatrix::getRowNorm | ( | int | rNum, |
| int | type = 2 |
||
| ) | const [virtual] |
| BooleanType DenseMatrix::isDiag | ( | ) | const [virtual] |
| BooleanType Matrix::needToFreeMemory | ( | ) | const [inline, inherited] |
Returns whether internal memory needs to be de-allocated.
References Matrix::freeMemory.
Referenced by duplicate(), SymDenseMat::duplicateSym(), ~DenseMatrix(), SparseMatrix::~SparseMatrix(), and SparseMatrixRow::~SparseMatrixRow().
| returnValue DenseMatrix::print | ( | const char * | name = 0 | ) | const [virtual] |
Prints matrix to screen.
| name | Name of matrix. |
Implements Matrix.
References nCols, nRows, REFER_NAMESPACE_QPOASES, and val.
| returnValue DenseMatrix::times | ( | int | xN, |
| real_t | alpha, | ||
| const real_t * | x, | ||
| int | xLD, | ||
| real_t | beta, | ||
| real_t * | y, | ||
| int | yLD | ||
| ) | const [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. |
Implements Matrix.
References GEMM, getMax(), nCols, nRows, SUCCESSFUL_RETURN, and val.
| returnValue DenseMatrix::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 [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. |
Implements Matrix.
References BT_FALSE, BT_TRUE, isEqual(), Indexlist::iSort, isZero(), leaDim, Indexlist::length, nCols, Indexlist::number, SUCCESSFUL_RETURN, and val.
| returnValue DenseMatrix::transTimes | ( | int | xN, |
| real_t | alpha, | ||
| const real_t * | x, | ||
| int | xLD, | ||
| real_t | beta, | ||
| real_t * | y, | ||
| int | yLD | ||
| ) | const [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. |
Implements Matrix.
References GEMM, getMax(), nCols, nRows, SUCCESSFUL_RETURN, and val.
| returnValue DenseMatrix::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 [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. |
Implements Matrix.
References BT_FALSE, BT_TRUE, isEqual(), Indexlist::iSort, isZero(), leaDim, Indexlist::length, Indexlist::number, SUCCESSFUL_RETURN, and val.
BooleanType Matrix::freeMemory [protected, inherited] |
Indicating whether internal memory needs to be de-allocated.
Referenced by Matrix::doFreeMemory(), and Matrix::needToFreeMemory().
int DenseMatrix::leaDim [protected] |
Leading dimension.
Referenced by addToDiag(), SymDenseMat::bilinear(), diag(), getCol(), getRow(), getRowNorm(), isDiag(), times(), and transTimes().
int DenseMatrix::nCols [protected] |
Number of columns.
Referenced by addToDiag(), duplicate(), SymDenseMat::duplicateSym(), full(), getNorm(), getRow(), getRowNorm(), isDiag(), print(), times(), and transTimes().
int DenseMatrix::nRows [protected] |
Number of rows.
Referenced by addToDiag(), duplicate(), SymDenseMat::duplicateSym(), full(), getNorm(), isDiag(), print(), times(), and transTimes().
real_t* DenseMatrix::val [protected] |
Vector of entries.
Referenced by addToDiag(), SymDenseMat::bilinear(), diag(), duplicate(), SymDenseMat::duplicateSym(), free(), full(), getCol(), getNorm(), getRow(), getRowNorm(), isDiag(), print(), times(), and transTimes().
1.7.6.1