#include <matrix.hpp>
Public Member Functions | |
GenericMatrix | absolute () const |
GenericMatrix & | appendCols (const GenericMatrix &_arg) |
GenericMatrix & | appendRows (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< T > | getAbsolute () const |
GenericVector< T > | getCol (unsigned _idx) const |
GenericMatrix | getCols (unsigned _start, unsigned _end) const |
T | getConditionNumber () const |
GenericVector< T > | getDiag () const |
unsigned | getDim () const |
T | getMax () const |
T | getMean () const |
T | getMin () const |
T | getNorm () const |
unsigned | getNumCols () const |
unsigned | getNumRows () const |
GenericVector< T > | getRow (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 |
GenericMatrix & | makeVector () |
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) |
GenericMatrix & | setCol (unsigned _idx, const GenericVector< T > &_arg) |
GenericMatrix & | setRow (unsigned _idx, const GenericVector< T > &_values) |
GenericVector< T > | sumCol () const |
GenericVector< T > | sumRow () 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) | |
Public Member Functions inherited from Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor|Eigen::AutoAlign > | |
Index | innerStride () const |
EIGEN_STRONG_INLINE | Matrix () |
Default constructor. More... | |
Matrix (internal::constructor_without_unaligned_array_assert) | |
EIGEN_STRONG_INLINE | Matrix (Index dim) |
Constructs a vector or row-vector with given dimension. . More... | |
EIGEN_STRONG_INLINE | Matrix (const T0 &x, const T1 &y) |
EIGEN_STRONG_INLINE | Matrix (const Scalar &x, const Scalar &y, const Scalar &z) |
Constructs an initialized 3D vector with given coefficients. More... | |
EIGEN_STRONG_INLINE | Matrix (const Scalar &x, const Scalar &y, const Scalar &z, const Scalar &w) |
Constructs an initialized 4D vector with given coefficients. More... | |
Matrix (const Scalar *data) | |
EIGEN_STRONG_INLINE | Matrix (const MatrixBase< OtherDerived > &other) |
Constructor copying the value of the expression other. More... | |
EIGEN_STRONG_INLINE | Matrix (const Matrix &other) |
Copy constructor. More... | |
EIGEN_STRONG_INLINE | Matrix (const ReturnByValue< OtherDerived > &other) |
Copy constructor with in-place evaluation. More... | |
EIGEN_STRONG_INLINE | Matrix (const EigenBase< OtherDerived > &other) |
Copy constructor for generic expressions. More... | |
Matrix (const RotationBase< OtherDerived, ColsAtCompileTime > &r) | |
Constructs a Dim x Dim rotation matrix from the rotation r. More... | |
EIGEN_STRONG_INLINE Matrix & | operator= (const Matrix &other) |
Assigns matrices to each other. More... | |
EIGEN_STRONG_INLINE Matrix & | operator= (const MatrixBase< OtherDerived > &other) |
EIGEN_STRONG_INLINE Matrix & | operator= (const EigenBase< OtherDerived > &other) |
Copies the generic expression other into *this. More... | |
EIGEN_STRONG_INLINE Matrix & | operator= (const ReturnByValue< OtherDerived > &func) |
Matrix & | operator= (const RotationBase< OtherDerived, ColsAtCompileTime > &r) |
Index | outerStride () const |
void | swap (MatrixBase< OtherDerived > const &other) |
Public Member Functions inherited from Eigen::PlainObjectBase< Derived > | |
Base & | base () |
const Base & | base () const |
EIGEN_STRONG_INLINE const Scalar & | coeff (Index rowId, Index colId) const |
EIGEN_STRONG_INLINE const Scalar & | coeff (Index index) const |
EIGEN_STRONG_INLINE Scalar & | coeffRef (Index rowId, Index colId) |
EIGEN_STRONG_INLINE Scalar & | coeffRef (Index index) |
EIGEN_STRONG_INLINE const Scalar & | coeffRef (Index rowId, Index colId) const |
EIGEN_STRONG_INLINE const Scalar & | coeffRef (Index index) const |
EIGEN_STRONG_INLINE Index | cols () const |
EIGEN_STRONG_INLINE void | conservativeResize (Index nbRows, Index nbCols) |
EIGEN_STRONG_INLINE void | conservativeResize (Index nbRows, NoChange_t) |
EIGEN_STRONG_INLINE void | conservativeResize (NoChange_t, Index nbCols) |
EIGEN_STRONG_INLINE void | conservativeResize (Index size) |
template<typename OtherDerived > | |
EIGEN_STRONG_INLINE void | conservativeResizeLike (const DenseBase< OtherDerived > &other) |
EIGEN_STRONG_INLINE const Scalar * | data () const |
EIGEN_STRONG_INLINE Scalar * | data () |
template<typename OtherDerived > | |
EIGEN_STRONG_INLINE Derived & | lazyAssign (const DenseBase< OtherDerived > &other) |
EIGEN_STRONG_INLINE Derived & | operator= (const PlainObjectBase &other) |
template<typename OtherDerived > | |
EIGEN_STRONG_INLINE Derived & | operator= (const ReturnByValue< OtherDerived > &func) |
template<typename OtherDerived > | |
EIGEN_STRONG_INLINE Derived & | operator= (const EigenBase< OtherDerived > &other) |
template<int LoadMode> | |
EIGEN_STRONG_INLINE PacketScalar | packet (Index rowId, Index colId) const |
template<int LoadMode> | |
EIGEN_STRONG_INLINE PacketScalar | packet (Index index) const |
EIGEN_STRONG_INLINE | PlainObjectBase () |
PlainObjectBase (internal::constructor_without_unaligned_array_assert) | |
EIGEN_STRONG_INLINE | PlainObjectBase (Index a_size, Index nbRows, Index nbCols) |
template<typename OtherDerived > | |
EIGEN_STRONG_INLINE | PlainObjectBase (const EigenBase< OtherDerived > &other) |
EIGEN_STRONG_INLINE void | resize (Index nbRows, Index nbCols) |
void | resize (Index size) |
void | resize (NoChange_t, Index nbCols) |
void | resize (Index nbRows, NoChange_t) |
template<typename OtherDerived > | |
EIGEN_STRONG_INLINE void | resizeLike (const EigenBase< OtherDerived > &_other) |
EIGEN_STRONG_INLINE Index | rows () const |
Derived & | setConstant (Index size, const Scalar &value) |
Derived & | setConstant (Index rows, Index cols, const Scalar &value) |
Derived & | setOnes (Index size) |
Derived & | setOnes (Index rows, Index cols) |
Derived & | setRandom (Index size) |
Derived & | setRandom (Index rows, Index cols) |
Derived & | setZero (Index size) |
Derived & | setZero (Index rows, Index cols) |
template<int StoreMode> | |
EIGEN_STRONG_INLINE void | writePacket (Index rowId, Index colId, const PacketScalar &val) |
template<int StoreMode> | |
EIGEN_STRONG_INLINE void | writePacket (Index index, const PacketScalar &val) |
Additional Inherited Members | |
Static Public Member Functions inherited from Eigen::PlainObjectBase< Derived > | |
static EIGEN_STRONG_INLINE void | _check_template_params () |
static ConstMapType | Map (const Scalar *data) |
static MapType | Map (Scalar *data) |
static ConstMapType | Map (const Scalar *data, Index size) |
static MapType | Map (Scalar *data, Index size) |
static ConstMapType | Map (const Scalar *data, Index rows, Index cols) |
static MapType | Map (Scalar *data, Index rows, Index cols) |
static ConstAlignedMapType | MapAligned (const Scalar *data) |
static AlignedMapType | MapAligned (Scalar *data) |
static ConstAlignedMapType | MapAligned (const Scalar *data, Index size) |
static AlignedMapType | MapAligned (Scalar *data, Index size) |
static ConstAlignedMapType | MapAligned (const Scalar *data, Index rows, Index cols) |
static AlignedMapType | MapAligned (Scalar *data, Index rows, Index cols) |
template<int Outer, int Inner> | |
static StridedConstMapType< Stride< Outer, Inner > >::type | Map (const Scalar *data, const Stride< Outer, Inner > &stride) |
template<int Outer, int Inner> | |
static StridedMapType< Stride< Outer, Inner > >::type | Map (Scalar *data, const Stride< Outer, Inner > &stride) |
template<int Outer, int Inner> | |
static StridedConstMapType< Stride< Outer, Inner > >::type | Map (const Scalar *data, Index size, const Stride< Outer, Inner > &stride) |
template<int Outer, int Inner> | |
static StridedMapType< Stride< Outer, Inner > >::type | Map (Scalar *data, Index size, const Stride< Outer, Inner > &stride) |
template<int Outer, int Inner> | |
static StridedConstMapType< Stride< Outer, Inner > >::type | Map (const Scalar *data, Index rows, Index cols, const Stride< Outer, Inner > &stride) |
template<int Outer, int Inner> | |
static StridedMapType< Stride< Outer, Inner > >::type | Map (Scalar *data, Index rows, Index cols, const Stride< Outer, Inner > &stride) |
template<int Outer, int Inner> | |
static StridedConstAlignedMapType< Stride< Outer, Inner > >::type | MapAligned (const Scalar *data, const Stride< Outer, Inner > &stride) |
template<int Outer, int Inner> | |
static StridedAlignedMapType< Stride< Outer, Inner > >::type | MapAligned (Scalar *data, const Stride< Outer, Inner > &stride) |
template<int Outer, int Inner> | |
static StridedConstAlignedMapType< Stride< Outer, Inner > >::type | MapAligned (const Scalar *data, Index size, const Stride< Outer, Inner > &stride) |
template<int Outer, int Inner> | |
static StridedAlignedMapType< Stride< Outer, Inner > >::type | MapAligned (Scalar *data, Index size, const Stride< Outer, Inner > &stride) |
template<int Outer, int Inner> | |
static StridedConstAlignedMapType< Stride< Outer, Inner > >::type | MapAligned (const Scalar *data, Index rows, Index cols, const Stride< Outer, Inner > &stride) |
template<int Outer, int Inner> | |
static StridedAlignedMapType< Stride< Outer, Inner > >::type | MapAligned (Scalar *data, Index rows, Index cols, const Stride< Outer, Inner > &stride) |
Protected Member Functions inherited from Eigen::PlainObjectBase< Derived > | |
template<typename T0 , typename T1 > | |
EIGEN_STRONG_INLINE void | _init2 (Index nbRows, Index nbCols, typename internal::enable_if< Base::SizeAtCompileTime!=2, T0 >::type *=0) |
template<typename T0 , typename T1 > | |
EIGEN_STRONG_INLINE void | _init2 (const Scalar &val0, const Scalar &val1, typename internal::enable_if< Base::SizeAtCompileTime==2, T0 >::type *=0) |
template<typename OtherDerived > | |
EIGEN_STRONG_INLINE void | _resize_to_match (const EigenBase< OtherDerived > &other) |
template<typename OtherDerived > | |
EIGEN_STRONG_INLINE Derived & | _set (const DenseBase< OtherDerived > &other) |
Copies the value of the expression other into *this with automatic resizing. More... | |
template<typename OtherDerived > | |
EIGEN_STRONG_INLINE Derived & | _set_noalias (const DenseBase< OtherDerived > &other) |
template<typename OtherDerived > | |
EIGEN_STRONG_INLINE void | _set_selector (const OtherDerived &other, const internal::true_type &) |
template<typename OtherDerived > | |
EIGEN_STRONG_INLINE void | _set_selector (const OtherDerived &other, const internal::false_type &) |
template<typename OtherDerived > | |
void | _swap (DenseBase< OtherDerived > const &other) |
Protected Attributes inherited from Eigen::PlainObjectBase< Derived > | |
DenseStorage< Scalar, Base::MaxSizeAtCompileTime, Base::RowsAtCompileTime, Base::ColsAtCompileTime, Options > | m_storage |
A generic matrix class based on Eigen's matrix class.
Definition at line 45 of file matrix.hpp.
typedef Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor | Eigen::AutoAlign> GenericMatrix< T >::Base |
Handy typedef for the base matrix class.
Definition at line 55 of file matrix.hpp.
|
inline |
Constructor from any other Eigen::MatrixBase derived class.
Definition at line 60 of file matrix.hpp.
|
inline |
Constructor from any other Eigen::ReturnByValue derived class.
Definition at line 64 of file matrix.hpp.
|
inline |
Constructor from any other Eigen::EigenBase derived class.
Definition at line 68 of file matrix.hpp.
|
inline |
Default ctor
Definition at line 78 of file matrix.hpp.
|
inline |
Ctor with scalar initializtion.
Definition at line 81 of file matrix.hpp.
|
inline |
Ctor that accepts matrix dimensions.
Definition at line 87 of file matrix.hpp.
|
inline |
Ctor that accepts matrix dimensions and initialization data in C-like array.
Definition at line 94 of file matrix.hpp.
|
inline |
Ctor that accepts matrix dimensions and initialization data in STL 1D vector.
Definition at line 102 of file matrix.hpp.
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.
|
inlinevirtual |
Destructor.
Definition at line 117 of file matrix.hpp.
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.
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.
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.
|
inline |
Return a new vector with absolute elements.
Definition at line 305 of file matrix.hpp.
|
inline |
Returns a given column of the matrix object.
Definition at line 205 of file matrix.hpp.
|
inline |
Returns given columns of the matrix object.
Definition at line 246 of file matrix.hpp.
T GenericMatrix< T >::getConditionNumber | ( | ) | const |
Returns condition number of the square matrix based on SVD.
Definition at line 235 of file matrix.cpp.
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.
|
inline |
Returns total number of elements of the matrix object.
Definition at line 181 of file matrix.hpp.
|
inline |
Returns maximum element.
Definition at line 293 of file matrix.hpp.
|
inline |
Returns mean value of all elements.
Definition at line 301 of file matrix.hpp.
|
inline |
Returns minimum element.
Definition at line 297 of file matrix.hpp.
T GenericMatrix< T >::getNorm | ( | ) | const |
Returns Frobenius norm of the matrix.
Definition at line 227 of file matrix.cpp.
|
inline |
Returns number of columns of the matrix object.
Definition at line 189 of file matrix.hpp.
|
inline |
Returns number of rows of the matrix object.
Definition at line 185 of file matrix.hpp.
|
inline |
Returns a given row of the matrix object.
Definition at line 197 of file matrix.hpp.
|
inline |
Returns given rows of the matrix object.
Definition at line 235 of file matrix.hpp.
T GenericMatrix< T >::getTrace | ( | ) | const |
Returns trace of the matrix.
Definition at line 231 of file matrix.cpp.
|
inline |
Initialization routine.
Definition at line 135 of file matrix.hpp.
|
inline |
Returns whether the vector is empty.
Definition at line 193 of file matrix.hpp.
bool GenericMatrix< T >::isPositiveDefinite | ( | ) | const |
Tests if object is a (strictly) positive definite matrix.
Definition at line 184 of file matrix.cpp.
bool GenericMatrix< T >::isPositiveSemiDefinite | ( | ) | const |
Tests if object is a positive semi-definite matrix.
Definition at line 173 of file matrix.cpp.
bool GenericMatrix< T >::isSquare | ( | ) | const |
Is the matrix square?
Definition at line 135 of file matrix.cpp.
bool GenericMatrix< T >::isSymmetric | ( | ) | const |
Tests if object is a symmetric matrix.
Definition at line 139 of file matrix.cpp.
GenericMatrix< T > & GenericMatrix< T >::makeVector | ( | ) |
Reshapes a matrix into a column vector.
Definition at line 124 of file matrix.cpp.
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.
|
inline |
Inequality operator.
Definition at line 129 of file matrix.hpp.
|
inline |
Equality operator.
Definition at line 121 of file matrix.hpp.
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.
|
virtual |
Prints object to given file. Various settings can be specified defining its output format.
[in] | _stream | Output stream for printing. |
[in] | _name | Name label to be printed before the numerical values. |
[in] | _startString | Prefix before printing the numerical values. |
[in] | _endString | Suffix after printing the numerical values. |
[in] | _width | Total number of digits per single numerical value. |
[in] | _precision | Number of decimals per single numerical value. |
[in] | _colSeparator | Separator between the columns of the numerical values. |
[in] | _rowSeparator | Separator between the rows of the numerical values. |
Definition at line 254 of file matrix.cpp.
|
virtual |
Prints object to given file. Various settings can be specified defining its output format.
[in] | _stream | Output stream for printing. |
[in] | _name | Name label to be printed before the numerical values. |
[in] | _printScheme | Print scheme defining the output format of the information. |
Definition at line 332 of file matrix.cpp.
|
virtual |
Prints object to file with given name. Various settings can be specified defining its output format.
[in] | _filename | Filename for printing. |
[in] | _name | Name label to be printed before the numerical values. |
[in] | _startString | Prefix before printing the numerical values. |
[in] | _endString | Suffix after printing the numerical values. |
[in] | _width | Total number of digits per single numerical value. |
[in] | _precision | Number of decimals per single numerical value. |
[in] | _colSeparator | Separator between the columns of the numerical values. |
[in] | _rowSeparator | Separator between the rows of the numerical values. |
Definition at line 376 of file matrix.cpp.
|
virtual |
Prints object to given file. Various settings can be specified defining its output format.
[in] | _filename | Filename for printing. |
[in] | _name | Name label to be printed before the numerical values. |
[in] | _printScheme | Print scheme defining the output format of the information. |
Definition at line 400 of file matrix.cpp.
|
virtual |
Read matrix data from an input stream.
Definition at line 419 of file matrix.cpp.
|
virtual |
Read data from an input file.
Definition at line 443 of file matrix.cpp.
|
inline |
Set all elements constant.
Definition at line 141 of file matrix.hpp.
|
inline |
Assigns new values to a given column of the matrix object.
Definition at line 224 of file matrix.hpp.
|
inline |
Assigns new values to a given row of the matrix object.
Definition at line 213 of file matrix.hpp.
GenericVector< T > GenericMatrix< T >::sumCol | ( | ) | const |
Computes the column-wise sum the DMatrix
Example:
returns [a+b;c+d]
Definition at line 104 of file matrix.cpp.
GenericVector< T > GenericMatrix< T >::sumRow | ( | ) | const |
Computes the row-wise sum the DMatrix
Example:
returns [a+c|b+d]
Definition at line 114 of file matrix.cpp.
returnValue GenericMatrix< T >::symmetrize | ( | ) |
Make the matrix symmetric.
Definition at line 156 of file matrix.cpp.