ACADO Toolkit  1.2.0beta
Toolkit for Automatic Control and Dynamic Optimization
Public Member Functions | Protected Attributes

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

#include <block_matrix.hpp>

List of all members.

Public Member Functions

 BlockMatrix ()
 Default constructor.
 BlockMatrix (uint _nRows, uint _nCols)
 Constructor which takes dimensions of the block matrix.
 BlockMatrix (const Matrix &value)
 Constructor which takes ...
 BlockMatrix (const BlockMatrix &rhs)
 Copy constructor (deep copy).
virtual ~BlockMatrix ()
 Destructor.
returnValue init (uint _nRows, uint _nCols)
 Initializer.
BlockMatrixoperator= (const BlockMatrix &rhs)
 Assignment operator (deep copy).
returnValue setDense (uint rowIdx, uint colIdx, const Matrix &value)
 Set method that defines the value of a certain component.
returnValue addDense (uint rowIdx, uint colIdx, const Matrix &value)
 Add method that adds a matrix to a certain component.
returnValue getSubBlock (uint rowIdx, uint colIdx, Matrix &value) const
 Access method that returns the value of a certain component.
returnValue getSubBlock (uint rowIdx, uint colIdx, Matrix &value, uint nR, uint nC) const
 Access method that returns the value of a certain component and requiring a given dimension.
BlockMatrix operator+ (const BlockMatrix &arg) const
 Adds (element-wise) two matrices to a temporary object.
BlockMatrixoperator+= (const BlockMatrix &arg)
 Adds (element-wise) a matrix to object.
BlockMatrix operator- (const BlockMatrix &arg) const
 Subtracts (element-wise) a matrix from the object and and stores the result to a temporary object.
BlockMatrix operator*= (double scalar)
 Subtracts (element-wise) a matrix from the object.
BlockMatrix operator* (const BlockMatrix &arg) const
 Multiplies a matrix from the right to the matrix object and stores the result to a temporary object.
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.
uint getNumRows () const
 Returns number of block rows of the block matrix object.
uint getNumCols () const
 Returns number of block columns of the block matrix object.
uint getNumRows (uint rowIdx, uint colIdx) const
 Returns the number of rows of a specified sub-matrix.
uint getNumCols (uint rowIdx, uint colIdx) const
 Returns number of block columns of a specified sub-matrix.
returnValue setIdentity (uint rowIdx, uint colIdx, uint dim)
 Sets a specified sub block to the (dim x dim)-identity matrix.
returnValue setZero (uint rowIdx, uint colIdx)
 Sets a specified sub block to the be a zero matrix.
BooleanType isEmpty () const
 Returns whether the block matrix element is empty.
returnValue setZero ()
 Sets everyting to zero.
returnValue addRegularisation (uint rowIdx, uint colIdx, double eps)
 Sets all values to a given constant.
BlockMatrix addRegularisation (double eps)
 Sets everyting to zero.
BlockMatrix transpose () const
 Returns the transpose of the object.
BooleanType isSquare () const
 Tests if object is a block-square matrix.
BooleanType isSquare (uint rowIdx, uint colIdx) const
 Tests if a specified sub-matrix is a square matrix.
BlockMatrix getAbsolute () const
 Returns the a block matrix whose components are the absolute values of the components of this object.
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.
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.
returnValue print () const
 Prints object to standard ouput stream.

Protected Attributes

uint nRows
 Number of rows.
uint nCols
 Number of columns.
Matrix ** elements
SubBlockMatrixType ** types

Detailed Description

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,

Constructor & Destructor Documentation

References elements, nCols, nRows, and types.

BlockMatrix::BlockMatrix ( uint  _nRows,
uint  _nCols 
)
Parameters:
_nRowsNumber of block rows.
_nColsNumber of block columns.

References elements, nCols, nRows, SBMT_ZERO, types, and uint.

BlockMatrix::BlockMatrix ( const Matrix value)

References elements, nCols, nRows, setDense(), and types.

Parameters:
rhsRight-hand side object.

References elements, nCols, nRows, types, and uint.

References elements, nRows, types, and uint.


Member Function Documentation

returnValue BlockMatrix::addDense ( uint  rowIdx,
uint  colIdx,
const Matrix value 
)
returnValue BlockMatrix::addRegularisation ( uint  rowIdx,
uint  colIdx,
double  eps 
) [inline]
BlockMatrix BlockMatrix::addRegularisation ( double  eps) [inline]
Returns:
SUCCESSFUL_RETURN

References addRegularisation(), getNumCols(), getNumRows(), and uint.

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

References ASSERT, elements, getNumCols(), Matrix::getNumCols(), and getNumRows().

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

References ASSERT, elements, getNumCols(), getNumRows(), and Matrix::getNumRows().

BEGIN_NAMESPACE_ACADO returnValue BlockMatrix::getSubBlock ( uint  rowIdx,
uint  colIdx,
Matrix value 
) const [inline]
Returns:
SUCCESSFUL_RETURN
Parameters:
rowIdxRow index of the component.
colIdxColumn index of the component.

References ASSERT, elements, getNumCols(), getNumRows(), and SUCCESSFUL_RETURN.

Referenced by OCPiterate::applyStep(), CondensingBasedCPsolver::computeCondensingOperator(), CondensingBasedCPsolver::condense(), SCPevaluation::evaluateLagrangeGradient(), BoundaryConstraint::evaluateSensitivities(), PointConstraint::evaluateSensitivities(), CoupledPathConstraint::evaluateSensitivities(), PathConstraint::evaluateSensitivities(), MayerTerm::evaluateSensitivities(), LSQTerm::evaluateSensitivities(), AlgebraicConsistencyConstraint::evaluateSensitivities(), ShootingMethod::evaluateSensitivities(), Constraint::evaluateSensitivities(), LSQTerm::evaluateSensitivitiesGN(), LSQEndTerm::evaluateSensitivitiesGN(), ShootingMethod::evaluateSensitivitiesLifted(), CondensingBasedCPsolver::expand(), CondensingBasedCPsolver::generateBoundVectors(), CondensingBasedCPsolver::generateConstraintBlockLine(), CondensingBasedCPsolver::generateConstraintVectors(), CondensingBasedCPsolver::generateHessianBlockLine(), CondensingBasedCPsolver::generateObjectiveGradient(), CondensingBasedCPsolver::generateStateBoundBlockLine(), CondensingBasedCPsolver::generateStateBoundVectors(), SCPmethod::getAnySensitivities(), IntegrationAlgorithm::getBackwardSensitivities(), Constraint::getBackwardSensitivities(), Constraint::getConstraintResiduum(), IntegrationAlgorithm::getForwardSensitivities(), Constraint::getForwardSensitivities(), BFGSupdate::getSubBlockLine(), and BFGSupdate::setSubBlockLine().

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

References ASSERT, elements, getNumCols(), getNumRows(), Matrix::init(), SBMT_ZERO, VectorspaceElement::setZero(), SUCCESSFUL_RETURN, and types.

returnValue BlockMatrix::init ( uint  _nRows,
uint  _nCols 
)
BooleanType BlockMatrix::isEmpty ( ) const [inline]
BooleanType BlockMatrix::isSquare ( ) const [inline]
Returns:
BT_TRUE iff block matrix object is square.

References BT_FALSE, BT_TRUE, getNumCols(), and getNumRows().

BooleanType BlockMatrix::isSquare ( uint  rowIdx,
uint  colIdx 
) const [inline]
Returns:
BT_TRUE iff submatrix object is square.

References ASSERT, elements, getNumCols(), getNumRows(), and Matrix::isSquare().

BlockMatrix BlockMatrix::operator* ( const BlockMatrix arg) const
Returns:
Temporary object containing result of multiplication.
Parameters:
argBlock Matrix Factor.

References ASSERT, elements, getNumCols(), getNumRows(), SBMT_DENSE, SBMT_ONE, SBMT_ZERO, types, and uint.

BlockMatrix BlockMatrix::operator*= ( double  scalar)
Returns:
Reference to object after subtraction. Multiplies each component of the object with a given scalar.
Reference to object after multiplication.
Parameters:
scalarScalar factor.

References elements, getNumCols(), getNumRows(), SBMT_DENSE, SBMT_ZERO, types, and uint.

BlockMatrix BlockMatrix::operator+ ( const BlockMatrix arg) const
Returns:
Temporary object containing the sum of the block matrices.
Parameters:
argSecond summand.

References ASSERT, elements, getNumCols(), getNumRows(), SBMT_DENSE, SBMT_ZERO, types, and uint.

BlockMatrix & BlockMatrix::operator+= ( const BlockMatrix arg)
Returns:
Reference to object after addition.
Parameters:
argSecond summand.

References ASSERT, elements, getNumCols(), getNumRows(), SBMT_DENSE, SBMT_ZERO, types, and uint.

BlockMatrix BlockMatrix::operator- ( const BlockMatrix arg) const
Returns:
Temporary object containing the difference of the matrices.
Parameters:
argSubtrahend.

References ASSERT, elements, getNumCols(), Matrix::getNumCols(), getNumRows(), Matrix::getNumRows(), SBMT_DENSE, SBMT_ZERO, VectorspaceElement::setZero(), types, and uint.

BlockMatrix & BlockMatrix::operator= ( const BlockMatrix rhs)
Parameters:
rhsRight-hand side object.

References elements, nCols, nRows, types, and uint.

BlockMatrix BlockMatrix::operator^ ( const BlockMatrix arg) const
Returns:
Temporary object containing result of multiplication.
Parameters:
argBlock Matrix Factor.

References ASSERT, elements, getNumCols(), getNumRows(), SBMT_DENSE, SBMT_ONE, SBMT_ZERO, Matrix::transpose(), types, and uint.

returnValue BlockMatrix::setDense ( uint  rowIdx,
uint  colIdx,
const Matrix value 
)
Returns:
SUCCESSFUL_RETURN
Parameters:
rowIdxRow index of the component.
colIdxColumn index of the component.

References ASSERT, elements, getNumCols(), getNumRows(), SBMT_DENSE, SUCCESSFUL_RETURN, and types.

Referenced by addDense(), BlockMatrix(), CondensingBasedCPsolver::computeCondensingOperator(), PointConstraint::computeForwardSensitivityBlock(), AlgebraicConsistencyConstraint::computeForwardSensitivityBlock(), CondensingBasedCPsolver::condense(), BoundaryConstraint::evaluate(), PointConstraint::evaluate(), CoupledPathConstraint::evaluate(), PathConstraint::evaluate(), AlgebraicConsistencyConstraint::evaluate(), SCPevaluation::evaluateLagrangeGradient(), BoundaryConstraint::evaluateSensitivities(), PointConstraint::evaluateSensitivities(), CoupledPathConstraint::evaluateSensitivities(), PathConstraint::evaluateSensitivities(), MayerTerm::evaluateSensitivities(), LSQTerm::evaluateSensitivities(), AlgebraicConsistencyConstraint::evaluateSensitivities(), ShootingMethod::evaluateSensitivities(), LSQTerm::evaluateSensitivitiesGN(), LSQEndTerm::evaluateSensitivitiesGN(), ShootingMethod::evaluateSensitivitiesLifted(), CondensingBasedCPsolver::expand(), getAbsolute(), SCPmethod::getAnySensitivities(), Constraint::getBackwardSensitivities(), Constraint::getBoundResiduum(), Constraint::getConstraintResiduum(), Constraint::getForwardSensitivities(), getNegative(), getPositive(), DynamicDiscretization::getResiduum(), BFGSupdate::getSubBlockLine(), and BFGSupdate::setSubBlockLine().

returnValue BlockMatrix::setIdentity ( uint  rowIdx,
uint  colIdx,
uint  dim 
) [inline]
returnValue BlockMatrix::setZero ( uint  rowIdx,
uint  colIdx 
) [inline]
Returns:
SUCCESSFUL_RETURN

References getNumCols(), getNumRows(), SUCCESSFUL_RETURN, and uint.


Member Data Documentation

uint BlockMatrix::nCols [protected]
uint BlockMatrix::nRows [protected]

The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines