[mrpt-math]

Overview

Math C++ library: vectors and matrices, probability distributions, statistics, geometry, etc.

Library mrpt-math

This library is part of MRPT and can be installed in Debian-based systems with:

sudo apt install libmrpt-math-dev

Read also how to import MRPT into your CMake scripts.

The main classes and concepts associated with this library:

  • mrpt_math_vectors_matrices_grp: Vectors and matrices (compatible with the Eigen library).

  • mrpt_math_lwgeom_grp: TPose2D, TPose3D, TPoint3D, TLine3D, geometry functions, etc. (See also: [mrpt-poses])

Other important elements:

  • filtering_grp

  • fresnel_integrals_grp

  • fourier_grp

  • gausspdf_transform_grp

  • interpolation_grp

  • kdtree_grp

  • polynomial_roots

  • ransac_grp

  • stats_grp

Eigen integration (MRPT 3.x)

MRPT uses Eigen 3 for all matrix/vector types. Key points for MRPT 3 users:

  • mrpt::math::CMatrixDynamic<T> and mrpt::math::CMatrixFixed<T,R,C> wrap Eigen matrices and are fully serializable via mrpt::serialization::CArchive.

  • Use .asEigen() on any MRPT matrix to get the underlying Eigen expression for use with Eigen algorithms (decompositions, solvers, etc.).

  • mrpt::math::CVectorDynamic<T> is a column-vector equivalent.

  • Sparse matrices: use Eigen::SparseMatrix<double> directly; MRPT does not wrap sparse types but provides helpers in mrpt::math::CSparseMatrix (CXSparse-backed) for serialization.

  • Geometric operations (e.g. point clouds): lightweight structs mrpt::math::TPoint2Df, mrpt::math::TPoint3Df (float) and their double variants are used for performance; they convert freely to/from Eigen vectors.

Library contents