Template Class CMatrixFixed
Defined in File CMatrixFixed.h
Inheritance Relationships
Base Type
public mrpt::math::MatrixBase< T, CMatrixFixed< T, ROWS, COLS > >(Template Class MatrixBase)
Derived Type
public mrpt::math::CQuaternion< T >(Template Class CQuaternion)
Class Documentation
-
template<typename T, matrix_dim_t ROWS, matrix_dim_t COLS>
class CMatrixFixed : public mrpt::math::MatrixBase<T, CMatrixFixed<T, ROWS, COLS>> A compile-time fixed-size numeric matrix container. It uses a RowMajor element memory layout.
See also
CMatrixDynamic (for dynamic-size matrices)
Note
For a complete introduction to Matrices and vectors in MRPT, see: https://www.mrpt.org/Matrices_vectors_arrays_and_Linear_Algebra_MRPT_and_Eigen_classes
Subclassed by mrpt::math::CQuaternion< T >
Matrix type definitions
-
using Index = matrix_index_t
-
using size_type = matrix_dim_t
-
using difference_type = std::ptrdiff_t
-
static constexpr int is_mrpt_type = 1
Iterators interface
-
using iterator = typename vec_t::iterator
-
using const_iterator = typename vec_t::const_iterator
-
inline const_iterator begin() const
-
inline const_iterator end() const
-
inline const_iterator cbegin() const
-
inline const_iterator cend() const
Constructors, assignment operators, initializers
-
inline CMatrixFixed()
Default constructor, initializes all elements to zero
-
inline CMatrixFixed(TConstructorFlags_Matrices)
Constructor which leaves the matrix uninitialized. Example of usage: CMatrixFixed<double,3,2> M(mrpt::math::UNINITIALIZED_MATRIX);
-
template<size_t N>
inline explicit CMatrixFixed(const T (&vals)[N]) Initializes from a C array with RowMajor values
-
template<class Derived>
inline explicit CMatrixFixed(const Eigen::MatrixBase<Derived> &m) Convert from Eigen matrix
-
template<typename LHS, typename RHS, int Option>
inline explicit CMatrixFixed(const Eigen::Product<LHS, RHS, Option> &p) Convert from Eigen product
-
template<typename Op, typename Lhs, typename Rhs>
inline explicit CMatrixFixed(const Eigen::CwiseBinaryOp<Op, Lhs, Rhs> &p) Convert from Eigen binary op
-
template<typename VectorType, int Size>
inline explicit CMatrixFixed(const Eigen::VectorBlock<VectorType, Size> &m) Convert from Eigen block
-
inline CMatrixFixed(const size_type rows, const size_type cols)
Convenient ctor from size: in this class, it throws if size does not match compile-time size. It is provided for the sake of offering a uniform API with CMatrixDynamic.
-
template<class Derived>
inline CMatrixFixed &operator=(const Eigen::MatrixBase<Derived> &m) Assignment from an Eigen matrix
-
template<typename VectorType, int Size>
inline CMatrixFixed &operator=(const Eigen::VectorBlock<VectorType, Size> &m) Assignment from an Eigen vector block
-
template<typename U>
inline CMatrixFixed &operator=(const CMatrixDynamic<U> &m) Assignment from a Dynamic matrix
-
inline void loadFromRawPointer(const T *data)
Initializes from a plain buffer with RowMajor values. Unsafe, prefer loadFromArray() wherever possible, to ensure buffer length checks.
-
inline void setSize(size_type row, size_type col, [[maybe_unused]] bool zeroNewElements = false)
Throws if size does not match with the fixed matrix size
-
inline void swap(CMatrixFixed &o)
-
inline CMatrixFixed &derived()
-
inline const CMatrixFixed &derived() const
-
inline void resize(const matrix_size_t &siz, [[maybe_unused]] bool zeroNewElements = false)
Throws if size does not match with the fixed matrix size
-
inline constexpr matrix_size_t size() const
Get a 2-vector with [NROWS NCOLS] (as in MATLAB command size(x))
Matrix element access & modifiers
-
template<typename EIGEN_MATRIX = eigen_t, typename EIGEN_MAP = Eigen::Map<EIGEN_MATRIX, MRPT_MAX_STATIC_ALIGN_BYTES, Eigen::InnerStride<1>>>
inline EIGEN_MAP asEigen() Get as an Eigen-compatible Eigen::Map object
-
template<typename EIGEN_MATRIX = eigen_t, typename EIGEN_MAP = Eigen::Map<const EIGEN_MATRIX, MRPT_MAX_STATIC_ALIGN_BYTES, Eigen::InnerStride<1>>>
inline EIGEN_MAP asEigen() const
-
inline const T *data() const
Return raw pointer to row-major data buffer. All matrix cells can be assumed to be stored contiguously in memory, i.e. row stride = column count.
-
inline T *data()
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
-
inline T &operator()(Index row, Index col)
Access (row,col), without out-of-bounds check (except in Debug builds)
-
inline T &operator()(Index i)
Access the i-th element, Row-Major order, without out-of-bounds check (except in Debug builds)
-
CMatrixFixed<float, ROWS, COLS> cast_float() const
-
CMatrixFixed<double, ROWS, COLS> cast_double() const
-
CMatrixFixed<T, ROWS, 1> llt_solve(const CMatrixFixed<T, ROWS, 1> &b) const
Solves the linear system Ax=b, returns x, with A this symmetric matrix.
See also
-
CMatrixFixed<T, ROWS, 1> lu_solve(const CMatrixFixed<T, ROWS, 1> &b) const
Solves the linear system Ax=b, returns x, with A this asymmetric matrix.
See also
-
inline void sum_At(const CMatrixFixed<Scalar, ROWS, COLS> &A)
this += AT
-
using Index = matrix_index_t