qpOASES  3.2.1
An Implementation of the Online Active Set Strategy
Public Member Functions | Protected Attributes | List of all members
SymSparseMat Class Referenceabstract

Interfaces matrix-vector operations tailored to symmetric sparse matrices. More...

#include <Matrices.hpp>

Inheritance diagram for SymSparseMat:
SymmetricMatrix SparseMatrix Matrix Matrix

Public Member Functions

 SymSparseMat ()
 
 SymSparseMat (int_t nr, int_t nc, sparse_int_t *r, sparse_int_t *c, real_t *v)
 
 SymSparseMat (int_t nr, int_t nc, int_t ld, const real_t *const v)
 
virtual ~SymSparseMat ()
 
virtual Matrixduplicate () const
 
virtual SymmetricMatrixduplicateSym () const
 
virtual returnValue bilinear (const Indexlist *const icols, int_t xN, const real_t *x, int_t xLD, real_t *y, int_t yLD) const
 
virtual void free ()=0
 
virtual real_t diag (int_t i) const =0
 
virtual BooleanType isDiag () const =0
 
virtual real_t getNorm (int_t type=2) const =0
 
virtual real_t getRowNorm (int_t rNum, int_t type=2) const =0
 
virtual returnValue getRowNorm (real_t *norm, int_t type=2) const =0
 
virtual returnValue getRow (int_t rNum, const Indexlist *const icols, real_t alpha, real_t *row) const =0
 
virtual returnValue getCol (int_t cNum, const Indexlist *const irows, real_t alpha, real_t *col) const =0
 
virtual returnValue getSparseSubmatrix (const Indexlist *const irows, const Indexlist *const icols, int_t rowoffset, int_t coloffset, int_t &numNonzeros, int_t *irn, int_t *jcn, real_t *avals, BooleanType only_lower_triangular=BT_FALSE) const
 
virtual returnValue getSparseSubmatrix (const Indexlist *const irows, int_t idx_icol, int_t rowoffset, int_t coloffset, int_t &numNonzeros, int_t *irn, int_t *jcn, real_t *avals, BooleanType only_lower_triangular=BT_FALSE) const
 
virtual returnValue getSparseSubmatrix (int_t idx_row, const Indexlist *const icols, int_t rowoffset, int_t coloffset, int_t &numNonzeros, int_t *irn, int_t *jcn, real_t *avals, BooleanType only_lower_triangular=BT_FALSE) const
 
virtual returnValue getSparseSubmatrix (int_t irowsLength, const int_t *const irowsNumber, int_t icolsLength, const int_t *const icolsNumber, int_t rowoffset, int_t coloffset, int_t &numNonzeros, int_t *irn, int_t *jcn, real_t *avals, BooleanType only_lower_triangular=BT_FALSE) const =0
 
virtual returnValue times (int_t xN, real_t alpha, const real_t *x, int_t xLD, real_t beta, real_t *y, int_t yLD) const =0
 
virtual returnValue times (const Indexlist *const irows, const Indexlist *const icols, int_t xN, real_t alpha, const real_t *x, int_t xLD, real_t beta, real_t *y, int_t yLD, BooleanType yCompr=BT_TRUE) const =0
 
virtual returnValue transTimes (int_t xN, real_t alpha, const real_t *x, int_t xLD, real_t beta, real_t *y, int_t yLD) const =0
 
virtual returnValue transTimes (const Indexlist *const irows, const Indexlist *const icols, int_t xN, real_t alpha, const real_t *x, int_t xLD, real_t beta, real_t *y, int_t yLD) const =0
 
virtual returnValue addToDiag (real_t alpha)=0
 
virtual real_tfull () const =0
 
virtual returnValue print (const char *name=0) const =0
 
virtual returnValue writeToFile (FILE *output_file, const char *prefix) const =0
 
BooleanType needToFreeMemory () const
 
void doFreeMemory ()
 
void doNotFreeMemory ()
 
virtual void free ()
 
virtual void setVal (const real_t *newVal)
 
virtual real_t diag (int_t i) const
 
virtual BooleanType isDiag () const
 
virtual real_t getNorm (int_t type=2) const
 
virtual real_t getRowNorm (int_t rNum, int_t type=2) const
 
virtual returnValue getRowNorm (real_t *norm, int_t type=2) const
 
virtual returnValue getRow (int_t rNum, const Indexlist *const icols, real_t alpha, real_t *row) const
 
virtual returnValue getCol (int_t cNum, const Indexlist *const irows, real_t alpha, real_t *col) const
 
virtual returnValue getSparseSubmatrix (int_t irowsLength, const int_t *const irowsNumber, int_t icolsLength, const int_t *const icolsNumber, int_t rowoffset, int_t coloffset, int_t &numNonzeros, int_t *irn, int_t *jcn, real_t *avals, BooleanType only_lower_triangular=BT_FALSE) const
 
virtual returnValue times (int_t xN, real_t alpha, const real_t *x, int_t xLD, real_t beta, real_t *y, int_t yLD) const
 
virtual returnValue times (const Indexlist *const irows, const Indexlist *const icols, int_t xN, real_t alpha, const real_t *x, int_t xLD, real_t beta, real_t *y, int_t yLD, BooleanType yCompr=BT_TRUE) const
 
virtual returnValue transTimes (int_t xN, real_t alpha, const real_t *x, int_t xLD, real_t beta, real_t *y, int_t yLD) const
 
virtual returnValue transTimes (const Indexlist *const irows, const Indexlist *const icols, int_t xN, real_t alpha, const real_t *x, int_t xLD, real_t beta, real_t *y, int_t yLD) const
 
virtual returnValue addToDiag (real_t alpha)
 
sparse_int_tcreateDiagInfo ()
 
virtual real_tfull () const
 
virtual returnValue print (const char *name=0) const
 
virtual returnValue writeToFile (FILE *output_file, const char *prefix) const
 

Protected Attributes

BooleanType freeMemory
 
int_t nRows
 
int_t nCols
 
sparse_int_tir
 
sparse_int_tjc
 
sparse_int_tjd
 
real_tval
 

Detailed Description

Symmetric sparse matrix class (column compressed format).

Author
Andreas Potschka, Christian Kirches, Hans Joachim Ferreau
Version
3.2
Date
2011-2017

Constructor & Destructor Documentation

◆ SymSparseMat() [1/3]

SymSparseMat::SymSparseMat ( )
inline

Default constructor.

Referenced by duplicateSym().

◆ SymSparseMat() [2/3]

SymSparseMat::SymSparseMat ( int_t  nr,
int_t  nc,
sparse_int_t r,
sparse_int_t c,
real_t v 
)
inline

Constructor with arguments.

Parameters
nrNumber of rows.
ncNumber of columns.
rRow indices (length).
cIndices to first entry of columns (nCols+1).
vVector of entries (length).

◆ SymSparseMat() [3/3]

SymSparseMat::SymSparseMat ( int_t  nr,
int_t  nc,
int_t  ld,
const real_t *const  v 
)
inline

Constructor from dense matrix.

Parameters
nrNumber of rows.
ncNumber of columns.
ldLeading dimension.
vRow major stored matrix elements.

◆ ~SymSparseMat()

virtual SymSparseMat::~SymSparseMat ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ addToDiag() [1/2]

virtual returnValue Matrix::addToDiag ( real_t  alpha)
pure virtualinherited

Adds given offset to diagonal of matrix.

Returns
SUCCESSFUL_RETURN
RET_NO_DIAGONAL_AVAILABLE
Parameters
alphaDiagonal offset.

Implemented in SparseMatrixRow, SparseMatrix, and DenseMatrix.

Referenced by QProblemB::regulariseHessian().

◆ addToDiag() [2/2]

returnValue SparseMatrix::addToDiag ( real_t  alpha)
virtualinherited

Adds given offset to diagonal of matrix.

Returns
SUCCESSFUL_RETURN
RET_NO_DIAGONAL_AVAILABLE
Parameters
alphaDiagonal offset.

Implements Matrix.

References BT_FALSE, SparseMatrix::ir, isZero(), SparseMatrix::jd, SparseMatrix::nCols, SparseMatrix::nRows, RET_DIAGONAL_NOT_INITIALISED, RET_NO_DIAGONAL_AVAILABLE, SUCCESSFUL_RETURN, THROWERROR, and SparseMatrix::val.

◆ bilinear()

returnValue SymSparseMat::bilinear ( const Indexlist *const  icols,
int_t  xN,
const real_t x,
int_t  xLD,
real_t y,
int_t  yLD 
) const
virtual

Compute bilinear form y = x'*H*x using submatrix given by index list.

Returns
SUCCESSFUL_RETURN
Parameters
icolsIndex list specifying columns of x.
xNNumber of vectors to multiply.
xInput vector to be multiplied (uncompressed).
xLDLeading dimension of input x.
yOutput vector of results (compressed).
yLDLeading dimension of output y.

Implements SymmetricMatrix.

References SparseMatrix::ir, Indexlist::iSort, SparseMatrix::jc, SparseMatrix::jd, Indexlist::length, Indexlist::number, RET_DIAGONAL_NOT_INITIALISED, SUCCESSFUL_RETURN, THROWERROR, and SparseMatrix::val.

Referenced by QProblem::computeProjectedCholesky().

◆ createDiagInfo()

sparse_int_t * SparseMatrix::createDiagInfo ( )
inherited

Create jd field from ir and jc.

Returns
Pointer to jd.

References SparseMatrix::ir, SparseMatrix::jc, SparseMatrix::jd, and SparseMatrix::nCols.

Referenced by QProblemB::createDiagSparseMat(), and solveOqpBenchmark().

◆ diag() [1/2]

virtual real_t Matrix::diag ( int_t  i) const
pure virtualinherited

Returns i-th diagonal entry.

Returns
i-th diagonal entry
Parameters
iIndex.

Implemented in SparseMatrixRow, SparseMatrix, and DenseMatrix.

Referenced by QProblemB::determineHessianType(), QProblem::removeBound(), and QProblemB::removeBound().

◆ diag() [2/2]

real_t SparseMatrix::diag ( int_t  i) const
virtualinherited

Returns i-th diagonal entry.

Returns
i-th diagonal entry (or INFTY if diagonal does not exist)
Parameters
iIndex.

Implements Matrix.

References INFTY, SparseMatrix::ir, SparseMatrix::jc, SparseMatrix::jd, RET_DIAGONAL_NOT_INITIALISED, THROWERROR, and SparseMatrix::val.

◆ doFreeMemory()

void Matrix::doFreeMemory ( )
inlineinherited

◆ doNotFreeMemory()

void Matrix::doNotFreeMemory ( )
inlineinherited

◆ duplicate()

Matrix * SymSparseMat::duplicate ( ) const
virtual

Returns a deep-copy of the Matrix object.

Returns
Deep-copy of Matrix object

Reimplemented from SparseMatrix.

References duplicateSym().

◆ duplicateSym()

SymmetricMatrix * SymSparseMat::duplicateSym ( ) const
virtual

◆ free() [1/2]

virtual void Matrix::free ( )
pure virtualinherited

Frees all internal memory.

Implemented in SparseMatrixRow, SparseMatrix, and DenseMatrix.

◆ free() [2/2]

void SparseMatrix::free ( )
virtualinherited

Frees all internal memory.

Implements Matrix.

References Matrix::doNotFreeMemory(), SparseMatrix::ir, SparseMatrix::jc, and SparseMatrix::val.

Referenced by SparseMatrix::~SparseMatrix().

◆ full() [1/2]

virtual real_t* Matrix::full ( ) const
pure virtualinherited

Allocates and creates dense matrix array in row major format.

Note: Calling function has to free allocated memory!

Returns
Pointer to matrix array.

Implemented in SparseMatrixRow, SparseMatrix, and DenseMatrix.

Referenced by SolutionAnalysis::getKktViolation(), and QProblem::writeQpDataIntoMatFile().

◆ full() [2/2]

real_t * SparseMatrix::full ( ) const
virtualinherited

Allocates and creates dense matrix array in row major format.

Note: Calling function has to free allocated memory!

Returns
Pointer to matrix array.

Implements Matrix.

References SparseMatrix::ir, SparseMatrix::jc, SparseMatrix::nCols, SparseMatrix::nRows, real_t, and SparseMatrix::val.

Referenced by SparseMatrix::print().

◆ getCol() [1/2]

virtual returnValue Matrix::getCol ( int_t  cNum,
const Indexlist *const  irows,
real_t  alpha,
real_t col 
) const
pure virtualinherited

Retrieve indexed entries of matrix column multiplied by alpha.

Returns
SUCCESSFUL_RETURN
Parameters
cNumColumn number.
irowsIndex list specifying rows.
alphaScalar factor.
colOutput column vector.

Implemented in SparseMatrixRow, SparseMatrix, and DenseMatrix.

Referenced by QProblemB::computeCholesky(), QProblem::computeProjectedCholesky(), and QProblem::removeBound().

◆ getCol() [2/2]

returnValue SparseMatrix::getCol ( int_t  cNum,
const Indexlist *const  irows,
real_t  alpha,
real_t col 
) const
virtualinherited

Retrieve indexed entries of matrix column multiplied by alpha.

Parameters
cNumColumn number.
irowsIndex list specifying rows.
alphaScalar factor.
colOutput column vector.

Implements Matrix.

References BT_TRUE, SparseMatrix::ir, isEqual(), Indexlist::iSort, SparseMatrix::jc, Indexlist::number, SUCCESSFUL_RETURN, and SparseMatrix::val.

◆ getNorm() [1/2]

virtual real_t Matrix::getNorm ( int_t  type = 2) const
pure virtualinherited

Get the N-norm of the matrix

Returns
N-norm of the matrix
Parameters
typeNorm type, 1: one-norm, 2: Euclidean norm.

Implemented in SparseMatrixRow, SparseMatrix, and DenseMatrix.

Referenced by QProblemB::regulariseHessian().

◆ getNorm() [2/2]

real_t SparseMatrix::getNorm ( int_t  type = 2) const
virtualinherited

Get the N-norm of the matrix

Returns
N-norm of the matrix
Parameters
typeNorm type, 1: one-norm, 2: Euclidean norm.

Implements Matrix.

References SparseMatrix::jc, SparseMatrix::nCols, REFER_NAMESPACE_QPOASES, and SparseMatrix::val.

◆ getRow() [1/2]

virtual returnValue Matrix::getRow ( int_t  rNum,
const Indexlist *const  icols,
real_t  alpha,
real_t row 
) const
pure virtualinherited

Retrieve indexed entries of matrix row multiplied by alpha.

Returns
SUCCESSFUL_RETURN
Parameters
rNumRow number.
icolsIndex list specifying columns.
alphaScalar factor.
rowOutput row vector.

Implemented in SparseMatrixRow, SparseMatrix, and DenseMatrix.

Referenced by QProblem::addConstraint(), QProblem::addConstraint_checkLI(), SQProblemSchur::addConstraint_checkLISchur(), QProblem::addConstraint_ensureLI(), and QProblemB::removeBound().

◆ getRow() [2/2]

returnValue SparseMatrix::getRow ( int_t  rNum,
const Indexlist *const  icols,
real_t  alpha,
real_t row 
) const
virtualinherited

Retrieve indexed entries of matrix row multiplied by alpha.

Parameters
rNumRow number.
icolsIndex list specifying columns.
alphaScalar factor.
rowOutput row vector.

Implements Matrix.

References BT_TRUE, SparseMatrix::ir, isEqual(), Indexlist::iSort, SparseMatrix::jc, Indexlist::length, SparseMatrix::nCols, Indexlist::number, SUCCESSFUL_RETURN, and SparseMatrix::val.

◆ getRowNorm() [1/4]

virtual real_t Matrix::getRowNorm ( int_t  rNum,
int_t  type = 2 
) const
pure virtualinherited

Get the N-norm of a row

Returns
N-norm of row rNum
Parameters
rNumRow number.
typeNorm type, 1: one-norm, 2: Euclidean norm.

Implemented in SparseMatrixRow, SparseMatrix, and DenseMatrix.

Referenced by QProblem::setA().

◆ getRowNorm() [2/4]

virtual returnValue Matrix::getRowNorm ( real_t norm,
int_t  type = 2 
) const
pure virtualinherited

Get the N-norm of all rows

Returns
SUCCESSFUL_RETURN
Parameters
normNorm of each row.
typeNorm type, 1: one-norm, 2: Euclidean norm.

Implemented in SparseMatrixRow, SparseMatrix, and DenseMatrix.

◆ getRowNorm() [3/4]

real_t SparseMatrix::getRowNorm ( int_t  rNum,
int_t  type = 2 
) const
virtualinherited

Get the N-norm of a row

Returns
N-norm of row rNum
Parameters
rNumRow number.
typeNorm type, 1: one-norm, 2: Euclidean norm.

Implements Matrix.

References getAbs(), getSqrt(), INFTY, SparseMatrix::ir, SparseMatrix::jc, SparseMatrix::nCols, real_t, RET_INVALID_ARGUMENTS, THROWERROR, and SparseMatrix::val.

◆ getRowNorm() [4/4]

returnValue SparseMatrix::getRowNorm ( real_t norm,
int_t  type = 2 
) const
virtualinherited

Get the N-norm of all rows

Returns
SUCCESSFUL_RETURN
Parameters
normNorm of each row.
typeNorm type, 1: one-norm, 2: Euclidean norm.

Implements Matrix.

References getAbs(), getSqrt(), SparseMatrix::ir, SparseMatrix::jc, SparseMatrix::nCols, SparseMatrix::nRows, RET_INVALID_ARGUMENTS, SUCCESSFUL_RETURN, and SparseMatrix::val.

◆ getSparseSubmatrix() [1/5]

BEGIN_NAMESPACE_QPOASES returnValue Matrix::getSparseSubmatrix ( const Indexlist *const  irows,
const Indexlist *const  icols,
int_t  rowoffset,
int_t  coloffset,
int_t numNonzeros,
int_t irn,
int_t jcn,
real_t avals,
BooleanType  only_lower_triangular = BT_FALSE 
) const
virtualinherited

Retrieve entries of submatrix in Harwell-Boeing sparse format. If irn, jcn, and avals are null, this only counts the number of nonzeros. Otherwise, numNonzeros containts the size of irn, jcn, and avals on entry, and the written number of entries on return.

Returns
SUCCESSFUL_RETURN
Parameters
irowsIndex list specifying rows.
icolsIndex list specifying columns.
rowoffsetOffset for row entries.
coloffsetOffset for row entries.
numNonzerosNumber of nonzeros in submatrix.
irnRow position of entries (as position in irows) plus rowoffset.
jcnColumn position of entries (as position in irows) plus coloffset.
avalsNumerical values of the entries.
only_lower_triangularif true, only the lower triangular portion is returned. This can only be true for symmetric matrices and if irows==jcols.

References Indexlist::getLength(), and Indexlist::getNumberArray().

Referenced by Matrix::getSparseSubmatrix().

◆ getSparseSubmatrix() [2/5]

returnValue Matrix::getSparseSubmatrix ( const Indexlist *const  irows,
int_t  idx_icol,
int_t  rowoffset,
int_t  coloffset,
int_t numNonzeros,
int_t irn,
int_t jcn,
real_t avals,
BooleanType  only_lower_triangular = BT_FALSE 
) const
virtualinherited

Retrieve entries of submatrix in Harwell-Boeing sparse format. If irn, jcn, and avals are null, this only counts the number of nonzeros. Otherwise, numNonzeros containts the size of irn, jcn, and avals on entry, and the written number of entries on return. This version retrieves one column.

Returns
SUCCESSFUL_RETURN
Parameters
irowsIndex list specifying rows.
idx_icolIndex list specifying columns.
rowoffsetOffset for row entries.
coloffsetOffset for row entries.
numNonzerosNumber of nonzeros in submatrix.
irnRow position of entries (as position in irows) plus rowoffset.
jcnColumn position of entries (as position in irows) plus coloffset.
avalsNumerical values of the entries.
only_lower_triangularif true, only the lower triangular portion is returned. This can only be true for symmetric matrices and if irows==jcols.

References Indexlist::getLength(), Indexlist::getNumberArray(), and Matrix::getSparseSubmatrix().

◆ getSparseSubmatrix() [3/5]

returnValue Matrix::getSparseSubmatrix ( int_t  idx_row,
const Indexlist *const  icols,
int_t  rowoffset,
int_t  coloffset,
int_t numNonzeros,
int_t irn,
int_t jcn,
real_t avals,
BooleanType  only_lower_triangular = BT_FALSE 
) const
virtualinherited

Retrieve entries of submatrix in Harwell-Boeing sparse format. If irn, jcn, and avals are null, this only counts the number of nonzeros. Otherwise, numNonzeros containts the size of irn, jcn, and avals on entry, and the written number of entries on return. This version retrieves one row.

Returns
SUCCESSFUL_RETURN
Parameters
idx_rowRow number.
icolsIndex list specifying columns.
rowoffsetOffset for row entries.
coloffsetOffset for row entries.
numNonzerosNumber of nonzeros in submatrix.
irnRow position of entries (as position in irows) plus rowoffset.
jcnColumn position of entries (as position in irows) plus coloffset.
avalsNumerical values of the entries.
only_lower_triangularif true, only the lower triangular portion is returned. This can only be true for symmetric matrices and if irows==jcols.

References Indexlist::getLength(), Indexlist::getNumberArray(), and Matrix::getSparseSubmatrix().

◆ getSparseSubmatrix() [4/5]

virtual returnValue Matrix::getSparseSubmatrix ( int_t  irowsLength,
const int_t *const  irowsNumber,
int_t  icolsLength,
const int_t *const  icolsNumber,
int_t  rowoffset,
int_t  coloffset,
int_t numNonzeros,
int_t irn,
int_t jcn,
real_t avals,
BooleanType  only_lower_triangular = BT_FALSE 
) const
pure virtualinherited

Retrieve entries of submatrix in Harwell-Boeing sparse format. If irn, jcn, and avals are null, this only counts the number of nonzeros. Otherwise, numNonzeros containts the size of irn, jcn, and avals on entry, and the written number of entries on return.

Returns
SUCCESSFUL_RETURN
Parameters
irowsLengthNumber of rows.
irowsNumberArray with row numbers.
icolsLengthNumber of columns.
icolsNumberArray with column numbers.
rowoffsetOffset for row entries.
coloffsetOffset for row entries.
numNonzerosNumber of nonzeros in submatrix.
irnRow position of entries (as position in irows) plus rowoffset.
jcnColumn position of entries (as position in irows) plus coloffset.
avalsNumerical values of the entries.
only_lower_triangularif true, only the lower triangular portion is returned. This can only be true for symmetric matrices and if irows==jcols.

Implemented in SparseMatrixRow, SparseMatrix, and DenseMatrix.

◆ getSparseSubmatrix() [5/5]

returnValue SparseMatrix::getSparseSubmatrix ( int_t  irowsLength,
const int_t *const  irowsNumber,
int_t  icolsLength,
const int_t *const  icolsNumber,
int_t  rowoffset,
int_t  coloffset,
int_t numNonzeros,
int_t irn,
int_t jcn,
real_t avals,
BooleanType  only_lower_triangular = BT_FALSE 
) const
virtualinherited

Retrieve entries of submatrix in Harwell-Boeing sparse format. If irn, jcn, and avals are null, this only counts the number of nonzeros. Otherwise, numNonzeros containts the size of irn, jcn, and avals on entry, and the written number of entries on return.

Returns
SUCCESSFUL_RETURN
Parameters
irowsLengthNumber of rows.
irowsNumberArray with row numbers.
icolsLengthNumber of columns.
icolsNumberArray with column numbers.
rowoffsetOffset for row entries.
coloffsetOffset for row entries.
numNonzerosNumber of nonzeros in submatrix.
irnRow position of entries (as position in irows) plus rowoffset.
jcnColumn position of entries (as position in irows) plus coloffset.
avalsNumerical values of the entries.
only_lower_triangularif true, only the lower triangular portion is returned. This can only be true for symmetric matrices and if irows==jcols.

Implements Matrix.

References BT_FALSE, SparseMatrix::ir, SparseMatrix::jc, SparseMatrix::nRows, RET_INVALID_ARGUMENTS, SUCCESSFUL_RETURN, THROWERROR, and SparseMatrix::val.

◆ isDiag() [1/2]

virtual BooleanType Matrix::isDiag ( ) const
pure virtualinherited

Checks whether matrix is square and diagonal.

Returns
BT_TRUE iff matrix is square and diagonal;
BT_FALSE otherwise.

Implemented in SparseMatrixRow, SparseMatrix, and DenseMatrix.

Referenced by QProblemB::determineHessianType().

◆ isDiag() [2/2]

BooleanType SparseMatrix::isDiag ( ) const
virtualinherited

Checks whether matrix is square and diagonal.

Returns
BT_TRUE iff matrix is square and diagonal;
BT_FALSE otherwise.

Implements Matrix.

References BT_FALSE, BT_TRUE, SparseMatrix::ir, SparseMatrix::jc, SparseMatrix::nCols, and SparseMatrix::nRows.

◆ needToFreeMemory()

BooleanType Matrix::needToFreeMemory ( ) const
inlineinherited

Returns whether internal memory needs to be de-allocated.

Returns
BT_TRUE iff internal memory needs to be de-allocated,
BT_FALSE otherwise

References Matrix::freeMemory.

Referenced by DenseMatrix::duplicate(), SymDenseMat::duplicateSym(), DenseMatrix::~DenseMatrix(), SparseMatrix::~SparseMatrix(), and SparseMatrixRow::~SparseMatrixRow().

◆ print() [1/2]

virtual returnValue Matrix::print ( const char *  name = 0) const
pure virtualinherited

Prints matrix to screen.

Returns
SUCCESSFUL_RETURN
Parameters
nameName of matrix.

Implemented in SparseMatrixRow, SparseMatrix, and DenseMatrix.

◆ print() [2/2]

returnValue SparseMatrix::print ( const char *  name = 0) const
virtualinherited

Prints matrix to screen.

Returns
SUCCESSFUL_RETURN
Parameters
nameName of matrix.

Implements Matrix.

References SparseMatrix::full(), SparseMatrix::nCols, SparseMatrix::nRows, real_t, and REFER_NAMESPACE_QPOASES.

◆ setVal()

void SparseMatrix::setVal ( const real_t newVal)
virtualinherited

Sets value array.

Thanks to Frank Chuang.

Parameters
newVal...

References SparseMatrix::jc, SparseMatrix::nCols, and SparseMatrix::val.

◆ times() [1/4]

virtual returnValue Matrix::times ( int_t  xN,
real_t  alpha,
const real_t x,
int_t  xLD,
real_t  beta,
real_t y,
int_t  yLD 
) const
pure virtualinherited

Evaluate Y=alpha*A*X + beta*Y.

Returns
SUCCESSFUL_RETURN
Parameters
xNNumber of vectors to multiply.
alphaScalar factor for matrix vector product.
xInput vector to be multiplied.
xLDLeading dimension of input x.
betaScalar factor for y.
yOutput vector of results.
yLDLeading 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().

◆ times() [2/4]

virtual returnValue Matrix::times ( const Indexlist *const  irows,
const Indexlist *const  icols,
int_t  xN,
real_t  alpha,
const real_t x,
int_t  xLD,
real_t  beta,
real_t y,
int_t  yLD,
BooleanType  yCompr = BT_TRUE 
) const
pure virtualinherited

Evaluate matrix vector product with submatrix given by Indexlist.

Returns
SUCCESSFUL_RETURN
Parameters
irowsIndex list specifying rows.
icolsIndex list specifying columns.
xNNumber of vectors to multiply.
alphaScalar factor for matrix vector product.
xInput vector to be multiplied.
xLDLeading dimension of input x.
betaScalar factor for y.
yOutput vector of results.
yLDLeading dimension of output y.
yComprCompressed storage for y.

Implemented in SparseMatrixRow, SparseMatrix, and DenseMatrix.

◆ times() [3/4]

returnValue SparseMatrix::times ( int_t  xN,
real_t  alpha,
const real_t x,
int_t  xLD,
real_t  beta,
real_t y,
int_t  yLD 
) const
virtualinherited

Evaluate Y=alpha*A*X + beta*Y.

Parameters
xNNumber of vectors to multiply.
alphaScalar factor for matrix vector product.
xInput vector to be multiplied.
xLDLeading dimension of input x.
betaScalar factor for y.
yOutput vector of results.
yLDLeading dimension of output y.

Implements Matrix.

References BT_FALSE, BT_TRUE, SparseMatrix::ir, isEqual(), isZero(), SparseMatrix::jc, SparseMatrix::nCols, SparseMatrix::nRows, SUCCESSFUL_RETURN, and SparseMatrix::val.

◆ times() [4/4]

returnValue SparseMatrix::times ( const Indexlist *const  irows,
const Indexlist *const  icols,
int_t  xN,
real_t  alpha,
const real_t x,
int_t  xLD,
real_t  beta,
real_t y,
int_t  yLD,
BooleanType  yCompr = BT_TRUE 
) const
virtualinherited

Evaluate matrix vector product with submatrix given by Indexlist.

Parameters
irowsIndex list specifying rows.
icolsIndex list specifying columns.
xNNumber of vectors to multiply.
alphaScalar factor for matrix vector product.
xInput vector to be multiplied.
xLDLeading dimension of input x.
betaScalar factor for y.
yOutput vector of results.
yLDLeading dimension of output y.
yComprCompressed storage for y.

Implements Matrix.

References BT_FALSE, BT_TRUE, getAbs(), getMax(), SparseMatrix::ir, isEqual(), Indexlist::iSort, isZero(), SparseMatrix::jc, Indexlist::length, SparseMatrix::nCols, SparseMatrix::nRows, Indexlist::number, real_t, SUCCESSFUL_RETURN, and SparseMatrix::val.

◆ transTimes() [1/4]

virtual returnValue Matrix::transTimes ( int_t  xN,
real_t  alpha,
const real_t x,
int_t  xLD,
real_t  beta,
real_t y,
int_t  yLD 
) const
pure virtualinherited

Evaluate Y=alpha*A'*X + beta*Y.

Returns
SUCCESSFUL_RETURN
Parameters
xNNumber of vectors to multiply.
alphaScalar factor for matrix vector product.
xInput vector to be multiplied.
xLDLeading dimension of input x.
betaScalar factor for y.
yOutput vector of results.
yLDLeading 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().

◆ transTimes() [2/4]

virtual returnValue Matrix::transTimes ( const Indexlist *const  irows,
const Indexlist *const  icols,
int_t  xN,
real_t  alpha,
const real_t x,
int_t  xLD,
real_t  beta,
real_t y,
int_t  yLD 
) const
pure virtualinherited

Evaluate matrix transpose vector product.

Returns
SUCCESSFUL_RETURN
Parameters
irowsIndex list specifying rows.
icolsIndex list specifying columns.
xNNumber of vectors to multiply.
alphaScalar factor for matrix vector product.
xInput vector to be multiplied.
xLDLeading dimension of input x.
betaScalar factor for y.
yOutput vector of results.
yLDLeading dimension of output y.

Implemented in SparseMatrixRow, SparseMatrix, and DenseMatrix.

◆ transTimes() [3/4]

returnValue SparseMatrix::transTimes ( int_t  xN,
real_t  alpha,
const real_t x,
int_t  xLD,
real_t  beta,
real_t y,
int_t  yLD 
) const
virtualinherited

Evaluate Y=alpha*A'*X + beta*Y.

Parameters
xNNumber of vectors to multiply.
alphaScalar factor for matrix vector product.
xInput vector to be multiplied.
xLDLeading dimension of input x.
betaScalar factor for y.
yOutput vector of results.
yLDLeading dimension of output y.

Implements Matrix.

References BT_FALSE, BT_TRUE, SparseMatrix::ir, isEqual(), isZero(), SparseMatrix::jc, SparseMatrix::nCols, SUCCESSFUL_RETURN, and SparseMatrix::val.

◆ transTimes() [4/4]

returnValue SparseMatrix::transTimes ( const Indexlist *const  irows,
const Indexlist *const  icols,
int_t  xN,
real_t  alpha,
const real_t x,
int_t  xLD,
real_t  beta,
real_t y,
int_t  yLD 
) const
virtualinherited

Evaluate matrix transpose vector product.

Parameters
irowsIndex list specifying rows.
icolsIndex list specifying columns.
xNNumber of vectors to multiply.
alphaScalar factor for matrix vector product.
xInput vector to be multiplied.
xLDLeading dimension of input x.
betaScalar factor for y.
yOutput vector of results.
yLDLeading dimension of output y.

Implements Matrix.

References BT_FALSE, BT_TRUE, SparseMatrix::ir, isEqual(), Indexlist::iSort, isZero(), SparseMatrix::jc, Indexlist::length, SparseMatrix::nRows, Indexlist::number, real_t, SUCCESSFUL_RETURN, and SparseMatrix::val.

◆ writeToFile() [1/2]

virtual returnValue Matrix::writeToFile ( FILE *  output_file,
const char *  prefix 
) const
pure virtualinherited

Write matrix to file.

Returns
SUCCESSFUL_RETURN

Implemented in SparseMatrixRow, SparseMatrix, and DenseMatrix.

◆ writeToFile() [2/2]

returnValue SparseMatrix::writeToFile ( FILE *  output_file,
const char *  prefix 
) const
virtualinherited

Write matrix to file.

Returns
SUCCESSFUL_RETURN

Implements Matrix.

References SparseMatrix::ir, SparseMatrix::jc, SparseMatrix::nCols, SUCCESSFUL_RETURN, and SparseMatrix::val.

Member Data Documentation

◆ freeMemory

BooleanType Matrix::freeMemory
protectedinherited

Indicating whether internal memory needs to be de-allocated.

Referenced by Matrix::doFreeMemory(), and Matrix::needToFreeMemory().

◆ ir

sparse_int_t* SparseMatrix::ir
protectedinherited

◆ jc

sparse_int_t* SparseMatrix::jc
protectedinherited

◆ jd

sparse_int_t* SparseMatrix::jd
protectedinherited

Indices to first entry of lower triangle (including diagonal) (nCols).

Referenced by SparseMatrix::addToDiag(), bilinear(), SparseMatrix::createDiagInfo(), SparseMatrix::diag(), SparseMatrix::duplicate(), duplicateSym(), and SparseMatrix::~SparseMatrix().

◆ nCols

int_t SparseMatrix::nCols
protectedinherited

◆ nRows

int_t SparseMatrix::nRows
protectedinherited

◆ val

real_t* SparseMatrix::val
protectedinherited

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