Public Types | Public Member Functions
GenericMatrix< T > Class Template Reference

#include <matrix.hpp>

Inheritance diagram for GenericMatrix< T >:
Inheritance graph
[legend]

List of all members.

Public Types

typedef Eigen::Matrix< T,
Eigen::Dynamic, Eigen::Dynamic,
Eigen::RowMajor|Eigen::AutoAlign
Base

Public Member Functions

GenericMatrix absolute () const
GenericMatrixappendCols (const GenericMatrix &_arg)
GenericMatrixappendRows (const GenericMatrix &_arg)
template<typename OtherDerived >
 GenericMatrix (const Eigen::MatrixBase< OtherDerived > &other)
template<typename OtherDerived >
 GenericMatrix (const Eigen::ReturnByValue< OtherDerived > &other)
template<typename OtherDerived >
 GenericMatrix (const Eigen::EigenBase< OtherDerived > &other)
GenericMatrix< TgetAbsolute () const
GenericVector< TgetCol (unsigned _idx) const
GenericMatrix getCols (unsigned _start, unsigned _end) const
T getConditionNumber () const
GenericVector< TgetDiag () const
unsigned getDim () const
T getMax () const
T getMean () const
T getMin () const
T getNorm () const
unsigned getNumCols () const
unsigned getNumRows () const
GenericVector< TgetRow (unsigned _idx) const
GenericMatrix getRows (unsigned _start, unsigned _end) const
T getTrace () const
void init (unsigned _nRows=0, unsigned _nCols=0)
bool isEmpty () const
bool isPositiveDefinite () const
bool isPositiveSemiDefinite () const
bool isSquare () const
bool isSymmetric () const
GenericMatrixmakeVector ()
GenericMatrix negative () const
bool operator!= (const GenericMatrix &arg) const
bool operator== (const GenericMatrix &arg) const
GenericMatrix positive () const
virtual returnValue print (std::ostream &_stream=std::cout, const std::string &_name=DEFAULT_LABEL, const std::string &_startString=DEFAULT_START_STRING, const std::string &_endString=DEFAULT_END_STRING, uint _width=DEFAULT_WIDTH, uint _precision=DEFAULT_PRECISION, const std::string &_colSeparator=DEFAULT_COL_SEPARATOR, const std::string &_rowSeparator=DEFAULT_ROW_SEPARATOR) const
virtual returnValue print (std::ostream &stream, const std::string &name, PrintScheme printScheme) const
virtual returnValue print (const std::string &_filename, const std::string &_name=DEFAULT_LABEL, const std::string &_startString=DEFAULT_START_STRING, const std::string &_endString=DEFAULT_END_STRING, uint _width=DEFAULT_WIDTH, uint _precision=DEFAULT_PRECISION, const std::string &_colSeparator=DEFAULT_COL_SEPARATOR, const std::string &_rowSeparator=DEFAULT_ROW_SEPARATOR) const
virtual returnValue print (const std::string &_filename, const std::string &_name, PrintScheme _printScheme) const
virtual returnValue read (std::istream &_stream)
virtual returnValue read (const std::string &_filename)
void setAll (const T &_value)
GenericMatrixsetCol (unsigned _idx, const GenericVector< T > &_arg)
GenericMatrixsetRow (unsigned _idx, const GenericVector< T > &_values)
GenericVector< TsumCol () const
GenericVector< TsumRow () const
returnValue symmetrize ()
virtual ~GenericMatrix ()
Constructors.
 GenericMatrix ()
 GenericMatrix (const T &_value)
 GenericMatrix (unsigned _nRows, unsigned _nCols)
 GenericMatrix (unsigned _nRows, unsigned _nCols, const T *const _values)
 GenericMatrix (unsigned _nRows, unsigned _nCols, std::vector< T > &_values)
 GenericMatrix (unsigned _nRows, unsigned _nCols, std::vector< std::vector< T > > &_values)

Detailed Description

template<typename T>
class GenericMatrix< T >

A generic matrix class based on Eigen's matrix class.

Definition at line 49 of file matrix.hpp.


Member Typedef Documentation

Handy typedef for the base matrix class.

Reimplemented from Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor|Eigen::AutoAlign >.

Definition at line 59 of file matrix.hpp.


Constructor & Destructor Documentation

template<typename T>
template<typename OtherDerived >
GenericMatrix< T >::GenericMatrix ( const Eigen::MatrixBase< OtherDerived > &  other) [inline]

Constructor from any other Eigen::MatrixBase derived class.

Definition at line 64 of file matrix.hpp.

template<typename T>
template<typename OtherDerived >
GenericMatrix< T >::GenericMatrix ( const Eigen::ReturnByValue< OtherDerived > &  other) [inline]

Constructor from any other Eigen::ReturnByValue derived class.

Definition at line 68 of file matrix.hpp.

template<typename T>
template<typename OtherDerived >
GenericMatrix< T >::GenericMatrix ( const Eigen::EigenBase< OtherDerived > &  other) [inline]

Constructor from any other Eigen::EigenBase derived class.

Definition at line 72 of file matrix.hpp.

template<typename T>
GenericMatrix< T >::GenericMatrix ( ) [inline]

Default ctor

Definition at line 82 of file matrix.hpp.

template<typename T>
GenericMatrix< T >::GenericMatrix ( const T _value) [inline]

Ctor with scalar initializtion.

Definition at line 85 of file matrix.hpp.

template<typename T>
GenericMatrix< T >::GenericMatrix ( unsigned  _nRows,
unsigned  _nCols 
) [inline]

Ctor that accepts matrix dimensions.

Definition at line 91 of file matrix.hpp.

template<typename T>
GenericMatrix< T >::GenericMatrix ( unsigned  _nRows,
unsigned  _nCols,
const T *const  _values 
) [inline]

Ctor that accepts matrix dimensions and initialization data in C-like array.

Definition at line 98 of file matrix.hpp.

template<typename T>
GenericMatrix< T >::GenericMatrix ( unsigned  _nRows,
unsigned  _nCols,
std::vector< T > &  _values 
) [inline]

Ctor that accepts matrix dimensions and initialization data in STL 1D vector.

Definition at line 106 of file matrix.hpp.

template<typename T>
BEGIN_NAMESPACE_ACADO GenericMatrix< T >::GenericMatrix ( unsigned  _nRows,
unsigned  _nCols,
std::vector< std::vector< T > > &  _values 
)

Ctor that accepts matrix dimensions and initialization data in STL 2D array.

Definition at line 42 of file matrix.cpp.

template<typename T>
virtual GenericMatrix< T >::~GenericMatrix ( ) [inline, virtual]

Destructor.

Definition at line 121 of file matrix.hpp.


Member Function Documentation

template<typename T >
GenericMatrix< T > GenericMatrix< T >::absolute ( ) const

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

Definition at line 193 of file matrix.cpp.

template<typename T >
GenericMatrix< T > & GenericMatrix< T >::appendCols ( const GenericMatrix< T > &  _arg)

Appends columns at the end of the matrix.

Definition at line 83 of file matrix.cpp.

template<typename T >
GenericMatrix< T > & GenericMatrix< T >::appendRows ( const GenericMatrix< T > &  _arg)

Appends rows at the end of the matrix.

Definition at line 62 of file matrix.cpp.

template<typename T>
GenericMatrix< T > GenericMatrix< T >::getAbsolute ( ) const [inline]

Return a new vector with absolute elements.

Definition at line 309 of file matrix.hpp.

template<typename T>
GenericVector< T > GenericMatrix< T >::getCol ( unsigned  _idx) const [inline]

Returns a given column of the matrix object.

Definition at line 209 of file matrix.hpp.

template<typename T>
GenericMatrix GenericMatrix< T >::getCols ( unsigned  _start,
unsigned  _end 
) const [inline]

Returns given columns of the matrix object.

Definition at line 250 of file matrix.hpp.

template<typename T >
T GenericMatrix< T >::getConditionNumber ( ) const

Returns condition number of the square matrix based on SVD.

Note:
Works for square matrices, only.

Definition at line 235 of file matrix.cpp.

template<typename T >
GenericVector< T > GenericMatrix< T >::getDiag ( ) const

Returns a vector containing the diagonal elements of a square matrix.

Definition at line 131 of file matrix.cpp.

template<typename T>
unsigned GenericMatrix< T >::getDim ( ) const [inline]

Returns total number of elements of the matrix object.

Definition at line 185 of file matrix.hpp.

template<typename T>
T GenericMatrix< T >::getMax ( ) const [inline]

Returns maximum element.

Definition at line 297 of file matrix.hpp.

template<typename T>
T GenericMatrix< T >::getMean ( ) const [inline]

Returns mean value of all elements.

Definition at line 305 of file matrix.hpp.

template<typename T>
T GenericMatrix< T >::getMin ( ) const [inline]

Returns minimum element.

Definition at line 301 of file matrix.hpp.

template<typename T >
T GenericMatrix< T >::getNorm ( ) const

Returns Frobenius norm of the matrix.

Definition at line 227 of file matrix.cpp.

template<typename T>
unsigned GenericMatrix< T >::getNumCols ( ) const [inline]

Returns number of columns of the matrix object.

Definition at line 193 of file matrix.hpp.

template<typename T>
unsigned GenericMatrix< T >::getNumRows ( ) const [inline]

Returns number of rows of the matrix object.

Definition at line 189 of file matrix.hpp.

template<typename T>
GenericVector< T > GenericMatrix< T >::getRow ( unsigned  _idx) const [inline]

Returns a given row of the matrix object.

Definition at line 201 of file matrix.hpp.

template<typename T>
GenericMatrix GenericMatrix< T >::getRows ( unsigned  _start,
unsigned  _end 
) const [inline]

Returns given rows of the matrix object.

Definition at line 239 of file matrix.hpp.

template<typename T >
T GenericMatrix< T >::getTrace ( ) const

Returns trace of the matrix.

Definition at line 231 of file matrix.cpp.

template<typename T>
void GenericMatrix< T >::init ( unsigned  _nRows = 0,
unsigned  _nCols = 0 
) [inline]

Initialization routine.

Definition at line 139 of file matrix.hpp.

template<typename T>
bool GenericMatrix< T >::isEmpty ( ) const [inline]

Returns whether the vector is empty.

Definition at line 197 of file matrix.hpp.

template<typename T >
bool GenericMatrix< T >::isPositiveDefinite ( ) const

Tests if object is a (strictly) positive definite matrix.

Note:
This test involves a Cholesky decomposition.

Definition at line 184 of file matrix.cpp.

template<typename T >
bool GenericMatrix< T >::isPositiveSemiDefinite ( ) const

Tests if object is a positive semi-definite matrix.

Note:
This test involves a Cholesky decomposition.

Definition at line 173 of file matrix.cpp.

template<typename T >
bool GenericMatrix< T >::isSquare ( ) const

Is the matrix square?

Definition at line 135 of file matrix.cpp.

template<typename T >
bool GenericMatrix< T >::isSymmetric ( ) const

Tests if object is a symmetric matrix.

Definition at line 139 of file matrix.cpp.

template<typename T >
GenericMatrix< T > & GenericMatrix< T >::makeVector ( )

Reshapes a matrix into a column vector.

Definition at line 124 of file matrix.cpp.

template<typename T >
GenericMatrix< T > GenericMatrix< T >::negative ( ) const

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

Definition at line 212 of file matrix.cpp.

template<typename T>
bool GenericMatrix< T >::operator!= ( const GenericMatrix< T > &  arg) const [inline]

Inequality operator.

Definition at line 133 of file matrix.hpp.

template<typename T>
bool GenericMatrix< T >::operator== ( const GenericMatrix< T > &  arg) const [inline]

Equality operator.

Definition at line 125 of file matrix.hpp.

template<typename T >
GenericMatrix< T > GenericMatrix< T >::positive ( ) const

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

Definition at line 197 of file matrix.cpp.

template<typename T >
returnValue GenericMatrix< T >::print ( std::ostream &  _stream = std::cout,
const std::string &  _name = DEFAULT_LABEL,
const std::string &  _startString = DEFAULT_START_STRING,
const std::string &  _endString = DEFAULT_END_STRING,
uint  _width = DEFAULT_WIDTH,
uint  _precision = DEFAULT_PRECISION,
const std::string &  _colSeparator = DEFAULT_COL_SEPARATOR,
const std::string &  _rowSeparator = DEFAULT_ROW_SEPARATOR 
) const [virtual]

Prints object to given file. Various settings can be specified defining its output format.

Parameters:
[in]_streamOutput stream for printing.
[in]_nameName label to be printed before the numerical values.
[in]_startStringPrefix before printing the numerical values.
[in]_endStringSuffix after printing the numerical values.
[in]_widthTotal number of digits per single numerical value.
[in]_precisionNumber of decimals per single numerical value.
[in]_colSeparatorSeparator between the columns of the numerical values.
[in]_rowSeparatorSeparator between the rows of the numerical values.
Returns:
SUCCESSFUL_RETURN,
RET_FILE_CAN_NOT_BE_OPENED,
RET_UNKNOWN_BUG

Definition at line 254 of file matrix.cpp.

template<typename T >
returnValue GenericMatrix< T >::print ( std::ostream &  stream,
const std::string &  name,
PrintScheme  printScheme 
) const [virtual]

Prints object to given file. Various settings can be specified defining its output format.

Parameters:
[in]_streamOutput stream for printing.
[in]_nameName label to be printed before the numerical values.
[in]_printSchemePrint scheme defining the output format of the information.
Returns:
SUCCESSFUL_RETURN,
RET_FILE_CAN_NOT_BE_OPENED,
RET_UNKNOWN_BUG

Definition at line 332 of file matrix.cpp.

template<typename T >
returnValue GenericMatrix< T >::print ( const std::string &  _filename,
const std::string &  _name = DEFAULT_LABEL,
const std::string &  _startString = DEFAULT_START_STRING,
const std::string &  _endString = DEFAULT_END_STRING,
uint  _width = DEFAULT_WIDTH,
uint  _precision = DEFAULT_PRECISION,
const std::string &  _colSeparator = DEFAULT_COL_SEPARATOR,
const std::string &  _rowSeparator = DEFAULT_ROW_SEPARATOR 
) const [virtual]

Prints object to file with given name. Various settings can be specified defining its output format.

Parameters:
[in]_filenameFilename for printing.
[in]_nameName label to be printed before the numerical values.
[in]_startStringPrefix before printing the numerical values.
[in]_endStringSuffix after printing the numerical values.
[in]_widthTotal number of digits per single numerical value.
[in]_precisionNumber of decimals per single numerical value.
[in]_colSeparatorSeparator between the columns of the numerical values.
[in]_rowSeparatorSeparator between the rows of the numerical values.
Returns:
SUCCESSFUL_RETURN,
RET_FILE_CAN_NOT_BE_OPENED,
RET_UNKNOWN_BUG

Definition at line 376 of file matrix.cpp.

template<typename T >
returnValue GenericMatrix< T >::print ( const std::string &  _filename,
const std::string &  _name,
PrintScheme  _printScheme 
) const [virtual]

Prints object to given file. Various settings can be specified defining its output format.

Parameters:
[in]_filenameFilename for printing.
[in]_nameName label to be printed before the numerical values.
[in]_printSchemePrint scheme defining the output format of the information.
Returns:
SUCCESSFUL_RETURN,
RET_FILE_CAN_NOT_BE_OPENED,
RET_UNKNOWN_BUG

Definition at line 400 of file matrix.cpp.

template<typename T >
returnValue GenericMatrix< T >::read ( std::istream &  _stream) [virtual]

Read matrix data from an input stream.

Definition at line 419 of file matrix.cpp.

template<typename T >
returnValue GenericMatrix< T >::read ( const std::string &  _filename) [virtual]

Read data from an input file.

Definition at line 443 of file matrix.cpp.

template<typename T>
void GenericMatrix< T >::setAll ( const T _value) [inline]

Set all elements constant.

Definition at line 145 of file matrix.hpp.

template<typename T>
GenericMatrix& GenericMatrix< T >::setCol ( unsigned  _idx,
const GenericVector< T > &  _arg 
) [inline]

Assigns new values to a given column of the matrix object.

Definition at line 228 of file matrix.hpp.

template<typename T>
GenericMatrix& GenericMatrix< T >::setRow ( unsigned  _idx,
const GenericVector< T > &  _values 
) [inline]

Assigns new values to a given row of the matrix object.

Definition at line 217 of file matrix.hpp.

template<typename T >
GenericVector< T > GenericMatrix< T >::sumCol ( ) const

Computes the column-wise sum the DMatrix

Example:

  a   |  b
  c   |  d

returns [a+b;c+d]

Definition at line 104 of file matrix.cpp.

template<typename T >
GenericVector< T > GenericMatrix< T >::sumRow ( ) const

Computes the row-wise sum the DMatrix

Example:

  a   |  b
  c   |  d

returns [a+c|b+d]

Definition at line 114 of file matrix.cpp.

template<typename T >
returnValue GenericMatrix< T >::symmetrize ( )

Make the matrix symmetric.

Definition at line 156 of file matrix.cpp.


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


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Sat Jun 8 2019 19:40:24