Public Member Functions | Protected Attributes | List of all members

Implements a very rudimentary block sparse matrix class. More...

#include <block_matrix.hpp>

Public Member Functions

returnValue addDense (uint rowIdx, uint colIdx, const DMatrix &value)
 
returnValue addRegularisation (uint rowIdx, uint colIdx, double eps)
 
BlockMatrix addRegularisation (double eps)
 
 BlockMatrix ()
 
 BlockMatrix (uint _nRows, uint _nCols)
 
 BlockMatrix (const DMatrix &value)
 
BlockMatrix getAbsolute () const
 
BlockMatrix getNegative () const
 
uint getNumCols () const
 
uint getNumCols (uint rowIdx, uint colIdx) const
 
uint getNumRows () const
 
uint getNumRows (uint rowIdx, uint colIdx) const
 
BlockMatrix getPositive () const
 
returnValue getSubBlock (uint rowIdx, uint colIdx, DMatrix &value) const
 
returnValue getSubBlock (uint rowIdx, uint colIdx, DMatrix &value, uint nR, uint nC) const
 
returnValue init (uint _nRows, uint _nCols)
 
bool isEmpty () const
 
bool isSquare () const
 
bool isSquare (uint rowIdx, uint colIdx) const
 
BlockMatrix operator* (const BlockMatrix &arg) const
 
BlockMatrix operator*= (double scalar)
 
BlockMatrix operator+ (const BlockMatrix &arg) const
 
BlockMatrixoperator+= (const BlockMatrix &arg)
 
BlockMatrix operator- (const BlockMatrix &arg) const
 
BlockMatrix operator^ (const BlockMatrix &arg) const
 
returnValue print (std::ostream &stream=std::cout) const
 
returnValue setDense (uint rowIdx, uint colIdx, const DMatrix &value)
 
returnValue setIdentity (uint rowIdx, uint colIdx, uint dim)
 
returnValue setZero (uint rowIdx, uint colIdx)
 
returnValue setZero ()
 
BlockMatrix transpose () const
 
virtual ~BlockMatrix ()
 

Protected Attributes

std::vector< std::vector< DMatrix > > elements
 
uint nCols
 
uint nRows
 
std::vector< std::vector< SubBlockMatrixType > > types
 

Detailed Description

Implements a very rudimentary block sparse matrix class.

The class BlockMatrix is a very rudimentary block sparse matrix class. It is only intended to provide a convenient way to deal with linear algebra objects and to provide a wrapper for more efficient implementations. It should not be used for efficiency-critical operations.

 \author Boris Houska, Hans Joachim Ferreau, Milan Vukov

Definition at line 52 of file block_matrix.hpp.

Constructor & Destructor Documentation

BEGIN_NAMESPACE_ACADO BlockMatrix::BlockMatrix ( )

Default constructor.

Definition at line 43 of file block_matrix.cpp.

BlockMatrix::BlockMatrix ( uint  _nRows,
uint  _nCols 
)

Constructor which takes dimensions of the block matrix.

Parameters
_nRowsNumber of block rows.
_nColsNumber of block columns.

Definition at line 48 of file block_matrix.cpp.

BlockMatrix::BlockMatrix ( const DMatrix value)

Constructor which takes ...

Definition at line 54 of file block_matrix.cpp.

BlockMatrix::~BlockMatrix ( )
virtual

Destructor.

Definition at line 62 of file block_matrix.cpp.

Member Function Documentation

returnValue BlockMatrix::addDense ( uint  rowIdx,
uint  colIdx,
const DMatrix value 
)

Add method that adds a matrix to a certain component.

Returns
SUCCESSFUL_RETURN
Parameters
rowIdxRow index of the component.
colIdxColumn index of the component.

Definition at line 458 of file block_matrix.cpp.

returnValue BlockMatrix::addRegularisation ( uint  rowIdx,
uint  colIdx,
double  eps 
)
inline

Sets all values to a given constant.

Returns
SUCCESSFUL_RETURN
BlockMatrix BlockMatrix::addRegularisation ( double  eps)
inline

Sets everyting to zero.

Returns
SUCCESSFUL_RETURN
BlockMatrix BlockMatrix::getAbsolute ( ) const

Returns the a block matrix whose components are the absolute values of the components of this object.

Definition at line 363 of file block_matrix.cpp.

BlockMatrix BlockMatrix::getNegative ( ) const

Returns the a block matrix whose components are equal to the components of this object, if they are negative or zero, but zero otherwise.

Definition at line 403 of file block_matrix.cpp.

uint BlockMatrix::getNumCols ( ) const
inline

Returns number of block columns of the block matrix object.

Returns
Number of columns.
uint BlockMatrix::getNumCols ( uint  rowIdx,
uint  colIdx 
) const
inline

Returns number of block columns of a specified sub-matrix.

Returns
Number of columns.
uint BlockMatrix::getNumRows ( ) const
inline

Returns number of block rows of the block matrix object.

Returns
Number of rows.
uint BlockMatrix::getNumRows ( uint  rowIdx,
uint  colIdx 
) const
inline

Returns the number of rows of a specified sub-matrix.

Returns
Number of rows.
BlockMatrix BlockMatrix::getPositive ( ) const

Returns the a block matrix whose components are equal to the components of this object, if they are positive or zero, but zero otherwise.

Definition at line 383 of file block_matrix.cpp.

returnValue BlockMatrix::getSubBlock ( uint  rowIdx,
uint  colIdx,
DMatrix value 
) const
inline

Access method that returns the value of a certain component.

Returns
SUCCESSFUL_RETURN
Parameters
rowIdxRow index of the component.
colIdxColumn index of the component.
returnValue BlockMatrix::getSubBlock ( uint  rowIdx,
uint  colIdx,
DMatrix value,
uint  nR,
uint  nC 
) const

Access method that returns the value of a certain component and requiring a given dimension.

Returns
SUCCESSFUL_RETURN
Parameters
rowIdxRow index of the component.
colIdxColumn index of the component.

Definition at line 473 of file block_matrix.cpp.

returnValue BlockMatrix::init ( uint  _nRows,
uint  _nCols 
)

Initializer

Definition at line 65 of file block_matrix.cpp.

bool BlockMatrix::isEmpty ( ) const
inline

Returns whether the block matrix element is empty.

bool BlockMatrix::isSquare ( ) const
inline

Tests if object is a block-square matrix.

Returns
BT_TRUE iff block matrix object is square.
bool BlockMatrix::isSquare ( uint  rowIdx,
uint  colIdx 
) const
inline

Tests if a specified sub-matrix is a square matrix.

Returns
BT_TRUE iff submatrix object is square.
BlockMatrix BlockMatrix::operator* ( const BlockMatrix arg) const

Multiplies a matrix from the right to the matrix object and stores the result to a temporary object.

Returns
Temporary object containing result of multiplication.
Parameters
argBlock DMatrix Factor.

Definition at line 192 of file block_matrix.cpp.

BlockMatrix BlockMatrix::operator*= ( double  scalar)

Multiplies each component of the object with a given scalar.

Returns
Reference to object after multiplication.
Parameters
scalarScalar factor.

Definition at line 176 of file block_matrix.cpp.

BlockMatrix BlockMatrix::operator+ ( const BlockMatrix arg) const

Adds (element-wise) two matrices to a temporary object.

Returns
Temporary object containing the sum of the block matrices.
Parameters
argSecond summand.

Definition at line 82 of file block_matrix.cpp.

BlockMatrix & BlockMatrix::operator+= ( const BlockMatrix arg)

Adds (element-wise) a matrix to object.

Returns
Reference to object after addition.
Parameters
argSecond summand.

Definition at line 112 of file block_matrix.cpp.

BlockMatrix BlockMatrix::operator- ( const BlockMatrix arg) const

Subtracts (element-wise) a matrix from the object and and stores the result to a temporary object.

Returns
Temporary object containing the difference of the matrices.
Parameters
argSubtrahend.

Definition at line 139 of file block_matrix.cpp.

BlockMatrix BlockMatrix::operator^ ( const BlockMatrix arg) const

Multiplies a matrix from the right to the transposed matrix object and stores the result to a temporary object.

Returns
Temporary object containing result of multiplication.
Parameters
argBlock DMatrix Factor.

Definition at line 272 of file block_matrix.cpp.

returnValue BlockMatrix::print ( std::ostream &  stream = std::cout) const

Prints object to standard ouput stream.

Returns
SUCCESSFUL_RETURN

Definition at line 420 of file block_matrix.cpp.

returnValue BlockMatrix::setDense ( uint  rowIdx,
uint  colIdx,
const DMatrix value 
)

Set method that defines the value of a certain component.

Returns
SUCCESSFUL_RETURN
Parameters
rowIdxRow index of the component.
colIdxColumn index of the component.

Definition at line 446 of file block_matrix.cpp.

returnValue BlockMatrix::setIdentity ( uint  rowIdx,
uint  colIdx,
uint  dim 
)
inline

Sets a specified sub block to the (dim x dim)-identity matrix.

Returns
SUCCESSFUL_RETURN
Parameters
rowIdxrow index of the sub block
colIdxcolumn index of the sub block
dimdimension of the sub block
returnValue BlockMatrix::setZero ( uint  rowIdx,
uint  colIdx 
)
inline

Sets a specified sub block to the be a zero matrix.

Returns
SUCCESSFUL_RETURN
returnValue BlockMatrix::setZero ( )
inline

Sets everyting to zero.

Returns
SUCCESSFUL_RETURN
BlockMatrix BlockMatrix::transpose ( ) const

Returns the transpose of the object

Definition at line 346 of file block_matrix.cpp.

Member Data Documentation

std::vector< std::vector< DMatrix > > BlockMatrix::elements
protected

Definition at line 214 of file block_matrix.hpp.

uint BlockMatrix::nCols
protected

Number of columns.

Definition at line 212 of file block_matrix.hpp.

uint BlockMatrix::nRows
protected

Number of rows.

Definition at line 211 of file block_matrix.hpp.

std::vector< std::vector< SubBlockMatrixType > > BlockMatrix::types
protected

Definition at line 215 of file block_matrix.hpp.


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:22