class mrpt::math::CMatrixD

Overview

This class is a “CSerializable” wrapper for “CMatrixDynamic<double>”.

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/CMatrixD.h>

class CMatrixD:
    public mrpt::serialization::CSerializable,
    public mrpt::math::CMatrixDynamic
{
public:
    // typedefs

    typedef std::shared_ptr<mrpt::math ::CMatrixD> Ptr;
    typedef std::shared_ptr<const mrpt::math ::CMatrixD> ConstPtr;
    typedef std::unique_ptr<mrpt::math ::CMatrixD> UniquePtr;
    typedef std::unique_ptr<const mrpt::math ::CMatrixD> ConstUniquePtr;
    typedef CMatrixDynamic<double> Base;

    // fields

    static constexpr const char* className = "mrpt::math" "::" "CMatrixD";

    // construction

    CMatrixD();
    CMatrixD(Base::size_type row, Base::size_type col);
    CMatrixD(const Base& m);
    CMatrixD(const CMatrixFloat& m);

    template <class Other>
    CMatrixD(const Other& 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;

    template <typename Other>
    CMatrixD& operator = (const Other& other);
};

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 ::CMatrixD> Ptr

A type for the associated smart pointer.

Construction

CMatrixD()

Constructor.

CMatrixD(Base::size_type row, Base::size_type col)

Constructor.

CMatrixD(const Base& m)

Copy constructor.

CMatrixD(const CMatrixFloat& m)

Copy constructor

template <class Other>
CMatrixD(const Other& 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 <typename Other>
CMatrixD& operator = (const Other& other)

Assignment operator from any other Eigen class.