Template Class MatrixBase
Defined in File MatrixBase.h
Inheritance Relationships
Base Type
public mrpt::math::MatrixVectorBase< Scalar, Derived >(Template Class MatrixVectorBase)
Derived Types
public mrpt::math::CMatrixDynamic< NUMTYPE >(Template Class CMatrixDynamic)public mrpt::math::CMatrixDynamic< double >(Template Class CMatrixDynamic)public mrpt::math::CMatrixDynamic< mrpt::math::TPoint3D_data< double > >(Template Class CMatrixDynamic)public mrpt::math::CMatrixFixed< double, DIM, DIM >(Template Class CMatrixFixed)public mrpt::math::CMatrixFixed< 2 >(Template Class CMatrixFixed)public mrpt::math::CMatrixFixed< 3 >(Template Class CMatrixFixed)
Class Documentation
-
template<typename Scalar, class Derived>
class MatrixBase : public mrpt::math::MatrixVectorBase<Scalar, Derived> Base CRTP class for all MRPT matrices.
See MatrixVectorBase
See also
Subclassed by mrpt::math::CMatrixDynamic< NUMTYPE >, mrpt::math::CMatrixDynamic< double >, mrpt::math::CMatrixDynamic< mrpt::math::TPoint3D_data< double > >, mrpt::math::CMatrixFixed< double, DIM, DIM >, mrpt::math::CMatrixFixed< 2 >, mrpt::math::CMatrixFixed< 3 >
Operations that DO require <tt>\#include \<Eigen/Dense\></tt> in user code
-
template<typename VectorLike>
inline void extractRow(Index_t rowIdx, VectorLike &v) const
-
template<typename VectorLike>
inline VectorLike extractRow(Index_t rowIdx) const
-
template<typename VectorLike>
inline void extractColumn(Index_t colIdx, VectorLike &v) const
-
template<typename VectorLike>
inline VectorLike extractColumn(Index_t colIdx) const
Standalone operations (do NOT require <tt>\#include \<Eigen/Dense\></tt>)
-
matrix_dim_t rank(Scalar threshold = 0) const
Finds the rank of the matrix via LU decomposition. Uses Eigen’s default threshold unless
threshold>0.
-
bool chol(Derived &U) const
Cholesky M=UT * U decomposition for symmetric matrix (upper-half of the matrix is actually ignored.
- Returns:
false if Cholesky fails
-
bool eig(Derived &eVecs, std::vector<Scalar> &eVals, bool sorted = true) const
Computes the eigenvectors and eigenvalues for a square, general matrix. Use eig_symmetric() for symmetric matrices for better accuracy and performance. Eigenvectors are the columns of the returned matrix, and their order matches that of returned eigenvalues.
- Parameters:
sorted – [in] If true, eigenvalues (and eigenvectors) will be sorted in ascending order.
eVecs – [out] The container where eigenvectors will be stored.
eVals – [out] The container where eigenvalues will be stored.
- Returns:
false if eigenvalues could not be determined.
-
bool eig_symmetric(Derived &eVecs, std::vector<Scalar> &eVals, bool sorted = true) const
Read: eig()
Note
This only uses the lower-triangular part of the matrix
Note
(Since MRPT 2.5.2) If sorted==true, the smallest eigenvalue is checked to be non-negative, and resetted to zero if found to be negative due to rounding errors in the internal Eigen3 routines.
-
void unsafeRemoveColumns(const std::vector<std::size_t> &idxs)
Removes columns of the matrix. This “unsafe” version assumes indices sorted in ascending order.
-
void removeColumns(const std::vector<std::size_t> &idxsToRemove)
Removes columns of the matrix. Indices may be unsorted and duplicated
-
void unsafeRemoveRows(const std::vector<std::size_t> &idxs)
Removes rows of the matrix. This “unsafe” version assumes indices sorted in ascending order.
-
void removeRows(const std::vector<std::size_t> &idxsToRemove)
Removes rows of the matrix. Indices may be unsorted and duplicated
-
template<typename OtherMatrixOrVector>
inline void insertMatrix(const Index_t row_start, const Index_t col_start, const OtherMatrixOrVector &submat) Copies the given input submatrix/vector into this matrix/vector, starting at the given top-left coordinates.
-
template<typename OtherMatrixOrVector>
inline void insertMatrixTransposed(const Index_t row_start, const Index_t col_start, const OtherMatrixOrVector &submat) Like insertMatrix(), but inserts submat` (transposed)
-
template<size_type_t BLOCK_ROWS, size_type_t BLOCK_COLS>
inline CMatrixFixed<Scalar, BLOCK_ROWS, BLOCK_COLS> blockCopy(Index_t start_row = 0, Index_t start_col = 0) const const blockCopy(): Returns a copy of the given block
-
inline CMatrixDynamic<Scalar> blockCopy(Index_t start_row, Index_t start_col, size_type_t BLOCK_ROWS, size_type_t BLOCK_COLS) const
const blockCopy(): Returns a copy of the given block (non templated version, dynamic sizes)
-
template<size_type_t BLOCK_ROWS, size_type_t BLOCK_COLS>
inline CMatrixFixed<Scalar, BLOCK_ROWS, BLOCK_COLS> extractMatrix(const Index_t start_row = 0, const Index_t start_col = 0) const
-
inline CMatrixDynamic<Scalar> extractMatrix(const size_type_t BLOCK_ROWS, const size_type_t BLOCK_COLS, const Index_t start_row, const Index_t start_col) const
Public Functions
-
inline void setDiagonal(const size_type_t N, const Scalar value)
Resize to NxN, set all entries to zero, except the main diagonal which is set to
value
-
inline void setDiagonal(const Scalar value)
Set all entries to zero, except the main diagonal which is set to
value
-
inline void setDiagonal(const std::vector<Scalar> &diags)
Resizes to NxN, with N the length of the input vector, set all entries to zero, except the main diagonal which is set to values in the vector.
-
inline void setIdentity()
-
inline void setIdentity(const size_type_t N)
Public Static Functions
-
static inline Derived Identity(const size_type_t N)
-
template<typename VectorLike>