class mrpt::math::CMatrixF
Overview
This class is a “CSerializable” wrapper for “CMatrixFloat”.
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
#include <mrpt/math/CMatrixF.h> class CMatrixF: public mrpt::serialization::CSerializable, public mrpt::math::CMatrixDynamic { public: // typedefs typedef std::shared_ptr<mrpt::math ::CMatrixF> Ptr; typedef std::shared_ptr<const mrpt::math ::CMatrixF> ConstPtr; typedef std::unique_ptr<mrpt::math ::CMatrixF> UniquePtr; typedef std::unique_ptr<const mrpt::math ::CMatrixF> ConstUniquePtr; typedef T Scalar; typedef matrix_index_t Index; typedef T& reference; typedef const T& const_reference; typedef matrix_dim_t size_type; typedef std::ptrdiff_t difference_type; typedef Eigen::Matrix<T, RowsAtCompileTime, ColsAtCompileTime, StorageOrder, RowsAtCompileTime, ColsAtCompileTime> eigen_t; typedef typename vec_t::iterator iterator; typedef typename vec_t::const_iterator const_iterator; // fields static constexpr const char* className = "mrpt::math" "::" "CMatrixF"; static constexpr static int RowsAtCompileTime = -1; static constexpr static int ColsAtCompileTime = -1; static constexpr static int SizeAtCompileTime = -1; static constexpr static int is_mrpt_type = 1; static constexpr static int StorageOrder = 1; // construction CMatrixF(); CMatrixF(matrix_dim_t row, matrix_dim_t col); CMatrixF(const CMatrixFloat& m); CMatrixF(const CMatrixDynamic<double>& m); template <typename OtherDerived> CMatrixF(const Eigen::MatrixBase<OtherDerived>& other); // methods static constexpr auto getClassName(); static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic(); static std::shared_ptr<CObject> CreateObject(); template <typename... Args> static Ptr Create(Args&&... args); template <typename Alloc, typename... Args> static Ptr CreateAlloc( const Alloc& alloc, Args&&... args ); template <typename... Args> static UniquePtr CreateUnique(Args&&... args); virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const; virtual mrpt::rtti::CObject* clone() const; iterator begin(); const_iterator begin() const; iterator end(); const_iterator end() const; const_iterator cbegin() const; const_iterator cend() const; template <class OTHERMAT> CMatrixF& operator = (const OTHERMAT& m); template <typename OtherDerived> CMatrixF& operator = (const Eigen::MatrixBase<OtherDerived>& other); template <class MAT> void setFromMatrixLike(const MAT& m); void resize( size_type row, size_type col ); CMatrixDynamic& derived(); const CMatrixDynamic& derived() const; void conservativeResize( size_type row, size_type col ); template <typename VECTOR> void setRow( const Index row, const VECTOR& v ); template <typename VECTOR> void setCol( const Index col, const VECTOR& v ); template < typename EIGEN_MATRIX = eigen_t, typename EIGEN_MAP = Eigen::Map<const EIGEN_MATRIX, MRPT_MAX_ALIGN_BYTES, Eigen::InnerStride<1>> > EIGEN_MAP asEigen() const; CMatrixDynamic<float> cast_float() const; CMatrixDynamic<double> cast_double() const; };
Inherited Members
public: // typedefs typedef std::shared_ptr<CObject> Ptr; typedef std::shared_ptr<const CObject> ConstPtr; typedef std::shared_ptr<CSerializable> Ptr; typedef std::shared_ptr<const CSerializable> ConstPtr; typedef matrix_index_t Index_t; typedef matrix_dim_t size_type_t; // methods static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic(); virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const; virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const; static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic(); void setConstant(const Scalar value); void setConstant(matrix_dim_t nrows, matrix_dim_t ncols, const Scalar value); void setConstant(matrix_dim_t nrows, const Scalar value); void assign(const matrix_dim_t N, const Scalar value); void setZero(); void setZero(matrix_dim_t nrows, matrix_dim_t ncols); void setZero(matrix_dim_t nrows); static Derived Constant(const Scalar value); static Derived Constant(matrix_dim_t nrows, matrix_dim_t ncols, const Scalar value); static Derived Zero(); static Derived Zero(matrix_dim_t nrows, matrix_dim_t ncols); auto block(matrix_index_t start_row, matrix_index_t start_col, matrix_dim_t BLOCK_ROWS, matrix_dim_t BLOCK_COLS); auto block(matrix_index_t start_row, matrix_index_t start_col, matrix_dim_t BLOCK_ROWS, matrix_dim_t BLOCK_COLS) const; auto transpose(); auto transpose() const; auto array(); auto array() const; auto operator - () const; template <typename S2, class D2> auto operator + (const MatrixVectorBase<S2, D2>& m2) const; template <typename S2, class D2> void operator += (const MatrixVectorBase<S2, D2>& m2); template <typename S2, class D2> auto operator - (const MatrixVectorBase<S2, D2>& m2) const; template <typename S2, class D2> void operator -= (const MatrixVectorBase<S2, D2>& m2); template <typename S2, class D2> auto operator * (const MatrixVectorBase<S2, D2>& m2) const; auto operator * (const Scalar s) const; template <matrix_dim_t N> CMatrixFixed<Scalar, N, 1> tail() const; template <matrix_dim_t N> CMatrixFixed<Scalar, N, 1> head() const; Scalar& coeffRef(matrix_index_t r, matrix_index_t c); const Scalar& coeff(matrix_index_t r, matrix_index_t c) const; Scalar minCoeff(matrix_index_t& outIndexOfMin) const; Scalar minCoeff(matrix_index_t& rowIdx, matrix_index_t& colIdx) const; Scalar maxCoeff(matrix_index_t& outIndexOfMax) const; Scalar maxCoeff(matrix_index_t& rowIdx, matrix_index_t& colIdx) const; void operator += (Scalar s); void operator -= (Scalar s); void operator *= (Scalar s); CMatrixDynamic<Scalar> operator * (const CMatrixDynamic<Scalar>& v); Derived operator + (const Derived& m2) const; void operator += (const Derived& m2); Derived operator - (const Derived& m2) const; void operator -= (const Derived& m2); Derived operator * (const Derived& m2) const; Scalar dot(const MatrixVectorBase<Scalar, Derived>& v) const; template <typename OTHERMATVEC> bool operator == (const OTHERMATVEC& o) const; template <typename OTHERMATVEC> bool operator != (const OTHERMATVEC& o) const; Derived& mvbDerived(); const Derived& mvbDerived() const; auto col(Index_t colIdx); auto col(Index_t colIdx) const; auto row(Index_t rowIdx); auto row(Index_t rowIdx) const; template <typename VectorLike> void extractRow(Index_t rowIdx, VectorLike& v) const; template <typename VectorLike> VectorLike extractRow(Index_t rowIdx) const; template <typename VectorLike> void extractColumn(Index_t colIdx, VectorLike& v) const; template <typename VectorLike> VectorLike extractColumn(Index_t colIdx) const; template <size_type_t BLOCK_ROWS, size_type_t BLOCK_COLS> CMatrixFixed<Scalar, BLOCK_ROWS, BLOCK_COLS> extractMatrix( const Index_t start_row = 0, const Index_t start_col = 0 ) const; 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; Derived& mbDerived(); const Derived& mbDerived() const; void setIdentity(); void setIdentity(const size_type_t N); static Derived Identity(); static Derived Identity(const size_type_t N); CMatrixDynamic& operator = (const CMatrixDynamic<T>& m); template <typename U> CMatrixDynamic& operator = (const CMatrixDynamic<U>& m); template <class Derived> CMatrixDynamic& operator = (const Eigen::MatrixBase<Derived>& m); template <size_type ROWS, size_type COLS> CMatrixDynamic& operator = (const CMatrixFixed<T, ROWS, COLS>& m); template <typename V, size_t N> CMatrixDynamic& operator = (V(&) theArray [N]); CMatrixDynamic& operator = (CMatrixDynamic&& m);
Typedefs
typedef std::shared_ptr<mrpt::math ::CMatrixF> Ptr
A type for the associated smart pointer.
Construction
CMatrixF()
Constructor
CMatrixF(matrix_dim_t row, matrix_dim_t col)
Constructor.
CMatrixF(const CMatrixFloat& m)
Copy constructor.
CMatrixF(const CMatrixDynamic<double>& m)
Copy constructor.
template <typename OtherDerived> CMatrixF(const Eigen::MatrixBase<OtherDerived>& other)
Constructor from any other Eigen class.
Methods
virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const
Returns information about the class of an object in runtime.
virtual mrpt::rtti::CObject* clone() const
Returns a deep copy (clone) of the object, indepently of its class.
template <class OTHERMAT> CMatrixF& operator = (const OTHERMAT& m)
Assignment operator for float matrixes.
template <typename OtherDerived> CMatrixF& operator = (const Eigen::MatrixBase<OtherDerived>& other)
Assignment operator from any other Eigen class.