Implements a very rudimentary block sparse matrix class. More...
#include <block_matrix.hpp>
Protected Attributes | |
std::vector< std::vector< DMatrix > > | elements |
uint | nCols |
uint | nRows |
std::vector< std::vector< SubBlockMatrixType > > | types |
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.
BEGIN_NAMESPACE_ACADO BlockMatrix::BlockMatrix | ( | ) |
Default constructor.
Definition at line 43 of file block_matrix.cpp.
Constructor which takes dimensions of the block matrix.
_nRows | Number of block rows. |
_nCols | Number 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.
|
virtual |
Destructor.
Definition at line 62 of file block_matrix.cpp.
returnValue BlockMatrix::addDense | ( | uint | rowIdx, |
uint | colIdx, | ||
const DMatrix & | value | ||
) |
Add method that adds a matrix to a certain component.
rowIdx | Row index of the component. |
colIdx | Column index of the component. |
Definition at line 458 of file block_matrix.cpp.
|
inline |
Sets all values to a given constant.
|
inline |
Sets everyting to zero.
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.
|
inline |
Returns number of block columns of the block matrix object.
Returns number of block columns of a specified sub-matrix.
|
inline |
Returns number of block rows of the block matrix object.
Returns the number of rows of a specified sub-matrix.
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.
|
inline |
Access method that returns the value of a certain component.
rowIdx | Row index of the component. |
colIdx | Column 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.
rowIdx | Row index of the component. |
colIdx | Column 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.
|
inline |
Returns whether the block matrix element is empty.
|
inline |
Tests if object is a block-square matrix.
Tests if a specified sub-matrix is a square matrix.
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.
arg | Block 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.
scalar | Scalar 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.
arg | Second summand. |
Definition at line 82 of file block_matrix.cpp.
BlockMatrix & BlockMatrix::operator+= | ( | const BlockMatrix & | arg | ) |
Adds (element-wise) a matrix to object.
arg | Second 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.
arg | Subtrahend. |
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.
arg | Block 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.
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.
rowIdx | Row index of the component. |
colIdx | Column index of the component. |
Definition at line 446 of file block_matrix.cpp.
|
inline |
Sets a specified sub block to the (dim x dim)-identity matrix.
rowIdx | row index of the sub block |
colIdx | column index of the sub block |
dim | dimension of the sub block |
|
inline |
Sets a specified sub block to the be a zero matrix.
|
inline |
Sets everyting to zero.
BlockMatrix BlockMatrix::transpose | ( | ) | const |
Returns the transpose of the object
Definition at line 346 of file block_matrix.cpp.
|
protected |
Definition at line 214 of file block_matrix.hpp.
|
protected |
Number of columns.
Definition at line 212 of file block_matrix.hpp.
|
protected |
Number of rows.
Definition at line 211 of file block_matrix.hpp.
|
protected |
Definition at line 215 of file block_matrix.hpp.