MRPT  1.9.9
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables

Detailed Description

This base provides a set of functions for maths stuff.

mrpt_math_grp

Namespaces

 detail
 
 internal
 

Classes

class  CAtan2LookUpTable
 A look-up-table (LUT) of atan values for any (x,y) value in a square/rectangular grid of predefined resolution. More...
 
class  CAtan2LookUpTableMultiRes
 Like CAtan2LookUpTable but with a multiresolution grid for increasingly better accuracy in points nearer to the origin. More...
 
class  CBinaryRelation
 This class models a binary relation through the elements of any given set. More...
 
class  CConstMatrixColumnAccessor
 A vector-like wrapper for a const Matrix for accessing the elements of a given column with a [] operator. More...
 
class  CConstMatrixColumnAccessorExtended
 A vector-like wrapper for a const Matrix for accessing the elements of a given column with a [] operator, with offset and custom spacing. More...
 
class  CConstMatrixRowAccessor
 A vector-like wrapper for a const Matrix for accessing the elements of a given row with a [] operator. More...
 
class  CConstMatrixRowAccessorExtended
 A vector-like wrapper for a const Matrix for accessing the elements of a given row with a [] operator, with offset and custom spacing. More...
 
struct  CExceptionNotDefPos
 Used in mrpt::math::CSparseMatrix. More...
 
class  CHistogram
 This class provides an easy way of computing histograms for unidimensional real valued variables. More...
 
class  CLevenbergMarquardtTempl
 An implementation of the Levenberg-Marquardt algorithm for least-square minimization. More...
 
class  CMatrixB
 This class is a "CSerializable" wrapper for "CMatrixBool". More...
 
class  CMatrixColumnAccessor
 A vector-like wrapper for a Matrix for accessing the elements of a given column with a [] operator. More...
 
class  CMatrixColumnAccessorExtended
 A vector-like wrapper for a Matrix for accessing the elements of a given column with a [] operator, with offset and custom spacing. More...
 
class  CMatrixD
 This class is a "CSerializable" wrapper for "CMatrixDynamic<double>". More...
 
class  CMatrixDynamic
 This template class provides the basic functionality for a general 2D any-size, resizable container of numerical or non-numerical elements. More...
 
class  CMatrixF
 This class is a "CSerializable" wrapper for "CMatrixFloat". More...
 
class  CMatrixFixed
 A compile-time fixed-size numeric matrix container. More...
 
class  CMatrixRowAccessor
 A vector-like wrapper for a Matrix for accessing the elements of a given row with a [] operator. More...
 
class  CMatrixRowAccessorExtended
 A vector-like wrapper for a Matrix for accessing the elements of a given row with a [] operator, with offset and custom spacing. More...
 
class  CMonteCarlo
 Montecarlo simulation for experiments in 1D. More...
 
struct  ContainerType
 ContainerType<T>::element_t exposes the value of any STL or Eigen container. More...
 
struct  ContainerType< Eigen::EigenBase< Derived > >
 Specialization for Eigen containers. More...
 
struct  ContainerType< mrpt::math::MatrixVectorBase< Scalar, Derived > >
 Specialization for MRPT containers. More...
 
class  CPolygon
 A wrapper of a TPolygon2D class, implementing CSerializable. More...
 
class  CProbabilityDensityFunction
 A generic template for probability density distributions (PDFs). More...
 
class  CQuaternion
 A quaternion, which can represent a 3D rotation as pair $ (r,\mathbf{u}) *$, with a real part "r" and a 3D vector $ \mathbf{u} = (x,y,z) $, or alternatively, q = r + ix + jy + kz. More...
 
class  CSparseMatrix
 A sparse matrix structure, wrapping T. More...
 
class  CSparseMatrixTemplate
 A sparse matrix container (with cells of any type), with iterators. More...
 
class  CSparseSymmetricalMatrix
 A sparse matrix container for square symmetrical content around the main diagonal. More...
 
class  CSplineInterpolator1D
 A (persistent) sequence of (x,y) coordinates, allowing queries of intermediate points through spline interpolation, where possible. More...
 
class  CVectorDynamic
 Template for column vectors of dynamic size, compatible with Eigen. More...
 
class  FAddPoint
 
class  KDTreeCapable
 A generic adaptor class for providing Nearest Neighbor (NN) lookup via the nanoflann library. More...
 
struct  LowPassFilter_IIR1
 1-order low-pass IIR filter. More...
 
struct  matrix_size_t
 Auxiliary class used in CMatrixDynamic:size(), CMatrixDynamic::resize(), CMatrixFixed::size(), CMatrixFixed::resize(), to mimic the behavior of STL-containers. More...
 
class  MatrixBase
 Base CRTP class for all MRPT matrices. More...
 
struct  MatrixBlockSparseCols
 A templated column-indexed efficient storage of block-sparse Jacobian or Hessian matrices, together with other arbitrary information. More...
 
class  MatrixVectorBase
 Base CRTP class for all MRPT vectors and matrices. More...
 
class  ModelSearch
 Model search implementations: RANSAC and genetic algorithm. More...
 
class  RANSAC_Template
 A generic RANSAC implementation with models as matrices. More...
 
struct  RobustKernel
 
struct  RobustKernel< rkLeastSquares, T >
 No robust kernel, use standard least squares: rho(r) = r^2. More...
 
struct  RobustKernel< rkPseudoHuber, T >
 Pseudo-huber robust kernel: rho(r) = 2 * delta^2 * ( -1+sqrt( 1+ r^2/delta^2 ) ) More...
 
struct  TLine2D
 2D line without bounds, represented by its equation $Ax+By+C=0$. More...
 
struct  TLine3D
 3D line, represented by a base point and a director vector. More...
 
struct  TObject2D
 Standard type for storing any lightweight 2D type. More...
 
struct  TObject3D
 Standard object for storing any 3D lightweight object. More...
 
struct  TPlane
 3D Plane, represented by its equation $Ax+By+Cz+D=0$ More...
 
struct  TPoint2D
 Lightweight 2D point. More...
 
struct  TPoint2D_data
 
struct  TPoint3D
 Lightweight 3D point. More...
 
struct  TPoint3D_data
 Trivially copiable underlying data for TPoint3D. More...
 
struct  TPoint3Df
 Lightweight 3D point (float version). More...
 
struct  TPointXYZfIu8
 XYZ point (float) + Intensity(u8) More...
 
struct  TPointXYZfRGBu8
 XYZ point (float) + RGB(u8) More...
 
struct  TPointXYZIu8
 XYZ point (double) + Intensity(u8) More...
 
struct  TPointXYZRGBu8
 XYZ point (double) + RGB(u8) More...
 
class  TPolygon2D
 2D polygon, inheriting from std::vector<TPoint2D>. More...
 
class  TPolygon3D
 3D polygon, inheriting from std::vector<TPoint3D> More...
 
class  TPolygonWithPlane
 Slightly heavyweight type to speed-up calculations with polygons in 3D. More...
 
struct  TPose2D
 Lightweight 2D pose. More...
 
struct  TPose3D
 Lightweight 3D pose (three spatial coordinates, plus three angular coordinates). More...
 
struct  TPose3DQuat
 Lightweight 3D pose (three spatial coordinates, plus a quaternion ). More...
 
struct  TPoseOrPoint
 Base type of all TPoseXX and TPointXX classes in mrpt::math. More...
 
struct  TSegment2D
 2D segment, consisting of two points. More...
 
struct  TSegment3D
 3D segment, consisting of two points. More...
 
struct  TTwist2D
 2D twist: 2D velocity vector (vx,vy) + planar angular velocity (omega) More...
 
struct  TTwist3D
 3D twist: 3D velocity vector (vx,vy,vz) + angular velocity (wx,wy,wz) More...
 

Typedefs

using CLevenbergMarquardt = CLevenbergMarquardtTempl< mrpt::math::CVectorDouble >
 The default name for the LM class is an instantiation for "double". More...
 
using CMatrixBool = CMatrixDynamic< bool >
 Declares a matrix of booleans (non serializable). More...
 
using CMatrixFloat = CMatrixDynamic< float >
 Declares a matrix of float numbers (non serializable). More...
 
using CMatrixDouble = CMatrixDynamic< double >
 Declares a matrix of double numbers (non serializable). More...
 
using CMatrixUInt = CMatrixDynamic< unsigned int >
 Declares a matrix of unsigned ints (non serializable). More...
 
using CMatrix_u8 = CMatrixDynamic< uint8_t >
 matrix of uint8_t (non serializable). More...
 
using CMatrix_u16 = CMatrixDynamic< uint16_t >
 matrix of uint16_t (non serializable). More...
 
using CMatrixLongDouble = CMatrixDynamic< double >
 Declares a matrix of "long doubles" (non serializable), or of "doubles" if the compiler does not support "long double". More...
 
using CQuaternionDouble = CQuaternion< double >
 A quaternion of data type "double". More...
 
using CQuaternionFloat = CQuaternion< float >
 A quaternion of data type "float". More...
 
using CVectorFloat = CVectorDynamic< float >
 
using CVectorDouble = CVectorDynamic< double >
 
template<typename T , std::size_t N>
using CVectorFixed = CMatrixFixed< T, N, 1 >
 CVectorFixed is an array for numeric types supporting several mathematical operations (actually, just a wrapper on Eigen::Matrix<T,N,1>) More...
 
template<std::size_t N>
using CVectorFixedFloat = CVectorFixed< float, N >
 Specialization of CVectorFixed for float numbers. More...
 
template<std::size_t N>
using CVectorFixedDouble = CVectorFixed< double, N >
 Specialization of CVectorFixed for double numbers. More...
 
using RANSAC = RANSAC_Template< double >
 The default instance of RANSAC, for double type. More...
 
using TPlane3D = TPlane
 
using TVector3D = TPoint3D
 Useful type alias for 3-vectors. More...
 
using TVector2D = TPoint2D
 Useful type alias for 2-vectors. More...
 
using FFT_TYPE = float
 Copyright(C) 1997 Takuya OOURA (email: ooura.nosp@m.@mmm.nosp@m..t.u-.nosp@m.toky.nosp@m.o.ac..nosp@m.jp). More...
 
Typedefs for common sizes
using CMatrixDouble22 = CMatrixFixed< double, 2, 2 >
 
using CMatrixDouble23 = CMatrixFixed< double, 2, 3 >
 
using CMatrixDouble32 = CMatrixFixed< double, 3, 2 >
 
using CMatrixDouble33 = CMatrixFixed< double, 3, 3 >
 
using CMatrixDouble44 = CMatrixFixed< double, 4, 4 >
 
using CMatrixDouble66 = CMatrixFixed< double, 6, 6 >
 
using CMatrixDouble77 = CMatrixFixed< double, 7, 7 >
 
using CMatrixDouble13 = CMatrixFixed< double, 1, 3 >
 
using CMatrixDouble31 = CMatrixFixed< double, 3, 1 >
 
using CMatrixDouble34 = CMatrixFixed< double, 3, 4 >
 
using CMatrixDouble36 = CMatrixFixed< double, 3, 6 >
 
using CMatrixDouble12 = CMatrixFixed< double, 1, 2 >
 
using CMatrixDouble21 = CMatrixFixed< double, 2, 1 >
 
using CMatrixDouble61 = CMatrixFixed< double, 6, 1 >
 
using CMatrixDouble16 = CMatrixFixed< double, 1, 6 >
 
using CMatrixDouble71 = CMatrixFixed< double, 7, 1 >
 
using CMatrixDouble17 = CMatrixFixed< double, 1, 7 >
 
using CMatrixDouble51 = CMatrixFixed< double, 5, 1 >
 
using CMatrixDouble15 = CMatrixFixed< double, 1, 5 >
 
using CMatrixDouble41 = CMatrixFixed< double, 4, 1 >
 
using CMatrixDouble43 = CMatrixFixed< double, 4, 3 >
 
using CMatrixDouble6_12 = CMatrixFixed< double, 6, 12 >
 
using CMatrixDouble12_6 = CMatrixFixed< double, 12, 6 >
 
using CMatrixDouble39 = CMatrixFixed< double, 3, 9 >
 
using CMatrixDouble93 = CMatrixFixed< double, 9, 3 >
 
using CMatrixFloat22 = CMatrixFixed< float, 2, 2 >
 
using CMatrixFloat23 = CMatrixFixed< float, 2, 3 >
 
using CMatrixFloat32 = CMatrixFixed< float, 3, 2 >
 
using CMatrixFloat33 = CMatrixFixed< float, 3, 3 >
 
using CMatrixFloat44 = CMatrixFixed< float, 4, 4 >
 
using CMatrixFloat66 = CMatrixFixed< float, 6, 6 >
 
using CMatrixFloat77 = CMatrixFixed< float, 7, 7 >
 
using CMatrixFloat13 = CMatrixFixed< float, 1, 3 >
 
using CMatrixFloat31 = CMatrixFixed< float, 3, 1 >
 
using CMatrixFloat12 = CMatrixFixed< float, 1, 2 >
 
using CMatrixFloat21 = CMatrixFixed< float, 2, 1 >
 
using CMatrixFloat61 = CMatrixFixed< float, 6, 1 >
 
using CMatrixFloat16 = CMatrixFixed< float, 1, 6 >
 
using CMatrixFloat71 = CMatrixFixed< float, 7, 1 >
 
using CMatrixFloat17 = CMatrixFixed< float, 1, 7 >
 
using CMatrixFloat51 = CMatrixFixed< float, 5, 1 >
 
using CMatrixFloat15 = CMatrixFixed< float, 1, 5 >
 

Enumerations

enum  TConstructorFlags_Quaternions { UNINITIALIZED_QUATERNION = 0 }
 
enum  TConstructorFlags_Matrices { UNINITIALIZED_MATRIX = 0 }
 For usage in one of the constructors of CMatrixFixed or CMatrixDynamic (and derived classes), if it's not required to fill it with zeros at the constructor to save time. More...
 
enum  TMatrixTextFileFormat { MATRIX_FORMAT_ENG = 0, MATRIX_FORMAT_FIXED = 1, MATRIX_FORMAT_INT = 2 }
 
enum  TRobustKernelType { rkLeastSquares = 0, rkPseudoHuber }
 The different types of kernels for usage within a robustified least-squares estimator. More...
 

Functions

template<class MATRIXLIKE >
size_t size (const MATRIXLIKE &m, const int dim)
 
mrpt::serialization::CArchiveoperator>> (mrpt::serialization::CArchive &in, CMatrixD::Ptr &pObj)
 
mrpt::serialization::CArchiveoperator<< (mrpt::serialization::CArchive &s, const CVectorFloat &a)
 
mrpt::serialization::CArchiveoperator<< (mrpt::serialization::CArchive &s, const CVectorDouble &a)
 
mrpt::serialization::CArchiveoperator>> (mrpt::serialization::CArchive &in, CVectorDouble &a)
 
mrpt::serialization::CArchiveoperator>> (mrpt::serialization::CArchive &in, CVectorFloat &a)
 
double normalPDF (double x, double mu, double std)
 Evaluates the univariate normal (Gaussian) distribution at a given point "x". More...
 
template<class VECTORLIKE1 , class VECTORLIKE2 , class MATRIXLIKE >
MATRIXLIKE::Scalar normalPDFInf (const VECTORLIKE1 &x, const VECTORLIKE2 &mu, const MATRIXLIKE &cov_inv, const bool scaled_pdf=false)
 Evaluates the multivariate normal (Gaussian) distribution at a given point "x". More...
 
template<class VECTORLIKE1 , class VECTORLIKE2 , class MATRIXLIKE >
MATRIXLIKE::Scalar normalPDF (const VECTORLIKE1 &x, const VECTORLIKE2 &mu, const MATRIXLIKE &cov, const bool scaled_pdf=false)
 Evaluates the multivariate normal (Gaussian) distribution at a given point "x". More...
 
template<typename VECTORLIKE , typename MATRIXLIKE >
MATRIXLIKE::Scalar normalPDF (const VECTORLIKE &d, const MATRIXLIKE &cov)
 Evaluates the multivariate normal (Gaussian) distribution at a given point given its distance vector "d" from the Gaussian mean. More...
 
template<typename VECTORLIKE1 , typename MATRIXLIKE1 , typename VECTORLIKE2 , typename MATRIXLIKE2 >
double KLD_Gaussians (const VECTORLIKE1 &mu0, const MATRIXLIKE1 &cov0, const VECTORLIKE2 &mu1, const MATRIXLIKE2 &cov1)
 Kullback-Leibler divergence (KLD) between two independent multivariate Gaussians. More...
 
double normalQuantile (double p)
 Evaluates the Gaussian distribution quantile for the probability value p=[0,1]. More...
 
double normalCDF (double p)
 Evaluates the Gaussian cumulative density function. More...
 
double chi2inv (double P, unsigned int dim=1)
 The "quantile" of the Chi-Square distribution, for dimension "dim" and probability 0<P<1 (the inverse of chi2CDF) An aproximation from the Wilson-Hilferty transformation is used. More...
 
double noncentralChi2CDF (unsigned int degreesOfFreedom, double noncentrality, double arg)
 
double chi2CDF (unsigned int degreesOfFreedom, double arg)
 
double chi2PDF (unsigned int degreesOfFreedom, double arg, double accuracy=1e-7)
 
std::pair< double, double > noncentralChi2PDF_CDF (unsigned int degreesOfFreedom, double noncentrality, double arg, double eps=1e-7)
 Returns the 'exact' PDF (first) and CDF (second) of a Non-central chi-squared probability distribution, using an iterative method. More...
 
template<typename CONTAINER , typename T >
void confidenceIntervals (const CONTAINER &data, T &out_mean, T &out_lower_conf_interval, T &out_upper_conf_interval, const double confidenceInterval=0.1, const size_t histogramNumBins=1000)
 Return the mean and the 10%-90% confidence points (or with any other confidence value) of a set of samples by building the cummulative CDF of all the elements of the container. More...
 
void fft_real (CVectorFloat &in_realData, CVectorFloat &out_FFT_Re, CVectorFloat &out_FFT_Im, CVectorFloat &out_FFT_Mag)
 Computes the FFT of a 2^N-size vector of real numbers, and returns the Re+Im+Magnitude parts. More...
 
void dft2_real (const CMatrixFloat &in_data, CMatrixFloat &out_real, CMatrixFloat &out_imag)
 Compute the 2D Discrete Fourier Transform (DFT) of a real matrix, returning the real and imaginary parts separately. More...
 
void idft2_real (const CMatrixFloat &in_real, const CMatrixFloat &in_imag, CMatrixFloat &out_data)
 Compute the 2D inverse Discrete Fourier Transform (DFT) More...
 
void dft2_complex (const CMatrixFloat &in_real, const CMatrixFloat &in_imag, CMatrixFloat &out_real, CMatrixFloat &out_imag)
 Compute the 2D Discrete Fourier Transform (DFT) of a complex matrix, returning the real and imaginary parts separately. More...
 
void idft2_complex (const CMatrixFloat &in_real, const CMatrixFloat &in_imag, CMatrixFloat &out_real, CMatrixFloat &out_imag)
 Compute the 2D inverse Discrete Fourier Transform (DFT). More...
 
void cross_correlation_FFT (const CMatrixFloat &A, const CMatrixFloat &B, CMatrixFloat &out_corr)
 Correlation of two matrixes using 2D FFT. More...
 
double fresnel_sin_integral (double x) noexcept
 Evaluates the integral from 0 to x of sqrt(2/pi) sin(t^2) dt. More...
 
double fresnel_cos_integral (double x) noexcept
 Evaluates the integral from 0 to x of sqrt(2/pi) cos(t^2) dt. More...
 
long double lfresnel_sin_integral (long double x) noexcept
 long double version of fresnel_sin_integral More...
 
long double lfresnel_cos_integral (long double x) noexcept
 long double version of fresnel_cos_integral More...
 
template<class MATRIXLIKE1 , class MATRIXLIKE2 >
void homogeneousMatrixInverse (const MATRIXLIKE1 &M, MATRIXLIKE2 &out_inverse_M)
 Efficiently compute the inverse of a 4x4 homogeneous matrix by only transposing the rotation 3x3 part and solving the translation with dot products. More...
 
template<class IN_ROTMATRIX , class IN_XYZ , class OUT_ROTMATRIX , class OUT_XYZ >
void homogeneousMatrixInverse (const IN_ROTMATRIX &in_R, const IN_XYZ &in_xyz, OUT_ROTMATRIX &out_R, OUT_XYZ &out_xyz)
 
template<class MATRIXLIKE >
void homogeneousMatrixInverse (MATRIXLIKE &M)
 
template<class T , class VECTOR >
interpolate (const T &x, const VECTOR &ys, const T &x0, const T &x1)
 Interpolate a data sequence "ys" ranging from "x0" to "x1" (equally spaced), to obtain the approximation of the sequence at the point "x". More...
 
double interpolate2points (const double x, const double x0, const double y0, const double x1, const double y1, bool wrap2pi=false)
 Linear interpolation/extrapolation: evaluates at "x" the line (x0,y0)-(x1,y1). More...
 
template<typename NUMTYPE , class VECTORLIKE >
NUMTYPE spline (const NUMTYPE t, const VECTORLIKE &x, const VECTORLIKE &y, bool wrap2pi=false)
 Interpolates the value of a function in a point "t" given 4 SORTED points where "t" is between the two middle points If wrap2pi is true, output "y" values are wrapped to ]-pi,pi] (It is assumed that input "y" values already are in the correct range). More...
 
template<typename NUMTYPE , class VECTORLIKE , int NUM_POINTS = -1>
NUMTYPE leastSquareLinearFit (const NUMTYPE t, const VECTORLIKE &x, const VECTORLIKE &y, bool wrap2pi=false)
 Interpolates or extrapolates using a least-square linear fit of the set of values "x" and "y", evaluated at a single point "t". More...
 
template<class VECTORLIKE1 , class VECTORLIKE2 , class VECTORLIKE3 , int NUM_POINTS = -1>
void leastSquareLinearFit (const VECTORLIKE1 &ts, VECTORLIKE2 &outs, const VECTORLIKE3 &x, const VECTORLIKE3 &y, bool wrap2pi=false)
 Interpolates or extrapolates using a least-square linear fit of the set of values "x" and "y", evaluated at a sequence of points "ts" and returned at "outs". More...
 
template<class Derived >
const Derived & mat2eig (const Eigen::EigenBase< Derived > &m)
 Returns an Eigen-compatible type, despite its argument already is an Eigen matrix, or an mrpt-math matrix/vector. More...
 
template<class MAT >
auto mat2eig (const MAT &m, typename MAT::eigen_t *=nullptr)
 
template<typename MAT >
CMatrixRowAccessor< MAT > getRowAccessor (MAT &m, size_t rowIdx)
 
template<typename MAT >
CMatrixRowAccessorExtended< MAT > getRowAccessor (MAT &m, size_t rowIdx, size_t offset, size_t space=1)
 
template<typename MAT >
CConstMatrixRowAccessor< MAT > getRowAccessor (const MAT &m, size_t rowIdx)
 
template<typename MAT >
CConstMatrixRowAccessorExtended< MAT > getRowAccessor (const MAT &m, size_t rowIdx, size_t offset, size_t space=1)
 
template<typename MAT >
CMatrixColumnAccessor< MAT > getColumnAccessor (MAT &m, size_t colIdx)
 
template<typename MAT >
CMatrixColumnAccessorExtended< MAT > getColumnAccessor (MAT &m, size_t colIdx, size_t offset, size_t space=1)
 
template<typename MAT >
CConstMatrixColumnAccessor< MAT > getColumnAccessor (const MAT &m, size_t colIdx)
 
template<typename MAT >
CConstMatrixColumnAccessorExtended< MAT > getColumnAccessor (const MAT &m, size_t colIdx, size_t offset, size_t space=1)
 
template<typename DER >
void internalAssertEigenDefined ()
 Issues a static_assert() error if trying to compile a method that requires Eigen headers, without including them. More...
 
template<typename Scalar , class Derived , typename = std::enable_if_t< Derived::RowsAtCompileTime == Derived::ColsAtCompileTime || (Derived::ColsAtCompileTime == 1)>>
std::ostream & operator<< (std::ostream &o, const MatrixVectorBase< Scalar, Derived > &m)
 Stream as text. More...
 
template<class VECTORLIKE , class VECTORLIKE2 , class VECTORLIKE3 , class MATRIXLIKE , class USERPARAM >
void estimateJacobian (const VECTORLIKE &x, const std::function< void(const VECTORLIKE &x, const USERPARAM &y, VECTORLIKE3 &out)> &functor, const VECTORLIKE2 &increments, const USERPARAM &userParam, MATRIXLIKE &out_Jacobian)
 Estimate the Jacobian of a multi-dimensional function around a point "x", using finite differences of a given size in each input dimension. More...
 
template<class CONTAINER >
std::vector< double > histogram (const CONTAINER &v, double limit_min, double limit_max, size_t number_bins, bool do_normalization=false, std::vector< double > *out_bin_centers=nullptr)
 Computes the normalized or normal histogram of a sequence of numbers given the number of bins and the limits. More...
 
template<class EIGEN_CONTAINER >
void resizeLike (EIGEN_CONTAINER &trg, const EIGEN_CONTAINER &src)
 
template<typename T >
void resizeLike (std::vector< T > &trg, const std::vector< T > &src)
 
template<class CONTAINER1 , class CONTAINER2 >
void cumsum_tmpl (const CONTAINER1 &in_data, CONTAINER2 &out_cumsum)
 Computes the cumulative sum of all the elements, saving the result in another container. More...
 
template<class CONTAINER1 , class CONTAINER2 >
void cumsum (const CONTAINER1 &in_data, CONTAINER2 &out_cumsum)
 
template<class CONTAINER >
CONTAINER cumsum (const CONTAINER &in_data)
 Computes the cumulative sum of all the elements. More...
 
template<class CONTAINER >
CONTAINER::Scalar norm_inf (const CONTAINER &v)
 
template<class CONTAINER >
CONTAINER::Scalar norm (const CONTAINER &v)
 
template<class CONTAINER , int = CONTAINER::is_mrpt_type>
CONTAINER::Scalar maximum (const CONTAINER &v)
 
template<class CONTAINER , int = CONTAINER::is_mrpt_type>
CONTAINER::Scalar minimum (const CONTAINER &v)
 
template<class Derived >
Derived::Scalar maximum (const Eigen::MatrixBase< Derived > &v)
 
template<class Derived >
Derived::Scalar minimum (const Eigen::MatrixBase< Derived > &v)
 
template<typename T >
maximum (const std::vector< T > &v)
 
template<typename T >
minimum (const std::vector< T > &v)
 
template<typename MAT_H , typename MAT_C , typename MAT_R >
void multiply_HCHt (const MAT_H &H, const MAT_C &C, MAT_R &R, bool accumResultInOutput=false)
 R = H * C * H^t. More...
 
template<std::size_t H_ROWS, std::size_t H_COLS, typename Scalar >
mrpt::math::CMatrixFixed< Scalar, H_ROWS, H_ROWS > multiply_HCHt (const mrpt::math::CMatrixFixed< Scalar, H_ROWS, H_COLS > &H, const mrpt::math::CMatrixFixed< Scalar, H_COLS, H_COLS > &C)
 return a fixed-size matrix with the result of: H * C * H^t More...
 
template<typename VECTOR_H , typename MAT_C >
MAT_C::Scalar multiply_HtCH_scalar (const VECTOR_H &H, const MAT_C &C)
 r (scalar) = H^t*C*H (H: column vector, C: symmetric matrix) More...
 
template<typename VECTOR_H , typename MAT_C >
MAT_C::Scalar multiply_HCHt_scalar (const VECTOR_H &H, const MAT_C &C)
 r (scalar) = H*C*H^t (H: row vector, C: symmetric matrix) More...
 
template<class MAT_IN , class VECTOR , class MAT_OUT >
void meanAndCovMat (const MAT_IN &v, VECTOR &out_mean, MAT_OUT &out_cov)
 Computes the mean vector and covariance from a list of samples in an NxM matrix, where each row is a sample, so the covariance is MxM. More...
 
template<class MAT_IN , class VEC >
void meanAndStdColumns (const MAT_IN &m, VEC &outMeanVector, VEC &outStdVector, const bool unbiased_variance=true)
 Computes a row with the mean values of each column in the matrix and the associated vector with the standard deviation of each column. More...
 
template<class MATRIX >
CMatrixDouble cov (const MATRIX &v)
 Computes the covariance matrix from a list of samples in an NxM matrix, where each row is a sample, so the covariance is MxM. More...
 
template<class MAT_A , class SKEW_3VECTOR , class MAT_OUT >
void multiply_A_skew3 (const MAT_A &A, const SKEW_3VECTOR &v, MAT_OUT &out)
 Only for vectors/arrays "v" of length3, compute out = A * Skew(v), where Skew(v) is the skew symmetric matric generated from v (see mrpt::math::skew_symmetric3) More...
 
template<class SKEW_3VECTOR , class MAT_A , class MAT_OUT >
void multiply_skew3_A (const SKEW_3VECTOR &v, const MAT_A &A, MAT_OUT &out)
 Only for vectors/arrays "v" of length3, compute out = Skew(v) * A, where Skew(v) is the skew symmetric matric generated from v (see mrpt::math::skew_symmetric3) More...
 
template<typename MATIN , typename MATOUT >
void laplacian (const MATIN &g, MATOUT &ret)
 Computes the Laplacian of a square graph weight matrix. More...
 
template<std::size_t BLOCKSIZE, typename MAT , typename MATRIX >
void extractSubmatrixSymmetricalBlocks (const MAT &m, const std::vector< size_t > &block_indices, MATRIX &out)
 Get a submatrix from a square matrix, by collecting the elements M(idxs,idxs), where idxs is a sequence {block_indices(i):block_indices(i)+BLOCKSIZE-1} for all "i" up to the size of block_indices. More...
 
template<typename MAT , typename MATRIX >
void extractSubmatrixSymmetricalBlocksDyn (const MAT &m, const std::size_t BLOCKSIZE, const std::vector< size_t > &block_indices, MATRIX &out)
 
template<typename MAT , typename MATRIX >
void extractSubmatrixSymmetrical (const MAT &m, const std::vector< size_t > &indices, MATRIX &out)
 Get a submatrix from a square matrix, by collecting the elements M(idxs,idxs), where idxs is the sequence of indices passed as argument. More...
 
template<class T >
std::ostream & operator<< (std::ostream &out, const std::vector< T > &d)
 A template function for printing out the contents of a std::vector variable. More...
 
template<class T >
std::ostream & operator<< (std::ostream &out, std::vector< T > *d)
 A template function for printing out the contents of a std::vector variable. More...
 
template<typename T , size_t N>
mrpt::serialization::CArchiveoperator<< (mrpt::serialization::CArchive &ostrm, const CVectorFixed< T, N > &a)
 Binary dump of a CVectorFixed<T,N> to a stream. More...
 
template<typename T , size_t N>
mrpt::serialization::CArchiveoperator>> (mrpt::serialization::CArchive &istrm, CVectorFixed< T, N > &a)
 Binary read of a CVectorFixed<T,N> from a stream. More...
 
int solve_poly3 (double *x, double a, double b, double c) noexcept
 Solves cubic equation x^3 + a*x^2 + b*x + c = 0. More...
 
int solve_poly4 (double *x, double a, double b, double c, double d) noexcept
 Solves quartic equation x^4 + a*x^3 + b*x^2 + c*x + d = 0 by Dekart-Euler method. More...
 
int solve_poly5 (double *x, double a, double b, double c, double d, double e) noexcept
 Solves equation x^5 + a*x^4 + b*x^3 + c*x^2 + d*x + e = 0. More...
 
int solve_poly4Bi (double *x, double b, double d) noexcept
 Solve equation x^4 + b*x^2 + d = 0. More...
 
int solve_poly4De (double *x, double b, double c, double d) noexcept
 Solve equation x^4 + b*x^2 + c*x + d = 0. More...
 
int solve_poly2 (double a, double b, double c, double &r1, double &r2) noexcept
 Solves equation a*x^2 + b*x + c = 0. More...
 
mrpt::serialization::CArchiveoperator>> (mrpt::serialization::CArchive &in, mrpt::math::TLine2D &l)
 
mrpt::serialization::CArchiveoperator<< (mrpt::serialization::CArchive &out, const mrpt::math::TLine2D &l)
 
mrpt::serialization::CArchiveoperator>> (mrpt::serialization::CArchive &in, mrpt::math::TLine3D &l)
 
mrpt::serialization::CArchiveoperator<< (mrpt::serialization::CArchive &out, const mrpt::math::TLine3D &l)
 
mrpt::serialization::CArchiveoperator>> (mrpt::serialization::CArchive &in, mrpt::math::TObject2D &o)
 
mrpt::serialization::CArchiveoperator<< (mrpt::serialization::CArchive &out, const mrpt::math::TObject2D &o)
 
mrpt::serialization::CArchiveoperator>> (mrpt::serialization::CArchive &in, mrpt::math::TObject3D &o)
 
mrpt::serialization::CArchiveoperator<< (mrpt::serialization::CArchive &out, const mrpt::math::TObject3D &o)
 
mrpt::serialization::CArchiveoperator>> (mrpt::serialization::CArchive &in, mrpt::math::TPlane &p)
 
mrpt::serialization::CArchiveoperator<< (mrpt::serialization::CArchive &out, const mrpt::math::TPlane &p)
 
constexpr bool operator== (const TPoint2D &p1, const TPoint2D &p2)
 Exact comparison between 2D points. More...
 
constexpr bool operator!= (const TPoint2D &p1, const TPoint2D &p2)
 Exact comparison between 2D points. More...
 
constexpr TPoint3D operator- (const TPoint3D &p1)
 Unary minus operator for 3D points. More...
 
constexpr bool operator== (const TPoint3D &p1, const TPoint3D &p2)
 Exact comparison between 3D points. More...
 
constexpr bool operator!= (const TPoint3D &p1, const TPoint3D &p2)
 Exact comparison between 3D points. More...
 
bool operator== (const TPose2D &p1, const TPose2D &p2)
 Exact comparison between 2D poses, taking possible cycles into account. More...
 
bool operator!= (const TPose2D &p1, const TPose2D &p2)
 Exact comparison between 2D poses, taking possible cycles into account. More...
 
TPose3D operator- (const TPose3D &p)
 Unary $$ operator: computes inverse SE(3) element. More...
 
TPose3D operator- (const TPose3D &b, const TPose3D &a)
 Binary $$ operator: $b a$ computes the relative SE(3) pose of b "as seen from" a More...
 
bool operator== (const TPose3D &p1, const TPose3D &p2)
 Exact comparison between 3D poses, taking possible cycles into account. More...
 
bool operator!= (const TPose3D &p1, const TPose3D &p2)
 Exact comparison between 3D poses, taking possible cycles into account. More...
 
template<class PoseOrPoint , typename = std::enable_if_t<std::is_base_of_v< mrpt::math::TPoseOrPoint, PoseOrPoint>>>
std::ostream & operator<< (std::ostream &o, const PoseOrPoint &p)
 Text streaming function. More...
 
template<class PoseOrPoint , typename = std::enable_if_t<std::is_base_of_v< mrpt::math::TPoseOrPoint, PoseOrPoint>>>
mrpt::serialization::CArchiveoperator>> (mrpt::serialization::CArchive &in, PoseOrPoint &o)
 Binary streaming function. More...
 
template<class PoseOrPoint , typename = std::enable_if_t<std::is_base_of_v< mrpt::math::TPoseOrPoint, PoseOrPoint>>>
mrpt::serialization::CArchiveoperator<< (mrpt::serialization::CArchive &out, const PoseOrPoint &o)
 Binary streaming function. More...
 
template<class VECTORLIKE1 , class MATLIKE1 , class USERPARAM , class VECTORLIKE2 , class VECTORLIKE3 , class MATLIKE2 >
void transform_gaussian_unscented (const VECTORLIKE1 &x_mean, const MATLIKE1 &x_cov, void(*functor)(const VECTORLIKE1 &x, const USERPARAM &fixed_param, VECTORLIKE3 &y), const USERPARAM &fixed_param, VECTORLIKE2 &y_mean, MATLIKE2 &y_cov, const bool *elem_do_wrap2pi=nullptr, const double alpha=1e-3, const double K=0, const double beta=2.0)
 Scaled unscented transformation (SUT) for estimating the Gaussian distribution of a variable Y=f(X) for an arbitrary function f() provided by the user. More...
 
template<class VECTORLIKE1 , class MATLIKE1 , class USERPARAM , class VECTORLIKE2 , class VECTORLIKE3 , class MATLIKE2 >
void transform_gaussian_montecarlo (const VECTORLIKE1 &x_mean, const MATLIKE1 &x_cov, void(*functor)(const VECTORLIKE1 &x, const USERPARAM &fixed_param, VECTORLIKE3 &y), const USERPARAM &fixed_param, VECTORLIKE2 &y_mean, MATLIKE2 &y_cov, const size_t num_samples=1000, std::vector< VECTORLIKE3 > *out_samples_y=nullptr)
 Simple Montecarlo-base estimation of the Gaussian distribution of a variable Y=f(X) for an arbitrary function f() provided by the user. More...
 
template<class VECTORLIKE1 , class MATLIKE1 , class USERPARAM , class VECTORLIKE2 , class VECTORLIKE3 , class MATLIKE2 >
void transform_gaussian_linear (const VECTORLIKE1 &x_mean, const MATLIKE1 &x_cov, void(*functor)(const VECTORLIKE1 &x, const USERPARAM &fixed_param, VECTORLIKE3 &y), const USERPARAM &fixed_param, VECTORLIKE2 &y_mean, MATLIKE2 &y_cov, const VECTORLIKE1 &x_increments)
 First order uncertainty propagation estimator of the Gaussian distribution of a variable Y=f(X) for an arbitrary function f() provided by the user. More...
 
bool operator== (const TSegment2D &s1, const TSegment2D &s2)
 
bool operator!= (const TSegment2D &s1, const TSegment2D &s2)
 
mrpt::serialization::CArchiveoperator>> (mrpt::serialization::CArchive &in, mrpt::math::TSegment2D &s)
 
mrpt::serialization::CArchiveoperator<< (mrpt::serialization::CArchive &out, const mrpt::math::TSegment2D &s)
 
bool operator== (const TSegment3D &s1, const TSegment3D &s2)
 
bool operator!= (const TSegment3D &s1, const TSegment3D &s2)
 
mrpt::serialization::CArchiveoperator>> (mrpt::serialization::CArchive &in, mrpt::math::TSegment3D &s)
 
mrpt::serialization::CArchiveoperator<< (mrpt::serialization::CArchive &out, const mrpt::math::TSegment3D &s)
 
mrpt::serialization::CArchiveoperator>> (mrpt::serialization::CArchive &in, mrpt::math::TTwist2D &o)
 
mrpt::serialization::CArchiveoperator<< (mrpt::serialization::CArchive &out, const mrpt::math::TTwist2D &o)
 
mrpt::serialization::CArchiveoperator>> (mrpt::serialization::CArchive &in, mrpt::math::TTwist3D &o)
 
mrpt::serialization::CArchiveoperator<< (mrpt::serialization::CArchive &out, const mrpt::math::TTwist3D &o)
 
template<class T1 , class T2 >
bool approximatelyEqual (T1 a, T1 b, T2 epsilon)
 Compare 2 floats and determine whether they are equal. More...
 
template<class T >
bool approximatelyEqual (T a, T b)
 Compare 2 floats and determine whether they are equal. More...
 
template<class T >
absDiff (const T &lhs, const T &rhs)
 Absolute difference between two numbers. More...
 
bool loadVector (std::istream &f, std::vector< int > &d)
 Loads one row of a text file as a numerical std::vector. More...
 
bool loadVector (std::istream &f, std::vector< double > &d)
 Loads one row of a text file as a numerical std::vector. More...
 
void medianFilter (const std::vector< double > &inV, std::vector< double > &outV, int winSize, int numberOfSigmas=2)
 
template<typename T , typename VECTOR >
void linspace (T first, T last, size_t count, VECTOR &out_vector)
 Generates an equidistant sequence of numbers given the first one, the last one and the desired number of points. More...
 
template<class T , T STEP>
std::vector< T > sequenceStdVec (T first, size_t length)
 Generates a sequence of values [first,first+STEP,first+2*STEP,...]. More...
 
template<class VEC1 , class VEC2 >
void normalize (const VEC1 &v, VEC2 &out_v)
 Normalize a vector, such as its norm is the unity. More...
 
template<class VECTOR_OF_VECTORS , class VECTORLIKE >
void extractColumnFromVectorOfVectors (const size_t colIndex, const VECTOR_OF_VECTORS &data, VECTORLIKE &out_column)
 Extract a column from a vector of vectors, and store it in another vector. More...
 
uint64_t factorial64 (unsigned int n)
 Computes the factorial of an integer number and returns it as a 64-bit integer number. More...
 
double factorial (unsigned int n)
 Computes the factorial of an integer number and returns it as a double value (internally it uses logarithms for avoiding overflow). More...
 
std::string MATLAB_plotCovariance2D (const CMatrixFloat &cov22, const CVectorFloat &mean, float stdCount, const std::string &style=std::string("b"), size_t nEllipsePoints=30)
 Generates a string with the MATLAB commands required to plot an confidence interval (ellipse) for a 2D Gaussian ('float' version). More...
 
std::string MATLAB_plotCovariance2D (const CMatrixDouble &cov22, const CVectorDouble &mean, float stdCount, const std::string &style=std::string("b"), size_t nEllipsePoints=30)
 Generates a string with the MATLAB commands required to plot an confidence interval (ellipse) for a 2D Gaussian ('double' version). More...
 
template<typename VECTOR_T , typename At , size_t N>
VECTOR_T & loadVector (VECTOR_T &v, At(&theArray)[N])
 Assignment operator for initializing a std::vector from a C array (The vector will be automatically set to the correct size). More...
 
template<typename T , typename At , size_t N>
std::vector< T > & loadVector (std::vector< T > &v, At(&theArray)[N])
 
template<class TRIPLET >
bool saveEigenSparseTripletsToFile (const std::string &sFile, std::vector< TRIPLET > &tri)
 Saves to a plain-text file the nonzero entries of a Eigen sparse matrix, represented as a vector of triplets. More...
 
template<typename MATRIX >
mxArrayconvertToMatlab (const MATRIX &mat)
 Convert vectors, arrays and matrices into Matlab vectors/matrices. More...
 
template<typename CONTAINER >
mxArrayconvertVectorToMatlab (const CONTAINER &vec)
 Convert std::vector<> or std::deque<> of numeric types into Matlab vectors. More...
 
template<class T >
void wrapTo2PiInPlace (T &a)
 Modifies the given angle to translate it into the [0,2pi[ range. More...
 
template<class T >
wrapTo2Pi (T a)
 Modifies the given angle to translate it into the [0,2pi[ range. More...
 
template<class T >
wrapToPi (T a)
 Modifies the given angle to translate it into the ]-pi,pi] range. More...
 
template<class T >
void wrapToPiInPlace (T &a)
 Modifies the given angle to translate it into the ]-pi,pi] range. More...
 
template<class VECTOR >
void unwrap2PiSequence (VECTOR &x)
 Modify a sequence of angle values such as no consecutive values have a jump larger than PI in absolute value. More...
 
template<class T >
angDistance (T from, T to)
 Computes the shortest angular increment (or distance) between two planar orientations, such that it is constrained to [-pi,pi] and is correct for any combination of angles (e.g. More...
 
static void four1 (float data[], unsigned long nn, int isign)
 
static void realft (float data[], unsigned long n)
 
static void makewt (int nw, int *ip, FFT_TYPE *w)
 
static void bitrv2 (int n, int *ip, FFT_TYPE *a)
 Copyright(C) 1997 Takuya OOURA (email: ooura.nosp@m.@mmm.nosp@m..t.u-.nosp@m.toky.nosp@m.o.ac..nosp@m.jp). More...
 
static void cftbsub (int n, FFT_TYPE *a, FFT_TYPE *w)
 
static void cftfsub (int n, FFT_TYPE *a, FFT_TYPE *w)
 
static void rftfsub (int n, FFT_TYPE *a, int nc, FFT_TYPE *c)
 
static void rftbsub (int n, FFT_TYPE *a, int nc, FFT_TYPE *c)
 
static void makect (int nc, int *ip, FFT_TYPE *c)
 Copyright(C) 1997 Takuya OOURA (email: ooura.nosp@m.@mmm.nosp@m..t.u-.nosp@m.toky.nosp@m.o.ac..nosp@m.jp). More...
 
static void cdft (int n, int isgn, FFT_TYPE *a, int *ip, FFT_TYPE *w)
 Copyright(C) 1997 Takuya OOURA (email: ooura.nosp@m.@mmm.nosp@m..t.u-.nosp@m.toky.nosp@m.o.ac..nosp@m.jp). More...
 
static void rdft (int n, int isgn, FFT_TYPE *a, int *ip, FFT_TYPE *w)
 
static void rdft2d (int n1, int n2, int isgn, FFT_TYPE **a, FFT_TYPE *t, int *ip, FFT_TYPE *w)
 
Copyright(C) 1997 Takuya OOURA (email: ooura.nosp@m.@mmm.nosp@m..t.u-.nosp@m.toky.nosp@m.o.ac..nosp@m.jp). More...
 
static void cdft2d (int n1, int n2, int isgn, FFT_TYPE **a, FFT_TYPE *t, int *ip, FFT_TYPE *w)
 
Copyright(C) 1997 Takuya OOURA (email: ooura.nosp@m.@mmm.nosp@m..t.u-.nosp@m.toky.nosp@m.o.ac..nosp@m.jp). More...
 
template<typename T >
void ransac3Dplane_fit (const CMatrixDynamic< T > &allData, const std::vector< size_t > &useIndices, vector< CMatrixDynamic< T >> &fitModels)
 
template<typename T >
void ransac3Dplane_distance (const CMatrixDynamic< T > &allData, const vector< CMatrixDynamic< T >> &testModels, const T distanceThreshold, unsigned int &out_bestModelIndex, std::vector< size_t > &out_inlierIndices)
 
template<typename T >
bool ransac3Dplane_degenerate (const CMatrixDynamic< T > &allData, const std::vector< size_t > &useIndices)
 Return "true" if the selected points are a degenerate (invalid) case. More...
 
template<typename T >
void ransac2Dline_fit (const CMatrixDynamic< T > &allData, const std::vector< size_t > &useIndices, vector< CMatrixDynamic< T >> &fitModels)
 
template<typename T >
void ransac2Dline_distance (const CMatrixDynamic< T > &allData, const vector< CMatrixDynamic< T >> &testModels, const T distanceThreshold, unsigned int &out_bestModelIndex, std::vector< size_t > &out_inlierIndices)
 
template<typename T >
bool ransac2Dline_degenerate (const CMatrixDynamic< T > &allData, const std::vector< size_t > &useIndices)
 Return "true" if the selected points are a degenerate (invalid) case. More...
 
std::ostream & operator<< (std::ostream &o, const TPoint2D &p)
 
std::ostream & operator<< (std::ostream &o, const TPoint3D &p)
 
std::ostream & operator<< (std::ostream &o, const TPose2D &p)
 
std::ostream & operator<< (std::ostream &o, const TPose3D &p)
 
std::ostream & operator<< (std::ostream &o, const TPose3DQuat &p)
 
template<class T >
void removeUnusedVertices (T &poly)
 
template<class T >
void removeRepVertices (T &poly)
 
double isLeft (const mrpt::math::TPoint2D &P0, const mrpt::math::TPoint2D &P1, const mrpt::math::TPoint2D &P2)
 
Probability density distributions (pdf) distance metrics
template<class VECTORLIKE1 , class VECTORLIKE2 , class MAT >
MAT::Scalar mahalanobisDistance2 (const VECTORLIKE1 &X, const VECTORLIKE2 &MU, const MAT &COV)
 Computes the squared mahalanobis distance of a vector X given the mean MU and the covariance inverse COV_inv

\[ d^2 = (X-MU)^\top \Sigma^{-1} (X-MU) \]

. More...

 
template<class VECTORLIKE1 , class VECTORLIKE2 , class MAT >
VECTORLIKE1::Scalar mahalanobisDistance (const VECTORLIKE1 &X, const VECTORLIKE2 &MU, const MAT &COV)
 Computes the mahalanobis distance of a vector X given the mean MU and the covariance inverse COV_inv

\[ d = \sqrt{ (X-MU)^\top \Sigma^{-1} (X-MU) } \]

. More...

 
template<class VECTORLIKE , class MAT1 , class MAT2 , class MAT3 >
MAT1::Scalar mahalanobisDistance2 (const VECTORLIKE &mean_diffs, const MAT1 &COV1, const MAT2 &COV2, const MAT3 &CROSS_COV12)
 Computes the squared mahalanobis distance between two non-independent Gaussians, given the two covariance matrices and the vector with the difference of their means. More...
 
template<class VECTORLIKE , class MAT1 , class MAT2 , class MAT3 >
VECTORLIKE::Scalar mahalanobisDistance (const VECTORLIKE &mean_diffs, const MAT1 &COV1, const MAT2 &COV2, const MAT3 &CROSS_COV12)
 Computes the mahalanobis distance between two non-independent Gaussians (or independent if CROSS_COV12=nullptr), given the two covariance matrices and the vector with the difference of their means. More...
 
template<class VECTORLIKE , class MATRIXLIKE >
MATRIXLIKE::Scalar mahalanobisDistance2 (const VECTORLIKE &delta_mu, const MATRIXLIKE &cov)
 Computes the squared mahalanobis distance between a point and a Gaussian, given the covariance matrix and the vector with the difference between the mean and the point. More...
 
template<class VECTORLIKE , class MATRIXLIKE >
MATRIXLIKE::Scalar mahalanobisDistance (const VECTORLIKE &delta_mu, const MATRIXLIKE &cov)
 Computes the mahalanobis distance between a point and a Gaussian, given the covariance matrix and the vector with the difference between the mean and the point. More...
 
template<typename T >
productIntegralTwoGaussians (const std::vector< T > &mean_diffs, const CMatrixDynamic< T > &COV1, const CMatrixDynamic< T > &COV2)
 Computes the integral of the product of two Gaussians, with means separated by "mean_diffs" and covariances "COV1" and "COV2". More...
 
template<typename T , size_t DIM>
productIntegralTwoGaussians (const std::vector< T > &mean_diffs, const CMatrixFixed< T, DIM, DIM > &COV1, const CMatrixFixed< T, DIM, DIM > &COV2)
 Computes the integral of the product of two Gaussians, with means separated by "mean_diffs" and covariances "COV1" and "COV2". More...
 
template<typename T , class VECLIKE , class MATLIKE1 , class MATLIKE2 >
void productIntegralAndMahalanobisTwoGaussians (const VECLIKE &mean_diffs, const MATLIKE1 &COV1, const MATLIKE2 &COV2, T &maha2_out, T &intprod_out, const MATLIKE1 *CROSS_COV12=nullptr)
 Computes both, the integral of the product of two Gaussians and their square Mahalanobis distance. More...
 
template<typename T , class VECLIKE , class MATRIXLIKE >
void mahalanobisDistance2AndLogPDF (const VECLIKE &diff_mean, const MATRIXLIKE &cov, T &maha2_out, T &log_pdf_out)
 Computes both, the logarithm of the PDF and the square Mahalanobis distance between a point (given by its difference wrt the mean) and a Gaussian. More...
 
template<typename T , class VECLIKE , class MATRIXLIKE >
void mahalanobisDistance2AndPDF (const VECLIKE &diff_mean, const MATRIXLIKE &cov, T &maha2_out, T &pdf_out)
 Computes both, the PDF and the square Mahalanobis distance between a point (given by its difference wrt the mean) and a Gaussian. More...
 
template<class VECTOR_OF_VECTORS , class MATRIXLIKE , class VECTORLIKE , class VECTORLIKE2 , class VECTORLIKE3 >
void covariancesAndMeanWeighted (const VECTOR_OF_VECTORS &elements, MATRIXLIKE &covariances, VECTORLIKE &means, const VECTORLIKE2 *weights_mean, const VECTORLIKE3 *weights_cov, const bool *elem_do_wrap2pi=nullptr)
 Computes covariances and mean of any vector of containers, given optional weights for the different samples. More...
 
template<class VECTOR_OF_VECTORS , class MATRIXLIKE , class VECTORLIKE >
void covariancesAndMean (const VECTOR_OF_VECTORS &elements, MATRIXLIKE &covariances, VECTORLIKE &means, const bool *elem_do_wrap2pi=nullptr)
 Computes covariances and mean of any vector of containers. More...
 
template<class VECTORLIKE1 , class VECTORLIKE2 >
void weightedHistogram (const VECTORLIKE1 &values, const VECTORLIKE1 &weights, float binWidth, VECTORLIKE2 &out_binCenters, VECTORLIKE2 &out_binValues)
 Computes the weighted histogram for a vector of values and their corresponding weights. More...
 
template<class VECTORLIKE1 , class VECTORLIKE2 >
void weightedHistogramLog (const VECTORLIKE1 &values, const VECTORLIKE1 &log_weights, float binWidth, VECTORLIKE2 &out_binCenters, VECTORLIKE2 &out_binValues)
 Computes the weighted histogram for a vector of values and their corresponding log-weights. More...
 
double averageLogLikelihood (const CVectorDouble &logLikelihoods)
 A numerically-stable method to compute average likelihood values with strongly different ranges (unweighted likelihoods: compute the arithmetic mean). More...
 
double averageWrap2Pi (const CVectorDouble &angles)
 Computes the average of a sequence of angles in radians taking into account the correct wrapping in the range $ ]-\pi,\pi [ $, for example, the mean of (2,-2) is $ \pi $, not 0. More...
 
double averageLogLikelihood (const CVectorDouble &logWeights, const CVectorDouble &logLikelihoods)
 A numerically-stable method to average likelihood values with strongly different ranges (weighted likelihoods). More...
 
Simple intersection operations, relying basically on geometrical

operations.

bool intersect (const TSegment3D &s1, const TSegment3D &s2, TObject3D &obj)
 Gets the intersection between two 3D segments. More...
 
bool intersect (const TSegment3D &s1, const TPlane &p2, TObject3D &obj)
 Gets the intersection between a 3D segment and a plane. More...
 
bool intersect (const TSegment3D &s1, const TLine3D &r2, TObject3D &obj)
 Gets the intersection between a 3D segment and a 3D line. More...
 
bool intersect (const TPlane &p1, const TSegment3D &s2, TObject3D &obj)
 Gets the intersection between a plane and a 3D segment. More...
 
bool intersect (const TPlane &p1, const TPlane &p2, TObject3D &obj)
 Gets the intersection between two planes. More...
 
bool intersect (const TPlane &p1, const TLine3D &p2, TObject3D &obj)
 Gets the intersection between a plane and a 3D line. More...
 
bool intersect (const TLine3D &r1, const TSegment3D &s2, TObject3D &obj)
 Gets the intersection between a 3D line and a 3D segment. More...
 
bool intersect (const TLine3D &r1, const TPlane &p2, TObject3D &obj)
 Gets the intersection between a 3D line and a plane. More...
 
bool intersect (const TLine3D &r1, const TLine3D &r2, TObject3D &obj)
 Gets the intersection between two 3D lines. More...
 
bool intersect (const TLine2D &r1, const TLine2D &r2, TObject2D &obj)
 Gets the intersection between two 2D lines. More...
 
bool intersect (const TLine2D &r1, const TSegment2D &s2, TObject2D &obj)
 Gets the intersection between a 2D line and a 2D segment. More...
 
bool intersect (const TSegment2D &s1, const TLine2D &r2, TObject2D &obj)
 Gets the intersection between a 2D line and a 2D segment. More...
 
bool intersect (const TSegment2D &s1, const TSegment2D &s2, TObject2D &obj)
 Gets the intersection between two 2D segments. More...
 
Angle retrieval methods. Methods which use TSegments will

automatically use TLines' implicit constructors.

double getAngle (const TPlane &p1, const TPlane &p2)
 Computes the angle between two planes. More...
 
double getAngle (const TPlane &p1, const TLine3D &r2)
 Computes the angle between a plane and a 3D line or segment (implicit constructor will be used if passing a segment instead of a line). More...
 
double getAngle (const TLine3D &r1, const TPlane &p2)
 Computes the angle between a 3D line or segment and a plane (implicit constructor will be used if passing a segment instead of a line). More...
 
double getAngle (const TLine3D &r1, const TLine3D &r2)
 Computes the accute relative angle (range: [-PI/2,PI/2]) between two lines. More...
 
double getAngle (const TLine2D &r1, const TLine2D &r2)
 Computes the relative angle (range: [-PI,PI]) of line 2 wrt line 1. More...
 
Creation of lines from poses.
void createFromPoseX (const mrpt::math::TPose3D &p, TLine3D &r)
 Gets a 3D line corresponding to the X axis in a given pose. More...
 
void createFromPoseY (const mrpt::math::TPose3D &p, TLine3D &r)
 Gets a 3D line corresponding to the Y axis in a given pose. More...
 
void createFromPoseZ (const mrpt::math::TPose3D &p, TLine3D &r)
 Gets a 3D line corresponding to the Z axis in a given pose. More...
 
void createFromPoseAndVector (const mrpt::math::TPose3D &p, const double(&vector)[3], TLine3D &r)
 Gets a 3D line corresponding to any arbitrary vector, in the base given by the pose. More...
 
void createFromPoseX (const TPose2D &p, TLine2D &r)
 Gets a 2D line corresponding to the X axis in a given pose. More...
 
void createFromPoseY (const TPose2D &p, TLine2D &r)
 Gets a 2D line corresponding to the Y axis in a given pose. More...
 
void createFromPoseAndVector (const TPose2D &p, const double(&vector)[2], TLine2D &r)
 Gets a 2D line corresponding to any arbitrary vector, in the base given the given pose. More...
 
Other line or plane related methods.
bool conformAPlane (const std::vector< TPoint3D > &points)
 Checks whether this polygon or set of points acceptably fits a plane. More...
 
bool conformAPlane (const std::vector< TPoint3D > &points, TPlane &p)
 Checks whether this polygon or set of points acceptably fits a plane, and if it's the case returns it in the second argument. More...
 
bool areAligned (const std::vector< TPoint2D > &points)
 Checks whether this set of points acceptably fits a 2D line. More...
 
bool areAligned (const std::vector< TPoint2D > &points, TLine2D &r)
 Checks whether this set of points acceptably fits a 2D line, and if it's the case returns it in the second argument. More...
 
bool areAligned (const std::vector< TPoint3D > &points)
 Checks whether this set of points acceptably fits a 3D line. More...
 
bool areAligned (const std::vector< TPoint3D > &points, TLine3D &r)
 Checks whether this set of points acceptably fits a 3D line, and if it's the case returns it in the second argument. More...
 
Projections
void project3D (const TPoint3D &point, const mrpt::math::TPose3D &newXYpose, TPoint3D &newPoint)
 Uses the given pose 3D to project a point into a new base. More...
 
void project3D (const TSegment3D &segment, const mrpt::math::TPose3D &newXYpose, TSegment3D &newSegment)
 Uses the given pose 3D to project a segment into a new base. More...
 
void project3D (const TLine3D &line, const mrpt::math::TPose3D &newXYpose, TLine3D &newLine)
 Uses the given pose 3D to project a line into a new base. More...
 
void project3D (const TPlane &plane, const mrpt::math::TPose3D &newXYpose, TPlane &newPlane)
 Uses the given pose 3D to project a plane into a new base. More...
 
void project3D (const TPolygon3D &polygon, const mrpt::math::TPose3D &newXYpose, TPolygon3D &newPolygon)
 Uses the given pose 3D to project a polygon into a new base. More...
 
void project3D (const TObject3D &object, const mrpt::math::TPose3D &newXYPose, TObject3D &newObject)
 Uses the given pose 3D to project any 3D object into a new base. More...
 
template<class T >
void project3D (const T &obj, const TPlane &newXYPlane, T &newObj)
 Projects any 3D object into the plane's base, using its inverse pose. More...
 
template<class T >
void project3D (const T &obj, const TPlane &newXYPlane, const TPoint3D &newOrigin, T &newObj)
 Projects any 3D object into the plane's base, using its inverse pose and forcing the position of the new coordinates origin. More...
 
template<class T >
void project3D (const std::vector< T > &objs, const mrpt::math::TPose3D &newXYpose, std::vector< T > &newObjs)
 Projects a set of 3D objects into the plane's base. More...
 
void project2D (const TPoint2D &point, const TPose2D &newXpose, TPoint2D &newPoint)
 Uses the given pose 2D to project a point into a new base. More...
 
void project2D (const TSegment2D &segment, const TPose2D &newXpose, TSegment2D &newSegment)
 Uses the given pose 2D to project a segment into a new base. More...
 
void project2D (const TLine2D &line, const TPose2D &newXpose, TLine2D &newLine)
 Uses the given pose 2D to project a line into a new base. More...
 
void project2D (const TPolygon2D &polygon, const TPose2D &newXpose, TPolygon2D &newPolygon)
 Uses the given pose 2D to project a polygon into a new base. More...
 
void project2D (const TObject2D &object, const TPose2D &newXpose, TObject2D &newObject)
 Uses the given pose 2D to project any 2D object into a new base. More...
 
template<class T , class CPOSE2D >
void project2D (const T &obj, const TLine2D &newXLine, T &newObj)
 Projects any 2D object into the line's base, using its inverse pose. More...
 
template<class T , class CPOSE2D >
void project2D (const T &obj, const TLine2D &newXLine, const TPoint2D &newOrigin, T &newObj)
 Projects any 2D object into the line's base, using its inverse pose and forcing the position of the new coordinate origin. More...
 
template<class T >
void project2D (const std::vector< T > &objs, const TPose2D &newXpose, std::vector< T > &newObjs)
 Projects a set of 2D objects into the line's base. More...
 
Polygon intersections. These operations rely more on spatial reasoning

than in raw numerical operations.

bool intersect (const TPolygon2D &p1, const TSegment2D &s2, TObject2D &obj)
 Gets the intersection between a 2D polygon and a 2D segment. More...
 
bool intersect (const TPolygon2D &p1, const TLine2D &r2, TObject2D &obj)
 Gets the intersection between a 2D polygon and a 2D line. More...
 
bool intersect (const TPolygon2D &p1, const TPolygon2D &p2, TObject2D &obj)
 Gets the intersection between two 2D polygons. More...
 
bool intersect (const TSegment2D &s1, const TPolygon2D &p2, TObject2D &obj)
 Gets the intersection between a 2D segment and a 2D polygon. More...
 
bool intersect (const TLine2D &r1, const TPolygon2D &p2, TObject2D &obj)
 Gets the intersection between a 2D line and a 2D polygon. More...
 
bool intersect (const TPolygon3D &p1, const TSegment3D &s2, TObject3D &obj)
 Gets the intersection between a 3D polygon and a 3D segment. More...
 
bool intersect (const TPolygon3D &p1, const TLine3D &r2, TObject3D &obj)
 Gets the intersection between a 3D polygon and a 3D line. More...
 
bool intersect (const TPolygon3D &p1, const TPlane &p2, TObject3D &obj)
 Gets the intersection between a 3D polygon and a plane. More...
 
bool intersect (const TPolygon3D &p1, const TPolygon3D &p2, TObject3D &obj)
 Gets the intersection between two 3D polygons. More...
 
bool intersect (const TSegment3D &s1, const TPolygon3D &p2, TObject3D &obj)
 Gets the intersection between a 3D segment and a 3D polygon. More...
 
bool intersect (const TLine3D &r1, const TPolygon3D &p2, TObject3D &obj)
 Gets the intersection between a 3D line and a 3D polygon. More...
 
bool intersect (const TPlane &p1, const TPolygon3D &p2, TObject3D &obj)
 Gets the intersection between a plane and a 3D polygon. More...
 
size_t intersect (const std::vector< TPolygon3D > &v1, const std::vector< TPolygon3D > &v2, CSparseMatrixTemplate< TObject3D > &objs)
 Gets the intersection between two sets of 3D polygons. More...
 
size_t intersect (const std::vector< TPolygon3D > &v1, const std::vector< TPolygon3D > &v2, std::vector< TObject3D > &objs)
 Gets the intersection between two sets of 3D polygons. More...
 
Other intersections
template<class T , class U , class O >
size_t intersect (const std::vector< T > &v1, const std::vector< U > &v2, CSparseMatrixTemplate< O > &objs)
 Gets the intersection between vectors of geometric objects and returns it in a sparse matrix of either TObject2D or TObject3D. More...
 
template<class T , class U , class O >
size_t intersect (const std::vector< T > &v1, const std::vector< U > &v2, std::vector< O > objs)
 Gets the intersection between vectors of geometric objects and returns it in a vector of either TObject2D or TObject3D. More...
 
bool intersect (const TObject2D &o1, const TObject2D &o2, TObject2D &obj)
 Gets the intersection between any pair of 2D objects. More...
 
bool intersect (const TObject3D &o1, const TObject3D &o2, TObject3D &obj)
 Gets the intersection between any pair of 3D objects. More...
 
Distances
double distance (const TPoint2D &p1, const TPoint2D &p2)
 Gets the distance between two points in a 2D space. More...
 
double distance (const TPoint3D &p1, const TPoint3D &p2)
 Gets the distance between two points in a 3D space. More...
 
double distance (const TLine2D &r1, const TLine2D &r2)
 Gets the distance between two lines in a 2D space. More...
 
double distance (const TLine3D &r1, const TLine3D &r2)
 Gets the distance between two lines in a 3D space. More...
 
double distance (const TPlane &p1, const TPlane &p2)
 Gets the distance between two planes. More...
 
double distance (const TPolygon2D &p1, const TPolygon2D &p2)
 Gets the distance between two polygons in a 2D space. More...
 
double distance (const TPolygon2D &p1, const TSegment2D &s2)
 Gets the distance between a polygon and a segment in a 2D space. More...
 
double distance (const TSegment2D &s1, const TPolygon2D &p2)
 Gets the distance between a segment and a polygon in a 2D space. More...
 
double distance (const TPolygon2D &p1, const TLine2D &l2)
 Gets the distance between a polygon and a line in a 2D space. More...
 
double distance (const TLine2D &l1, const TPolygon2D &p2)
 
double distance (const TPolygon3D &p1, const TPolygon3D &p2)
 Gets the distance between two polygons in a 3D space. More...
 
double distance (const TPolygon3D &p1, const TSegment3D &s2)
 Gets the distance between a polygon and a segment in a 3D space. More...
 
double distance (const TSegment3D &s1, const TPolygon3D &p2)
 Gets the distance between a segment and a polygon in a 3D space. More...
 
double distance (const TPolygon3D &p1, const TLine3D &l2)
 Gets the distance between a polygon and a line in a 3D space. More...
 
double distance (const TLine3D &l1, const TPolygon3D &p2)
 Gets the distance between a line and a polygon in a 3D space. More...
 
double distance (const TPolygon3D &po, const TPlane &pl)
 Gets the distance between a polygon and a plane. More...
 
double distance (const TPlane &pl, const TPolygon3D &po)
 Gets the distance between a plane and a polygon. More...
 
Bound checkers
void getRectangleBounds (const std::vector< TPoint2D > &poly, TPoint2D &pMin, TPoint2D &pMax)
 Gets the rectangular bounds of a 2D polygon or set of 2D points. More...
 
void getPrismBounds (const std::vector< TPoint3D > &poly, TPoint3D &pMin, TPoint3D &pMax)
 Gets the prism bounds of a 3D polygon or set of 3D points. More...
 
Creation of planes from poses
void createPlaneFromPoseXY (const mrpt::math::TPose3D &pose, TPlane &plane)
 Given a pose, creates a plane orthogonal to its Z vector. More...
 
void createPlaneFromPoseXZ (const mrpt::math::TPose3D &pose, TPlane &plane)
 Given a pose, creates a plane orthogonal to its Y vector. More...
 
void createPlaneFromPoseYZ (const mrpt::math::TPose3D &pose, TPlane &plane)
 Given a pose, creates a plane orthogonal to its X vector. More...
 
void createPlaneFromPoseAndNormal (const mrpt::math::TPose3D &pose, const double(&normal)[3], TPlane &plane)
 Given a pose and any vector, creates a plane orthogonal to that vector in the pose's coordinates. More...
 
void generateAxisBaseFromDirectionAndAxis (const double(&vec)[3], uint8_t coord, CMatrixDouble44 &matrix)
 Creates a homogeneus matrix (4x4) such that the coordinate given (0 for x, 1 for y, 2 for z) corresponds to the provided vector. More...
 
Linear regression methods
double getRegressionLine (const std::vector< TPoint2D > &points, TLine2D &line)
 Using eigenvalues, gets the best fitting line for a set of 2D points. More...
 
double getRegressionLine (const std::vector< TPoint3D > &points, TLine3D &line)
 Using eigenvalues, gets the best fitting line for a set of 3D points. More...
 
double getRegressionPlane (const std::vector< TPoint3D > &points, TPlane &plane)
 Using eigenvalues, gets the best fitting plane for a set of 3D points. More...
 
Miscellaneous Geometry methods
void assemblePolygons (const std::vector< TSegment3D > &segms, std::vector< TPolygon3D > &polys)
 Tries to assemble a set of segments into a set of closed polygons. More...
 
void assemblePolygons (const std::vector< TSegment3D > &segms, std::vector< TPolygon3D > &polys, std::vector< TSegment3D > &remainder)
 Tries to assemble a set of segments into a set of closed polygons, returning the unused segments as another out parameter. More...
 
void assemblePolygons (const std::vector< TObject3D > &objs, std::vector< TPolygon3D > &polys)
 Extracts all the polygons, including those formed from segments, from the set of objects. More...
 
void assemblePolygons (const std::vector< TObject3D > &objs, std::vector< TPolygon3D > &polys, std::vector< TObject3D > &remainder)
 Extracts all the polygons, including those formed from segments, from the set of objects. More...
 
void assemblePolygons (const std::vector< TObject3D > &objs, std::vector< TPolygon3D > &polys, std::vector< TSegment3D > &remainder1, std::vector< TObject3D > &remainder2)
 Extracts all the polygons, including those formed from segments, from the set of objects. More...
 
void setEpsilon (double nE)
 Changes the value of the geometric epsilon (default = 1e-5) More...
 
double getEpsilon ()
 Gets the value of the geometric epsilon (default = 1e-5) More...
 
bool splitInConvexComponents (const TPolygon2D &poly, std::vector< TPolygon2D > &components)
 Splits a 2D polygon into convex components. More...
 
bool splitInConvexComponents (const TPolygon3D &poly, std::vector< TPolygon3D > &components)
 Splits a 3D polygon into convex components. More...
 
void getSegmentBisector (const TSegment2D &sgm, TLine2D &bis)
 Gets the bisector of a 2D segment. More...
 
void getSegmentBisector (const TSegment3D &sgm, TPlane &bis)
 Gets the bisector of a 3D segment. More...
 
void getAngleBisector (const TLine2D &l1, const TLine2D &l2, TLine2D &bis)
 Gets the bisector of two lines or segments (implicit constructor will be used if necessary) More...
 
void getAngleBisector (const TLine3D &l1, const TLine3D &l2, TLine3D &bis)
 Gets the bisector of two lines or segments (implicit constructor will be used if necessary) More...
 
bool traceRay (const std::vector< TPolygonWithPlane > &vec, const mrpt::math::TPose3D &pose, double &dist)
 Fast ray tracing method using polygons' properties. More...
 
bool traceRay (const std::vector< TPolygon3D > &vec, const mrpt::math::TPose3D &pose, double &dist)
 Fast ray tracing method using polygons' properties. More...
 
template<class T , class U , class V >
void crossProduct3D (const T &v0, const U &v1, V &vOut)
 Computes the cross product of two 3D vectors, returning a vector normal to both. More...
 
template<class T >
void crossProduct3D (const std::vector< T > &v0, const std::vector< T > &v1, std::vector< T > &v_out)
 
template<class VEC1 , class VEC2 >
VEC1 crossProduct3D (const VEC1 &v0, const VEC2 &v1)
 overload (returning a vector of size 3 by value). More...
 
template<class VECTOR , class MATRIX >
void skew_symmetric3 (const VECTOR &v, MATRIX &M)
 Computes the 3x3 skew symmetric matrix from a 3-vector or 3-array:

\[ M([x ~ y ~ z]^\top) = \left( \begin{array}{c c c} 0 & -z & y \\ z & 0 & -x \\ -y & x & 0 \end{array} \right) \]

. More...

 
template<class VECTOR >
mrpt::math::CMatrixDouble33 skew_symmetric3 (const VECTOR &v)
 
template<class VECTOR , class MATRIX >
void skew_symmetric3_neg (const VECTOR &v, MATRIX &M)
 Computes the negative version of a 3x3 skew symmetric matrix from a 3-vector or 3-array:

\[ -M([x ~ y ~ z]^\top) = \left( \begin{array}{c c c} 0 & z & -y \\ -z & 0 & x \\ y & -x & 0 \end{array} \right) \]

. More...

 
template<class VECTOR >
mrpt::math::CMatrixDouble33 skew_symmetric3_neg (const VECTOR &v)
 
template<class T , class U >
bool vectorsAreParallel2D (const T &v1, const U &v2)
 Returns true if two 2D vectors are parallel. More...
 
template<class T , class U >
bool vectorsAreParallel3D (const T &v1, const U &v2)
 Returns true if two 3D vectors are parallel. More...
 
void closestFromPointToSegment (double Px, double Py, double x1, double y1, double x2, double y2, double &out_x, double &out_y)
 Computes the closest point from a given point to a segment. More...
 
void closestFromPointToLine (double Px, double Py, double x1, double y1, double x2, double y2, double &out_x, double &out_y)
 Computes the closest point from a given point to a (infinite) line. More...
 
double closestSquareDistanceFromPointToLine (double Px, double Py, double x1, double y1, double x2, double y2)
 Returns the square distance from a point to a line. More...
 
template<typename T >
distanceBetweenPoints (const T x1, const T y1, const T x2, const T y2)
 Returns the distance between 2 points in 2D. More...
 
template<typename T >
distanceBetweenPoints (const T x1, const T y1, const T z1, const T x2, const T y2, const T z2)
 Returns the distance between 2 points in 3D. More...
 
template<typename T >
distanceSqrBetweenPoints (const T x1, const T y1, const T x2, const T y2)
 Returns the square distance between 2 points in 2D. More...
 
template<typename T >
distanceSqrBetweenPoints (const T x1, const T y1, const T z1, const T x2, const T y2, const T z2)
 Returns the square distance between 2 points in 3D. More...
 
template<typename T >
double minimumDistanceFromPointToSegment (const double Px, const double Py, const double x1, const double y1, const double x2, const double y2, T &out_x, T &out_y)
 Computes the closest point from a given point to a segment, and returns that minimum distance. More...
 
bool SegmentsIntersection (const double x1, const double y1, const double x2, const double y2, const double x3, const double y3, const double x4, const double y4, double &ix, double &iy)
 Returns the intersection point, and if it exists, between two segments. More...
 
bool SegmentsIntersection (const double x1, const double y1, const double x2, const double y2, const double x3, const double y3, const double x4, const double y4, float &ix, float &iy)
 Returns the intersection point, and if it exists, between two segments. More...
 
bool pointIntoPolygon2D (double px, double py, unsigned int polyEdges, const double *poly_xs, const double *poly_ys)
 Returns true if the 2D point (px,py) falls INTO the given polygon. More...
 
template<typename T >
bool pointIntoQuadrangle (T x, T y, T v1x, T v1y, T v2x, T v2y, T v3x, T v3y, T v4x, T v4y)
 Specialized method to check whether a point (x,y) falls into a quadrangle. More...
 
double distancePointToPolygon2D (double px, double py, unsigned int polyEdges, const double *poly_xs, const double *poly_ys)
 Returns the closest distance of a given 2D point to a polygon, or "0" if the point is INTO the polygon or its perimeter. More...
 
bool minDistBetweenLines (double p1_x, double p1_y, double p1_z, double p2_x, double p2_y, double p2_z, double p3_x, double p3_y, double p3_z, double p4_x, double p4_y, double p4_z, double &x, double &y, double &z, double &dist)
 Calculates the minimum distance between a pair of lines. More...
 
bool RectanglesIntersection (double R1_x_min, double R1_x_max, double R1_y_min, double R1_y_max, double R2_x_min, double R2_x_max, double R2_y_min, double R2_y_max, double R2_pose_x, double R2_pose_y, double R2_pose_phi)
 Returns whether two rotated rectangles intersect. More...
 
CMatrixDouble33 generateAxisBaseFromDirection (double dx, double dy, double dz)
 Computes an axis base (a set of three 3D normal vectors) with the given vector being the first of them ("X") NOTE: Make sure of passing all floats or doubles and that the template of the receiving matrix is of the same type! More...
 
k-means algorithms
template<class LIST_OF_VECTORS1 , class LIST_OF_VECTORS2 >
double kmeans (const size_t k, const LIST_OF_VECTORS1 &points, std::vector< int > &assignments, LIST_OF_VECTORS2 *out_centers=nullptr, const size_t attempts=3)
 k-means algorithm to cluster a list of N points of arbitrary dimensionality into exactly K clusters. More...
 
template<class LIST_OF_VECTORS1 , class LIST_OF_VECTORS2 = LIST_OF_VECTORS1>
double kmeanspp (const size_t k, const LIST_OF_VECTORS1 &points, std::vector< int > &assignments, LIST_OF_VECTORS2 *out_centers=nullptr, const size_t attempts=3)
 k-means++ algorithm to cluster a list of N points of arbitrary dimensionality into exactly K clusters. More...
 
Operators for binary streaming of MRPT matrices
template<size_t NROWS, size_t NCOLS>
mrpt::serialization::CArchiveoperator>> (mrpt::serialization::CArchive &in, CMatrixFixed< float, NROWS, NCOLS > &M)
 Read operator from a CStream. More...
 
template<size_t NROWS, size_t NCOLS>
mrpt::serialization::CArchiveoperator>> (mrpt::serialization::CArchive &in, CMatrixFixed< double, NROWS, NCOLS > &M)
 Read operator from a CStream. More...
 
template<size_t NROWS, size_t NCOLS>
mrpt::serialization::CArchiveoperator<< (mrpt::serialization::CArchive &out, const CMatrixFixed< float, NROWS, NCOLS > &M)
 Write operator for writing into a CStream. More...
 
template<size_t NROWS, size_t NCOLS>
mrpt::serialization::CArchiveoperator<< (mrpt::serialization::CArchive &out, const CMatrixFixed< double, NROWS, NCOLS > &M)
 Write operator for writing into a CStream. More...
 
Operators for text streaming of MRPT matrices
template<typename MAT >
void deserializeSymmetricMatrixFrom (MAT &m, mrpt::serialization::CArchive &in)
 Binary serialization of symmetric matrices, saving the space of duplicated values. More...
 
template<typename MAT >
void serializeSymmetricMatrixTo (MAT &m, mrpt::serialization::CArchive &out)
 Binary serialization of symmetric matrices, saving the space of duplicated values. More...
 
Generic container element-wise operations - Miscelaneous
template<class CONTAINER , typename VALUE >
VALUE squareNorm_accum (const VALUE total, const CONTAINER &v)
 Accumulate the squared-norm of a vector/array/matrix into "total" (this function is compatible with std::accumulate). More...
 
template<size_t N, class T , class U >
squareNorm (const U &v)
 Compute the square norm of anything implementing []. More...
 
template<class CONTAINER1 , class CONTAINER2 >
CONTAINER1::Scalar dotProduct (const CONTAINER1 &v1, const CONTAINER1 &v2)
 v1*v2: The dot product of two containers (vectors/arrays/matrices) More...
 
template<size_t N, class T , class U , class V >
dotProduct (const U &v1, const V &v2)
 v1*v2: The dot product of any two objects supporting [] More...
 
template<class CONTAINER >
CONTAINER::Scalar sum (const CONTAINER &v)
 Computes the sum of all the elements. More...
 
template<typename T >
sum (const std::vector< T > &v)
 
template<class CONTAINER , typename RET >
RET sumRetType (const CONTAINER &v)
 Computes the sum of all the elements, with a custom return type. More...
 
template<class CONTAINER >
double mean (const CONTAINER &v)
 Computes the mean value of a vector. More...
 
template<typename T >
void minimum_maximum (const std::vector< T > &V, T &curMin, T &curMax)
 Return the maximum and minimum values of a std::vector. More...
 
template<class Derived >
void minimum_maximum (const Eigen::MatrixBase< Derived > &V, typename Eigen::MatrixBase< Derived >::Scalar &curMin, typename Eigen::MatrixBase< Derived >::Scalar &curMax)
 Return the maximum and minimum values of a Eigen-based vector or matrix. More...
 
template<class CONTAINER , typename Scalar >
void normalize (CONTAINER &c, Scalar valMin, Scalar valMax)
 Scales all elements such as the minimum & maximum values are shifted to the given values. More...
 
template<class CONTAINER1 , class CONTAINER2 >
size_t countCommonElements (const CONTAINER1 &a, const CONTAINER2 &b)
 Counts the number of elements that appear in both STL-like containers (comparison through the == operator) It is assumed that no repeated elements appear within each of the containers. More...
 
template<class CONTAINER >
void adjustRange (CONTAINER &m, const typename CONTAINER::Scalar minVal, const typename CONTAINER::Scalar maxVal)
 Adjusts the range of all the elements such as the minimum and maximum values being those supplied by the user. More...
 
template<class VECTORLIKE >
void meanAndStd (const VECTORLIKE &v, double &out_mean, double &out_std, bool unbiased=true)
 Computes the standard deviation of a vector (or all elements of a matrix) More...
 
template<class VECTORLIKE >
double stddev (const VECTORLIKE &v, bool unbiased=true)
 Computes the standard deviation of a vector. More...
 
template<class VECTOR_OF_VECTOR , class VECTORLIKE , class MATRIXLIKE >
void meanAndCovVec (const VECTOR_OF_VECTOR &v, VECTORLIKE &out_mean, MATRIXLIKE &out_cov)
 Computes the mean vector and covariance from a list of values given as a vector of vectors, where each row is a sample. More...
 
template<class VECTOR_OF_VECTOR , class RETURN_MATRIX >
RETURN_MATRIX covVector (const VECTOR_OF_VECTOR &v)
 Computes the covariance matrix from a list of values given as a vector of vectors, where each row is a sample. More...
 
template<class CONT1 , class CONT2 >
double ncc_vector (const CONT1 &patch1, const CONT2 &patch2)
 Normalised Cross Correlation between two vector patches The Matlab code for this is a = a - mean2(a); b = b - mean2(b); r = sum(sum(a. More...
 
Generic std::vector element-wise operations
template<typename T1 , typename T2 >
std::vector< T1 > & operator*= (std::vector< T1 > &a, const std::vector< T2 > &b)
 a*=b (element-wise multiplication) More...
 
template<typename T1 >
std::vector< T1 > & operator*= (std::vector< T1 > &a, const T1 b)
 a*=k (multiplication by a constant) More...
 
template<typename T1 , typename T2 >
std::vector< T1 > operator* (const std::vector< T1 > &a, const std::vector< T2 > &b)
 a*b (element-wise multiplication) More...
 
template<typename T1 , typename T2 >
std::vector< T1 > & operator+= (std::vector< T1 > &a, const std::vector< T2 > &b)
 a+=b (element-wise sum) More...
 
template<typename T1 >
std::vector< T1 > & operator+= (std::vector< T1 > &a, const T1 b)
 a+=b (sum a constant) More...
 
template<typename T1 , typename T2 >
std::vector< T1 > operator+ (const std::vector< T1 > &a, const std::vector< T2 > &b)
 a+b (element-wise sum) More...
 
template<typename T1 , typename T2 >
std::vector< T1 > operator- (const std::vector< T1 > &v1, const std::vector< T2 > &v2)
 
Container initializer from pose classes
template<class CONTAINER , class POINT_OR_POSE >
CONTAINER & containerFromPoseOrPoint (CONTAINER &C, const POINT_OR_POSE &p)
 Conversion of poses to MRPT containers (vector/matrix) More...
 
RANSAC detectors
template<typename NUMTYPE >
void ransac_detect_3D_planes (const CVectorDynamic< NUMTYPE > &x, const CVectorDynamic< NUMTYPE > &y, const CVectorDynamic< NUMTYPE > &z, std::vector< std::pair< size_t, TPlane >> &out_detected_planes, const double threshold, const size_t min_inliers_for_valid_plane=10)
 Fit a number of 3-D planes to a given point cloud, automatically determining the number of existing planes by means of the provided threshold and minimum number of supporting inliers. More...
 
template<typename NUMTYPE >
void ransac_detect_2D_lines (const CVectorDynamic< NUMTYPE > &x, const CVectorDynamic< NUMTYPE > &y, std::vector< std::pair< size_t, TLine2D >> &out_detected_lines, const double threshold, const size_t min_inliers_for_valid_line=5)
 Fit a number of 2-D lines to a given point cloud, automatically determining the number of existing lines by means of the provided threshold and minimum number of supporting inliers. More...
 
template<class POINTSMAP >
void ransac_detect_3D_planes (const POINTSMAP *points_map, std::vector< std::pair< size_t, TPlane >> &out_detected_planes, const double threshold, const size_t min_inliers_for_valid_plane)
 A stub for ransac_detect_3D_planes() with the points given as a mrpt::maps::CPointsMap. More...
 
SLERP (Spherical Linear Interpolation) functions
template<typename T >
void slerp (const CQuaternion< T > &q0, const CQuaternion< T > &q1, const double t, CQuaternion< T > &q)
 SLERP interpolation between two quaternions. More...
 
void slerp (const TPose3D &q0, const TPose3D &q1, const double t, TPose3D &p)
 SLERP interpolation between two 6D poses - like mrpt::math::slerp for quaternions, but interpolates the [X,Y,Z] coordinates as well. More...
 
void slerp_ypr (const mrpt::math::TPose3D &q0, const mrpt::math::TPose3D &q1, const double t, mrpt::math::TPose3D &p)
 

Variables

static constexpr unsigned char GEOMETRIC_TYPE_POINT = 0
 Object type identifier for TPoint2D or TPoint3D. More...
 
static constexpr unsigned char GEOMETRIC_TYPE_SEGMENT = 1
 Object type identifier for TSegment2D or TSegment3D. More...
 
static constexpr unsigned char GEOMETRIC_TYPE_LINE = 2
 Object type identifier for TLine2D or TLine3D. More...
 
static constexpr unsigned char GEOMETRIC_TYPE_POLYGON = 3
 Object type identifier for TPolygon2D or TPolygon3D. More...
 
static constexpr unsigned char GEOMETRIC_TYPE_PLANE = 4
 Object type identifier for TPlane. More...
 
static constexpr unsigned char GEOMETRIC_TYPE_UNDEFINED = 255
 Object type identifier for empty TObject2D or TObject3D. More...
 

Typedef Documentation

◆ CLevenbergMarquardt

The default name for the LM class is an instantiation for "double".

Definition at line 260 of file CLevenbergMarquardt.h.

◆ CMatrix_u16

using mrpt::math::CMatrix_u16 = typedef CMatrixDynamic<uint16_t>

matrix of uint16_t (non serializable).

See also
CMatrixDouble

Definition at line 584 of file CMatrixDynamic.h.

◆ CMatrix_u8

using mrpt::math::CMatrix_u8 = typedef CMatrixDynamic<uint8_t>

matrix of uint8_t (non serializable).

See also
CMatrixDouble

Definition at line 581 of file CMatrixDynamic.h.

◆ CMatrixBool

using mrpt::math::CMatrixBool = typedef CMatrixDynamic<bool>

Declares a matrix of booleans (non serializable).

See also
CMatrixDouble, CMatrixFloat, CMatrixB

Definition at line 561 of file CMatrixDynamic.h.

◆ CMatrixDouble

using mrpt::math::CMatrixDouble = typedef CMatrixDynamic<double>

Declares a matrix of double numbers (non serializable).

For a serializable version, use math::CMatrixD

See also
CMatrixFloat, CMatrixF, CMatrixD

Definition at line 573 of file CMatrixDynamic.h.

◆ CMatrixDouble12

using mrpt::math::CMatrixDouble12 = typedef CMatrixFixed<double, 1, 2>

Definition at line 360 of file CMatrixFixed.h.

◆ CMatrixDouble12_6

using mrpt::math::CMatrixDouble12_6 = typedef CMatrixFixed<double, 12, 6>

Definition at line 371 of file CMatrixFixed.h.

◆ CMatrixDouble13

using mrpt::math::CMatrixDouble13 = typedef CMatrixFixed<double, 1, 3>

Definition at line 356 of file CMatrixFixed.h.

◆ CMatrixDouble15

using mrpt::math::CMatrixDouble15 = typedef CMatrixFixed<double, 1, 5>

Definition at line 367 of file CMatrixFixed.h.

◆ CMatrixDouble16

using mrpt::math::CMatrixDouble16 = typedef CMatrixFixed<double, 1, 6>

Definition at line 363 of file CMatrixFixed.h.

◆ CMatrixDouble17

using mrpt::math::CMatrixDouble17 = typedef CMatrixFixed<double, 1, 7>

Definition at line 365 of file CMatrixFixed.h.

◆ CMatrixDouble21

using mrpt::math::CMatrixDouble21 = typedef CMatrixFixed<double, 2, 1>

Definition at line 361 of file CMatrixFixed.h.

◆ CMatrixDouble22

using mrpt::math::CMatrixDouble22 = typedef CMatrixFixed<double, 2, 2>

Definition at line 349 of file CMatrixFixed.h.

◆ CMatrixDouble23

using mrpt::math::CMatrixDouble23 = typedef CMatrixFixed<double, 2, 3>

Definition at line 350 of file CMatrixFixed.h.

◆ CMatrixDouble31

using mrpt::math::CMatrixDouble31 = typedef CMatrixFixed<double, 3, 1>

Definition at line 357 of file CMatrixFixed.h.

◆ CMatrixDouble32

using mrpt::math::CMatrixDouble32 = typedef CMatrixFixed<double, 3, 2>

Definition at line 351 of file CMatrixFixed.h.

◆ CMatrixDouble33

using mrpt::math::CMatrixDouble33 = typedef CMatrixFixed<double, 3, 3>
Examples:
serialization_json_example/test.cpp.

Definition at line 352 of file CMatrixFixed.h.

◆ CMatrixDouble34

using mrpt::math::CMatrixDouble34 = typedef CMatrixFixed<double, 3, 4>

Definition at line 358 of file CMatrixFixed.h.

◆ CMatrixDouble36

using mrpt::math::CMatrixDouble36 = typedef CMatrixFixed<double, 3, 6>

Definition at line 359 of file CMatrixFixed.h.

◆ CMatrixDouble39

using mrpt::math::CMatrixDouble39 = typedef CMatrixFixed<double, 3, 9>

Definition at line 372 of file CMatrixFixed.h.

◆ CMatrixDouble41

using mrpt::math::CMatrixDouble41 = typedef CMatrixFixed<double, 4, 1>

Definition at line 368 of file CMatrixFixed.h.

◆ CMatrixDouble43

using mrpt::math::CMatrixDouble43 = typedef CMatrixFixed<double, 4, 3>

Definition at line 369 of file CMatrixFixed.h.

◆ CMatrixDouble44

using mrpt::math::CMatrixDouble44 = typedef CMatrixFixed<double, 4, 4>

Definition at line 353 of file CMatrixFixed.h.

◆ CMatrixDouble51

using mrpt::math::CMatrixDouble51 = typedef CMatrixFixed<double, 5, 1>

Definition at line 366 of file CMatrixFixed.h.

◆ CMatrixDouble61

using mrpt::math::CMatrixDouble61 = typedef CMatrixFixed<double, 6, 1>

Definition at line 362 of file CMatrixFixed.h.

◆ CMatrixDouble66

using mrpt::math::CMatrixDouble66 = typedef CMatrixFixed<double, 6, 6>

Definition at line 354 of file CMatrixFixed.h.

◆ CMatrixDouble6_12

using mrpt::math::CMatrixDouble6_12 = typedef CMatrixFixed<double, 6, 12>

Definition at line 370 of file CMatrixFixed.h.

◆ CMatrixDouble71

using mrpt::math::CMatrixDouble71 = typedef CMatrixFixed<double, 7, 1>

Definition at line 364 of file CMatrixFixed.h.

◆ CMatrixDouble77

using mrpt::math::CMatrixDouble77 = typedef CMatrixFixed<double, 7, 7>

Definition at line 355 of file CMatrixFixed.h.

◆ CMatrixDouble93

using mrpt::math::CMatrixDouble93 = typedef CMatrixFixed<double, 9, 3>

Definition at line 373 of file CMatrixFixed.h.

◆ CMatrixFloat

using mrpt::math::CMatrixFloat = typedef CMatrixDynamic<float>

Declares a matrix of float numbers (non serializable).

For a serializable version, use math::CMatrixF

See also
CMatrixDouble, CMatrixF, CMatrixD

Definition at line 567 of file CMatrixDynamic.h.

◆ CMatrixFloat12

using mrpt::math::CMatrixFloat12 = typedef CMatrixFixed<float, 1, 2>

Definition at line 384 of file CMatrixFixed.h.

◆ CMatrixFloat13

using mrpt::math::CMatrixFloat13 = typedef CMatrixFixed<float, 1, 3>

Definition at line 382 of file CMatrixFixed.h.

◆ CMatrixFloat15

using mrpt::math::CMatrixFloat15 = typedef CMatrixFixed<float, 1, 5>

Definition at line 391 of file CMatrixFixed.h.

◆ CMatrixFloat16

using mrpt::math::CMatrixFloat16 = typedef CMatrixFixed<float, 1, 6>

Definition at line 387 of file CMatrixFixed.h.

◆ CMatrixFloat17

using mrpt::math::CMatrixFloat17 = typedef CMatrixFixed<float, 1, 7>

Definition at line 389 of file CMatrixFixed.h.

◆ CMatrixFloat21

using mrpt::math::CMatrixFloat21 = typedef CMatrixFixed<float, 2, 1>

Definition at line 385 of file CMatrixFixed.h.

◆ CMatrixFloat22

using mrpt::math::CMatrixFloat22 = typedef CMatrixFixed<float, 2, 2>

Definition at line 375 of file CMatrixFixed.h.

◆ CMatrixFloat23

using mrpt::math::CMatrixFloat23 = typedef CMatrixFixed<float, 2, 3>

Definition at line 376 of file CMatrixFixed.h.

◆ CMatrixFloat31

using mrpt::math::CMatrixFloat31 = typedef CMatrixFixed<float, 3, 1>

Definition at line 383 of file CMatrixFixed.h.

◆ CMatrixFloat32

using mrpt::math::CMatrixFloat32 = typedef CMatrixFixed<float, 3, 2>

Definition at line 377 of file CMatrixFixed.h.

◆ CMatrixFloat33

using mrpt::math::CMatrixFloat33 = typedef CMatrixFixed<float, 3, 3>

Definition at line 378 of file CMatrixFixed.h.

◆ CMatrixFloat44

using mrpt::math::CMatrixFloat44 = typedef CMatrixFixed<float, 4, 4>

Definition at line 379 of file CMatrixFixed.h.

◆ CMatrixFloat51

using mrpt::math::CMatrixFloat51 = typedef CMatrixFixed<float, 5, 1>

Definition at line 390 of file CMatrixFixed.h.

◆ CMatrixFloat61

using mrpt::math::CMatrixFloat61 = typedef CMatrixFixed<float, 6, 1>

Definition at line 386 of file CMatrixFixed.h.

◆ CMatrixFloat66

using mrpt::math::CMatrixFloat66 = typedef CMatrixFixed<float, 6, 6>

Definition at line 380 of file CMatrixFixed.h.

◆ CMatrixFloat71

using mrpt::math::CMatrixFloat71 = typedef CMatrixFixed<float, 7, 1>

Definition at line 388 of file CMatrixFixed.h.

◆ CMatrixFloat77

using mrpt::math::CMatrixFloat77 = typedef CMatrixFixed<float, 7, 7>

Definition at line 381 of file CMatrixFixed.h.

◆ CMatrixLongDouble

Declares a matrix of "long doubles" (non serializable), or of "doubles" if the compiler does not support "long double".

See also
CMatrixDouble, CMatrixFloat

Definition at line 597 of file CMatrixDynamic.h.

◆ CMatrixUInt

using mrpt::math::CMatrixUInt = typedef CMatrixDynamic<unsigned int>

Declares a matrix of unsigned ints (non serializable).

See also
CMatrixDouble, CMatrixFloat

Definition at line 578 of file CMatrixDynamic.h.

◆ CQuaternionDouble

using mrpt::math::CQuaternionDouble = typedef CQuaternion<double>

A quaternion of data type "double".

Definition at line 505 of file CQuaternion.h.

◆ CQuaternionFloat

using mrpt::math::CQuaternionFloat = typedef CQuaternion<float>

A quaternion of data type "float".

Definition at line 507 of file CQuaternion.h.

◆ CVectorDouble

using mrpt::math::CVectorDouble = typedef CVectorDynamic<double>

Definition at line 303 of file CVectorDynamic.h.

◆ CVectorFixed

template<typename T , std::size_t N>
using mrpt::math::CVectorFixed = typedef CMatrixFixed<T, N, 1>

CVectorFixed is an array for numeric types supporting several mathematical operations (actually, just a wrapper on Eigen::Matrix<T,N,1>)

See also
CVectorFixedFloat, CVectorFixedDouble, CArray

Definition at line 24 of file CVectorFixed.h.

◆ CVectorFixedDouble

template<std::size_t N>
using mrpt::math::CVectorFixedDouble = typedef CVectorFixed<double, N>

Specialization of CVectorFixed for double numbers.

See also
CVectorFixed

Definition at line 32 of file CVectorFixed.h.

◆ CVectorFixedFloat

template<std::size_t N>
using mrpt::math::CVectorFixedFloat = typedef CVectorFixed<float, N>

Specialization of CVectorFixed for float numbers.

See also
CVectorFixed

Definition at line 28 of file CVectorFixed.h.

◆ CVectorFloat

using mrpt::math::CVectorFloat = typedef CVectorDynamic<float>

Definition at line 302 of file CVectorDynamic.h.

◆ FFT_TYPE

using mrpt::math::FFT_TYPE = typedef float

Copyright(C) 1997 Takuya OOURA (email: ooura.nosp@m.@mmm.nosp@m..t.u-.nosp@m.toky.nosp@m.o.ac..nosp@m.jp).

You may use, copy, modify this code for any purpose and without fee. You may distribute this ORIGINAL package.

Definition at line 148 of file fourier.cpp.

◆ TPlane3D

using mrpt::math::TPlane3D = typedef TPlane

Definition at line 96 of file TPlane.h.

◆ TVector2D

Useful type alias for 2-vectors.

Definition at line 279 of file TPoint3D.h.

◆ TVector3D

Useful type alias for 3-vectors.

Definition at line 276 of file TPoint3D.h.

Enumeration Type Documentation

◆ TConstructorFlags_Matrices

For usage in one of the constructors of CMatrixFixed or CMatrixDynamic (and derived classes), if it's not required to fill it with zeros at the constructor to save time.

Enumerator
UNINITIALIZED_MATRIX 

Definition at line 55 of file math_frwds.h.

◆ TConstructorFlags_Quaternions

Enumerator
UNINITIALIZED_QUATERNION 

Definition at line 20 of file CQuaternion.h.

Function Documentation

◆ absDiff()

template<class T >
T mrpt::math::absDiff ( const T &  lhs,
const T &  rhs 
)

◆ adjustRange()

template<class CONTAINER >
void mrpt::math::adjustRange ( CONTAINER &  m,
const typename CONTAINER::Scalar  minVal,
const typename CONTAINER::Scalar  maxVal 
)

Adjusts the range of all the elements such as the minimum and maximum values being those supplied by the user.

Definition at line 307 of file ops_containers.h.

References minimum_maximum().

Here is the call graph for this function:

◆ approximatelyEqual() [1/2]

template<class T1 , class T2 >
bool mrpt::math::approximatelyEqual ( T1  a,
T1  b,
T2  epsilon 
)

Compare 2 floats and determine whether they are equal.

Returns
True if equal, false otherwise
Parameters
aFist num
bSecond num
epsilonDifference below which a, b are considered equal

Definition at line 36 of file math/include/mrpt/math/utils.h.

Referenced by mrpt::graphslam::deciders::CLoopCloserERD< GRAPH_T >::addScanMatchingEdges(), approximatelyEqual(), and mrpt::graphslam::deciders::CLoopCloserERD< GRAPH_T >::computeDominantEigenVector().

Here is the caller graph for this function:

◆ approximatelyEqual() [2/2]

template<class T >
bool mrpt::math::approximatelyEqual ( a,
b 
)

Compare 2 floats and determine whether they are equal.

Returns
True if equal, false otherwise
Parameters
aFist num
bSecond num

Definition at line 47 of file math/include/mrpt/math/utils.h.

References approximatelyEqual().

Here is the call graph for this function:

◆ bitrv2()

static void mrpt::math::bitrv2 ( int  n,
int *  ip,
FFT_TYPE a 
)
static

Copyright(C) 1997 Takuya OOURA (email: ooura.nosp@m.@mmm.nosp@m..t.u-.nosp@m.toky.nosp@m.o.ac..nosp@m.jp).

You may use, copy, modify this code for any purpose and without fee. You may distribute this ORIGINAL package.

Definition at line 456 of file fourier.cpp.

Referenced by cdft(), makewt(), and rdft().

Here is the caller graph for this function:

◆ cdft()

static void mrpt::math::cdft ( int  n,
int  isgn,
FFT_TYPE a,
int *  ip,
FFT_TYPE w 
)
static

Copyright(C) 1997 Takuya OOURA (email: ooura.nosp@m.@mmm.nosp@m..t.u-.nosp@m.toky.nosp@m.o.ac..nosp@m.jp).

You may use, copy, modify this code for any purpose and without fee. You may distribute this ORIGINAL package.

Definition at line 523 of file fourier.cpp.

References bitrv2(), cftbsub(), cftfsub(), and makewt().

Referenced by cdft2d(), and rdft2d().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cdft2d()

static void mrpt::math::cdft2d ( int  n1,
int  n2,
int  isgn,
FFT_TYPE **  a,
FFT_TYPE t,
int *  ip,
FFT_TYPE w 
)
static


Copyright(C) 1997 Takuya OOURA (email: ooura.nosp@m.@mmm.nosp@m..t.u-.nosp@m.toky.nosp@m.o.ac..nosp@m.jp).

You may use, copy, modify this code for any purpose and without fee. You may distribute this ORIGINAL package.

-----— Complex DFT (Discrete Fourier Transform) -----— [definition] <case1> X[k1][k2] = sum_j1=0^n1-1 sum_j2=0^n2-1 x[j1][j2] * exp(2*pi*i*j1*k1/n1) * exp(2*pi*i*j2*k2/n2), 0<=k1<n1, 0<=k2<n2 <case2> X[k1][k2] = sum_j1=0^n1-1 sum_j2=0^n2-1 x[j1][j2] * exp(-2*pi*i*j1*k1/n1) * exp(-2*pi*i*j2*k2/n2), 0<=k1<n1, 0<=k2<n2 (notes: sum_j=0^n-1 is a summation from j=0 to n-1) [usage] <case1> ip[0] = 0; // first time only cdft2d(n1, 2*n2, 1, a, t, ip, w); <case2> ip[0] = 0; // first time only cdft2d(n1, 2*n2, -1, a, t, ip, w); [parameters] n1 :data length (int) n1 >= 1, n1 = power of 2 2*n2 :data length (int) n2 >= 1, n2 = power of 2 a[0...n1-1][0...2*n2-1] :input/output data (double **) input data a[j1][2*j2] = Re(x[j1][j2]), a[j1][2*j2+1] = Im(x[j1][j2]), 0<=j1<n1, 0<=j2<n2 output data a[k1][2*k2] = Re(X[k1][k2]), a[k1][2*k2+1] = Im(X[k1][k2]), 0<=k1<n1, 0<=k2<n2 t[0...2*n1-1] :work area (double *) ip[0...*] :work area for bit reversal (int *) length of ip >= 2+sqrt(n) ; if n % 4 == 0 2+sqrt(n/2); otherwise (n = max(n1, n2)) ip[0],ip[1] are pointers of the cos/sin table. w[0...*] :cos/sin table (double *) length of w >= max(n1/2, n2/2) w[],ip[] are initialized if ip[0] == 0. [remark] Inverse of cdft2d(n1, 2*n2, -1, a, t, ip, w); is cdft2d(n1, 2*n2, 1, a, t, ip, w); for (j1 = 0; j1 <= n1 - 1; j1++) { for (j2 = 0; j2 <= 2 * n2 - 1; j2++) { a[j1][j2] *= 1.0 / (n1 * n2); } }

Definition at line 887 of file fourier.cpp.

References cdft(), and makewt().

Referenced by dft2_complex(), and idft2_complex().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cftbsub()

static void mrpt::math::cftbsub ( int  n,
FFT_TYPE a,
FFT_TYPE w 
)
static

Definition at line 157 of file fourier.cpp.

Referenced by cdft(), and rdft().

Here is the caller graph for this function:

◆ cftfsub()

static void mrpt::math::cftfsub ( int  n,
FFT_TYPE a,
FFT_TYPE w 
)
static

Definition at line 277 of file fourier.cpp.

Referenced by cdft(), and rdft().

Here is the caller graph for this function:

◆ containerFromPoseOrPoint()

template<class CONTAINER , class POINT_OR_POSE >
CONTAINER& mrpt::math::containerFromPoseOrPoint ( CONTAINER &  C,
const POINT_OR_POSE &  p 
)

Conversion of poses to MRPT containers (vector/matrix)

Definition at line 24 of file point_poses2vectors.h.

◆ countCommonElements()

template<class CONTAINER1 , class CONTAINER2 >
size_t mrpt::math::countCommonElements ( const CONTAINER1 &  a,
const CONTAINER2 &  b 
)

Counts the number of elements that appear in both STL-like containers (comparison through the == operator) It is assumed that no repeated elements appear within each of the containers.

Definition at line 295 of file ops_containers.h.

Referenced by mrpt::slam::CRangeBearingKFSLAM::computeOffDiagonalBlocksApproximationError().

Here is the caller graph for this function:

◆ cov()

template<class MATRIX >
CMatrixDouble mrpt::math::cov ( const MATRIX &  v)

Computes the covariance matrix from a list of samples in an NxM matrix, where each row is a sample, so the covariance is MxM.

Parameters
vThe set of data, as a NxM matrix.
out_covThe output MxM matrix for the estimated covariance matrix.
See also
math::mean,math::stddev, math::cov

Definition at line 149 of file ops_matrices.h.

References meanAndCovMat().

Referenced by mrpt::poses::CPosePDFGaussianInf::bayesianFusion(), mrpt::detectors::CFaceDetection::checkIfFacePlaneCov(), mrpt::poses::CPose3DPDFGaussianInf::copyFrom(), mrpt::poses::CPosePDFSOG::copyFrom(), mrpt::apps::MonteCarloLocalization_Base::do_pf_localization(), mrpt::random::CRandomGenerator::drawDefinitePositiveMatrix(), mrpt::random::CRandomGenerator::drawGaussianMultivariate(), mrpt::random::CRandomGenerator::drawGaussianMultivariateMany(), mrpt::poses::CPose3DPDFGaussianInf::drawManySamples(), mrpt::poses::CPosePDFGaussianInf::drawManySamples(), mrpt::poses::CPose3DPDFGaussianInf::drawSingleSample(), mrpt::poses::CPosePDFGaussianInf::drawSingleSample(), mrpt::poses::CPosePDFGaussianInf::evaluateNormalizedPDF(), PosePDFGaussTests::generateRandomPose2DPDF(), Pose3DPDFGaussTests::generateRandomPose3DPDF(), Pose3DQuatPDFGaussTests::generateRandomPose3DPDF(), mrpt::math::CProbabilityDensityFunction< CPose2D, 3 >::getCovariance(), mrpt::poses::CPointPDFParticles::getCovarianceAndMean(), mrpt::poses::CPose3DPDFParticles::getCovarianceAndMean(), mrpt::poses::CPosePDFParticles::getCovarianceAndMean(), mrpt::poses::CPosePDFSOG::getCovarianceAndMean(), mrpt::math::CProbabilityDensityFunction< CPose2D, 3 >::getCovarianceDynAndMean(), mrpt::poses::CPosePDFSOG::getMostLikelyCovarianceAndMean(), mrpt::poses::CPosePDFSOG::inverse(), mahalanobisDistance(), mahalanobisDistance2(), mahalanobisDistance2AndLogPDF(), mahalanobisDistance2AndPDF(), mrpt::poses::CPose3DPDFGaussianInf::mahalanobisDistanceTo(), MATLAB_plotCovariance2D(), mrpt::poses::CPosePDFSOG::mergeModes(), normalPDF(), mrpt::obs::CActionRobotMovement2D::prepareFastDrawSingleSample_modelGaussian(), mrpt::slam::CMetricMapBuilderRBPF::processActionObservation(), mrpt::random::randomNormalMultiDimensional(), mrpt::random::randomNormalMultiDimensionalMany(), run_test_pf_localization(), mrpt::slam::CRangeBearingKFSLAM2D::saveMapAndPath2DRepresentationAsMATLABFile(), mrpt::slam::CRangeBearingKFSLAM::saveMapAndPath2DRepresentationAsMATLABFile(), mrpt::maps::CLandmarksMap::saveToMATLABScript2D(), mrpt::poses::CPoseRandomSampler::setPosePDF(), and TEST().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ covVector()

template<class VECTOR_OF_VECTOR , class RETURN_MATRIX >
RETURN_MATRIX mrpt::math::covVector ( const VECTOR_OF_VECTOR &  v)
inline

Computes the covariance matrix from a list of values given as a vector of vectors, where each row is a sample.

Parameters
vThe set of data, as a vector of N vectors of M elements.
out_covThe output MxM matrix for the estimated covariance matrix.
Template Parameters
RETURN_MATRIXThe type of the returned matrix, e.g. Eigen::MatrixXd
See also
math::mean,math::stddev, math::cov, meanAndCovVec

Definition at line 418 of file ops_containers.h.

References meanAndCovVec().

Here is the call graph for this function:

◆ cumsum() [1/2]

template<class CONTAINER1 , class CONTAINER2 >
void mrpt::math::cumsum ( const CONTAINER1 &  in_data,
CONTAINER2 &  out_cumsum 
)
inline

Definition at line 112 of file ops_containers.h.

Referenced by confidenceIntervals(), and cumsum().

Here is the caller graph for this function:

◆ cumsum() [2/2]

template<class CONTAINER >
CONTAINER mrpt::math::cumsum ( const CONTAINER &  in_data)
inline

Computes the cumulative sum of all the elements.

See also
sum

Definition at line 120 of file ops_containers.h.

References cumsum().

Here is the call graph for this function:

◆ cumsum_tmpl()

template<class CONTAINER1 , class CONTAINER2 >
void mrpt::math::cumsum_tmpl ( const CONTAINER1 &  in_data,
CONTAINER2 &  out_cumsum 
)
inline

Computes the cumulative sum of all the elements, saving the result in another container.

This works for both matrices (even mixing their types) and vectores/arrays (even mixing types), and even to store the cumsum of any matrix into any vector/array, but not in opposite direction.

See also
sum

Definition at line 101 of file ops_containers.h.

References resizeLike().

Here is the call graph for this function:

◆ dotProduct() [1/2]

template<class CONTAINER1 , class CONTAINER2 >
CONTAINER1::Scalar mrpt::math::dotProduct ( const CONTAINER1 &  v1,
const CONTAINER1 &  v2 
)
inline

v1*v2: The dot product of two containers (vectors/arrays/matrices)

Definition at line 200 of file ops_containers.h.

◆ dotProduct() [2/2]

template<size_t N, class T , class U , class V >
T mrpt::math::dotProduct ( const U &  v1,
const V &  v2 
)
inline

v1*v2: The dot product of any two objects supporting []

Definition at line 208 of file ops_containers.h.

◆ extractSubmatrixSymmetrical()

template<typename MAT , typename MATRIX >
void mrpt::math::extractSubmatrixSymmetrical ( const MAT &  m,
const std::vector< size_t > &  indices,
MATRIX &  out 
)

Get a submatrix from a square matrix, by collecting the elements M(idxs,idxs), where idxs is the sequence of indices passed as argument.

A perfect application of this method is in extracting covariance matrices of a subset of variables from the full covariance matrix.

See also
extractSubmatrix, extractSubmatrixSymmetricalBlocks

Definition at line 310 of file ops_matrices.h.

References out.

Referenced by mrpt::bayes::CKalmanFilterCapable< 7, 3, 3, 7 >::runOneKalmanIteration(), and TEST().

Here is the caller graph for this function:

◆ extractSubmatrixSymmetricalBlocks()

template<std::size_t BLOCKSIZE, typename MAT , typename MATRIX >
void mrpt::math::extractSubmatrixSymmetricalBlocks ( const MAT &  m,
const std::vector< size_t > &  block_indices,
MATRIX &  out 
)

Get a submatrix from a square matrix, by collecting the elements M(idxs,idxs), where idxs is a sequence {block_indices(i):block_indices(i)+BLOCKSIZE-1} for all "i" up to the size of block_indices.

A perfect application of this method is in extracting covariance matrices of a subset of variables from the full covariance matrix.

See also
extractSubmatrix, extractSubmatrixSymmetrical

Definition at line 230 of file ops_matrices.h.

References nanoflann::BLOCKSIZE, and out.

◆ extractSubmatrixSymmetricalBlocksDyn()

template<typename MAT , typename MATRIX >
void mrpt::math::extractSubmatrixSymmetricalBlocksDyn ( const MAT &  m,
const std::size_t  BLOCKSIZE,
const std::vector< size_t > &  block_indices,
MATRIX &  out 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 266 of file ops_matrices.h.

References nanoflann::BLOCKSIZE, and out.

Referenced by mrpt::slam::joint_pdf_metric().

Here is the caller graph for this function:

◆ four1()

static void mrpt::math::four1 ( float  data[],
unsigned long  nn,
int  isign 
)
static

Definition at line 32 of file fourier.cpp.

Referenced by realft().

Here is the caller graph for this function:

◆ getColumnAccessor() [1/4]

template<typename MAT >
CMatrixColumnAccessor<MAT> mrpt::math::getColumnAccessor ( MAT &  m,
size_t  colIdx 
)
inline

Definition at line 547 of file matrix_adaptors.h.

◆ getColumnAccessor() [2/4]

template<typename MAT >
CMatrixColumnAccessorExtended<MAT> mrpt::math::getColumnAccessor ( MAT &  m,
size_t  colIdx,
size_t  offset,
size_t  space = 1 
)
inline

Definition at line 622 of file matrix_adaptors.h.

◆ getColumnAccessor() [3/4]

template<typename MAT >
CConstMatrixColumnAccessor<MAT> mrpt::math::getColumnAccessor ( const MAT &  m,
size_t  colIdx 
)
inline

Definition at line 678 of file matrix_adaptors.h.

◆ getColumnAccessor() [4/4]

template<typename MAT >
CConstMatrixColumnAccessorExtended<MAT> mrpt::math::getColumnAccessor ( const MAT &  m,
size_t  colIdx,
size_t  offset,
size_t  space = 1 
)
inline

Definition at line 739 of file matrix_adaptors.h.

◆ getRowAccessor() [1/4]

template<typename MAT >
CMatrixRowAccessor<MAT> mrpt::math::getRowAccessor ( MAT &  m,
size_t  rowIdx 
)
inline

Definition at line 279 of file matrix_adaptors.h.

◆ getRowAccessor() [2/4]

template<typename MAT >
CMatrixRowAccessorExtended<MAT> mrpt::math::getRowAccessor ( MAT &  m,
size_t  rowIdx,
size_t  offset,
size_t  space = 1 
)
inline

Definition at line 356 of file matrix_adaptors.h.

◆ getRowAccessor() [3/4]

template<typename MAT >
CConstMatrixRowAccessor<MAT> mrpt::math::getRowAccessor ( const MAT &  m,
size_t  rowIdx 
)
inline

Definition at line 414 of file matrix_adaptors.h.

◆ getRowAccessor() [4/4]

template<typename MAT >
CConstMatrixRowAccessorExtended<MAT> mrpt::math::getRowAccessor ( const MAT &  m,
size_t  rowIdx,
size_t  offset,
size_t  space = 1 
)
inline

Definition at line 476 of file matrix_adaptors.h.

◆ histogram()

template<class CONTAINER >
std::vector<double> mrpt::math::histogram ( const CONTAINER &  v,
double  limit_min,
double  limit_max,
size_t  number_bins,
bool  do_normalization = false,
std::vector< double > *  out_bin_centers = nullptr 
)

Computes the normalized or normal histogram of a sequence of numbers given the number of bins and the limits.

In any case this is a "linear" histogram, i.e. for matrices, all the elements are taken as if they were a plain sequence, not taking into account they were in columns or rows. If desired, out_bin_centers can be set to receive the bins centers.

Definition at line 64 of file ops_containers.h.

References mrpt::math::CHistogram::add(), mrpt::math::CHistogram::getHistogram(), and mrpt::math::CHistogram::getHistogramNormalized().

Referenced by confidenceIntervals().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ homogeneousMatrixInverse() [1/3]

template<class MATRIXLIKE1 , class MATRIXLIKE2 >
void mrpt::math::homogeneousMatrixInverse ( const MATRIXLIKE1 &  M,
MATRIXLIKE2 &  out_inverse_M 
)

Efficiently compute the inverse of a 4x4 homogeneous matrix by only transposing the rotation 3x3 part and solving the translation with dot products.

This is a generic template which works with: MATRIXLIKE: CMatrixDynamic, CMatrixFixed

Definition at line 22 of file homog_matrices.h.

References ASSERT_, MRPT_END, and MRPT_START.

Referenced by mrpt::math::TPose3D::getInverseHomogeneousMatrix(), mrpt::poses::CPoseOrPoint< CPose2D, DIM >::getInverseHomogeneousMatrix(), mrpt::poses::CPose3D::inverse(), mrpt::poses::CPose3D::inverseComposeFrom(), and mrpt::obs::detail::project3DPointsFromDepthImageInto().

Here is the caller graph for this function:

◆ homogeneousMatrixInverse() [2/3]

template<class IN_ROTMATRIX , class IN_XYZ , class OUT_ROTMATRIX , class OUT_XYZ >
void mrpt::math::homogeneousMatrixInverse ( const IN_ROTMATRIX &  in_R,
const IN_XYZ &  in_xyz,
OUT_ROTMATRIX &  out_R,
OUT_XYZ &  out_xyz 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 74 of file homog_matrices.h.

References ASSERT_, MRPT_END, and MRPT_START.

◆ homogeneousMatrixInverse() [3/3]

template<class MATRIXLIKE >
void mrpt::math::homogeneousMatrixInverse ( MATRIXLIKE &  M)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 100 of file homog_matrices.h.

References ASSERTDEB_.

◆ internalAssertEigenDefined()

template<typename DER >
void mrpt::math::internalAssertEigenDefined ( )

Issues a static_assert() error if trying to compile a method that requires Eigen headers, without including them.

Definition at line 443 of file MatrixVectorBase.h.

◆ isLeft()

double mrpt::math::isLeft ( const mrpt::math::TPoint2D P0,
const mrpt::math::TPoint2D P1,
const mrpt::math::TPoint2D P2 
)
inline

Definition at line 1118 of file TPoseOrPoint.cpp.

References mrpt::math::TPoint2D_data::x, and mrpt::math::TPoint2D_data::y.

Referenced by mrpt::math::TPolygon2D::contains().

Here is the caller graph for this function:

◆ kmeans()

template<class LIST_OF_VECTORS1 , class LIST_OF_VECTORS2 >
double mrpt::math::kmeans ( const size_t  k,
const LIST_OF_VECTORS1 &  points,
std::vector< int > &  assignments,
LIST_OF_VECTORS2 *  out_centers = nullptr,
const size_t  attempts = 3 
)
inline

k-means algorithm to cluster a list of N points of arbitrary dimensionality into exactly K clusters.

The list of input points can be any template CONTAINER<POINT> with:

  • CONTAINER can be: Any STL container: std::vector,std::list,std::deque,...
  • POINT can be:
    • std::vector<double/float>
    • CVectorFixedDouble<N> / CVectorFixedFloat<N>
Parameters
k[IN] Number of cluster to look for.
points[IN] The list of N input points. It can be any STL-like containers of std::vector<float/double>, for example a std::vector<mrpt::math::CVectorDouble>, a std::list<CVectorFloat>, etc...
assignments[OUT] At output it will have a number [0,k-1] for each of the N input points.
out_centers[OUT] If not nullptr, at output will have the centers of each group. Can be of any of the supported types of "points", but the basic coordinates should be float or double exactly as in "points".
attempts[IN] Number of attempts.
See also
A more advanced algorithm, see: kmeanspp
Note
Uses the kmeans++ implementation by David Arthur (2009, http://www.stanford.edu/~darthur/kmpp.zip).

Definition at line 123 of file include/mrpt/math/kmeans.h.

References mrpt::math::detail::stub_kmeans().

Here is the call graph for this function:

◆ kmeanspp()

template<class LIST_OF_VECTORS1 , class LIST_OF_VECTORS2 = LIST_OF_VECTORS1>
double mrpt::math::kmeanspp ( const size_t  k,
const LIST_OF_VECTORS1 &  points,
std::vector< int > &  assignments,
LIST_OF_VECTORS2 *  out_centers = nullptr,
const size_t  attempts = 3 
)
inline

k-means++ algorithm to cluster a list of N points of arbitrary dimensionality into exactly K clusters.

The list of input points can be any template CONTAINER<POINT> with:

  • CONTAINER can be: Any STL container: std::vector,std::list,std::deque,...
  • POINT can be:
    • std::vector<double/float>
    • CVectorFixedDouble<N> / CVectorFixedFloat<N>
Parameters
k[IN] Number of cluster to look for.
points[IN] The list of N input points. It can be any STL-like containers of std::vector<float/double>, for example a std::vector<mrpt::math::CVectorDouble>, a std::list<CVectorFloat>, etc...
assignments[OUT] At output it will have a number [0,k-1] for each of the N input points.
out_centers[OUT] If not nullptr, at output will have the centers of each group. Can be of any of the supported types of "points", but the basic coordinates should be float or double exactly as in "points".
attempts[IN] Number of attempts.
See also
The standard kmeans algorithm, see: kmeans
Note
Uses the kmeans++ implementation by David Arthur (2009, http://www.stanford.edu/~darthur/kmpp.zip).

Definition at line 158 of file include/mrpt/math/kmeans.h.

References mrpt::math::detail::stub_kmeans().

Referenced by find_chessboard_corners_multiple().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ laplacian()

template<typename MATIN , typename MATOUT >
void mrpt::math::laplacian ( const MATIN &  g,
MATOUT &  ret 
)

Computes the Laplacian of a square graph weight matrix.

The laplacian matrix is L = D - W, with D a diagonal matrix with the degree of each node, W the edge weights.

Definition at line 207 of file ops_matrices.h.

Referenced by mrpt::graphs::CGraphPartitioner< GRAPH_MATRIX, num_t >::SpectralBisection(), and TEST().

Here is the caller graph for this function:

◆ makect()

static void mrpt::math::makect ( int  nc,
int *  ip,
FFT_TYPE c 
)
static

Copyright(C) 1997 Takuya OOURA (email: ooura.nosp@m.@mmm.nosp@m..t.u-.nosp@m.toky.nosp@m.o.ac..nosp@m.jp).

You may use, copy, modify this code for any purpose and without fee. You may distribute this ORIGINAL package.

Definition at line 431 of file fourier.cpp.

Referenced by rdft(), and rdft2d().

Here is the caller graph for this function:

◆ makewt()

static void mrpt::math::makewt ( int  nw,
int *  ip,
FFT_TYPE w 
)
static

Definition at line 397 of file fourier.cpp.

References bitrv2().

Referenced by cdft(), cdft2d(), rdft(), and rdft2d().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mat2eig()

template<class MAT >
auto mrpt::math::mat2eig ( const MAT &  m,
typename MAT::eigen_t *  = nullptr 
)

Definition at line 26 of file mat2eig.h.

◆ maximum() [1/3]

template<class CONTAINER , int = CONTAINER::is_mrpt_type>
CONTAINER::Scalar mrpt::math::maximum ( const CONTAINER &  v)
inline

◆ maximum() [2/3]

template<class Derived >
Derived::Scalar mrpt::math::maximum ( const Eigen::MatrixBase< Derived > &  v)
inline

Definition at line 149 of file ops_containers.h.

◆ maximum() [3/3]

template<typename T >
T mrpt::math::maximum ( const std::vector< T > &  v)
inline

Definition at line 160 of file ops_containers.h.

References ASSERT_, and mrpt::keep_max().

Here is the call graph for this function:

◆ mean()

template<class CONTAINER >
double mrpt::math::mean ( const CONTAINER &  v)
inline

Computes the mean value of a vector.

Returns
The mean, as a double number.
See also
math::stddev,math::meanAndStd

Definition at line 244 of file ops_containers.h.

References sum().

Referenced by mrpt::slam::CGridMapAligner::AlignPDF_robustMatch(), mrpt::opengl::detail::aux_add3DpointWithEigenVectors(), mrpt::vision::pnp::rpnp::calcampose(), confidenceIntervals(), mrpt::poses::CPosePDFSOG::copyFrom(), mrpt::random::CRandomGenerator::drawGaussian1D(), mrpt::random::CRandomGenerator::drawGaussian1DMatrix(), mrpt::random::CRandomGenerator::drawGaussian1DVector(), mrpt::random::CRandomGenerator::drawGaussianMultivariate(), mrpt::random::CRandomGenerator::drawGaussianMultivariateMany(), mrpt::opengl::detail::generalizedEllipsoidPoints< 2 >(), mrpt::opengl::detail::generalizedEllipsoidPoints< 3 >(), mrpt::poses::CPointPDFParticles::getCovarianceAndMean(), mrpt::math::CProbabilityDensityFunction< CPose2D, 3 >::getCovarianceAndMean(), mrpt::poses::CPose3DPDFParticles::getCovarianceAndMean(), mrpt::poses::CPose3DPDFSOG::getCovarianceAndMean(), mrpt::poses::CPosePDFParticles::getCovarianceAndMean(), mrpt::graphslam::TSlidingWindow::getStdDev(), mrpt::maps::CGasConcentrationGridMap2D::internal_insertObservation(), mrpt::opengl::COctreePointRenderer< CPointCloudColoured >::internal_recursive_split(), mrpt::poses::CPosePDFSOG::inverse(), MATLAB_plotCovariance2D(), mrpt::random::matrixRandomNormal(), mrpt::poses::CPosePDFSOG::mergeModes(), mrpt::slam::PF_implementation< mrpt::math::TPose3D, CMonteCarloLocalization3D, mrpt::bayes::particle_storage_mode::VALUE >::PF_SLAM_implementation_pfAuxiliaryPFStandardAndOptimal(), mrpt::hmtslam::CLSLAM_RBPF_2DLASER::prediction_and_update_pfAuxiliaryPFOptimal(), mrpt::apps::CGridMapAlignerApp::run(), mrpt::apps::KFSLAMApp::Run_KF_SLAM(), mrpt::slam::CRangeBearingKFSLAM2D::saveMapAndPath2DRepresentationAsMATLABFile(), mrpt::slam::CRangeBearingKFSLAM::saveMapAndPath2DRepresentationAsMATLABFile(), mrpt::maps::CWirelessPowerGridMap2D::serializeFrom(), mrpt::maps::CGasConcentrationGridMap2D::serializeFrom(), mrpt::graphs::CGraphPartitioner< GRAPH_MATRIX, num_t >::SpectralBisection(), TEST_F(), and mrpt::random::vectorRandomNormal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ meanAndCovMat()

template<class MAT_IN , class VECTOR , class MAT_OUT >
void mrpt::math::meanAndCovMat ( const MAT_IN &  v,
VECTOR &  out_mean,
MAT_OUT &  out_cov 
)

Computes the mean vector and covariance from a list of samples in an NxM matrix, where each row is a sample, so the covariance is MxM.

Parameters
vThe set of data as a NxM matrix, of types: CMatrixDynamic or CMatrixFixed
out_meanThe output M-vector for the estimated mean.
out_covThe output MxM matrix for the estimated covariance matrix, this can also be either a fixed-size of dynamic size matrix.
See also
mrpt::math::meanAndCovVec, math::mean,math::stddev, math::cov

Definition at line 80 of file ops_matrices.h.

References ASSERTMSG_, and mrpt::square().

Referenced by cov().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ meanAndCovVec()

template<class VECTOR_OF_VECTOR , class VECTORLIKE , class MATRIXLIKE >
void mrpt::math::meanAndCovVec ( const VECTOR_OF_VECTOR &  v,
VECTORLIKE &  out_mean,
MATRIXLIKE &  out_cov 
)

Computes the mean vector and covariance from a list of values given as a vector of vectors, where each row is a sample.

Parameters
vThe set of data, as a vector of N vectors of M elements.
out_meanThe output M-vector for the estimated mean.
out_covThe output MxM matrix for the estimated covariance matrix.
See also
mrpt::math::meanAndCovMat, math::mean,math::stddev, math::cov

Definition at line 374 of file ops_containers.h.

References ASSERTMSG_, and mrpt::square().

Referenced by covVector().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ meanAndStd()

template<class VECTORLIKE >
void mrpt::math::meanAndStd ( const VECTORLIKE &  v,
double &  out_mean,
double &  out_std,
bool  unbiased = true 
)

Computes the standard deviation of a vector (or all elements of a matrix)

Parameters
vThe set of data, either as a vector, or a matrix (arrangement of data is ignored in this function).
out_meanThe output for the estimated mean
out_stdThe output for the estimated standard deviation
unbiasedIf set to true or false the std is normalized by "N-1" or "N", respectively.
See also
math::mean,math::stddev

Definition at line 329 of file ops_containers.h.

References mrpt::square(), and sum().

Referenced by mrpt::detectors::CFaceDetection::experimental_showMeasurements(), mrpt::vision::CFeature::internal_distanceBetweenPolarImages(), mrpt::vision::normalizeImage(), stddev(), and TEST().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ meanAndStdColumns()

template<class MAT_IN , class VEC >
void mrpt::math::meanAndStdColumns ( const MAT_IN &  m,
VEC &  outMeanVector,
VEC &  outStdVector,
const bool  unbiased_variance = true 
)

Computes a row with the mean values of each column in the matrix and the associated vector with the standard deviation of each column.

See also
mean,meanAndStdAll
Exceptions
std::exceptionIf the matrix/vector is empty.
Parameters
unbiased_varianceStandard deviation is sum(vals-mean)/K, with K=N-1 or N for unbiased_variance=true or false, respectively.

Definition at line 122 of file ops_matrices.h.

References mrpt::square().

Referenced by TEST().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ minimum() [1/3]

template<class CONTAINER , int = CONTAINER::is_mrpt_type>
CONTAINER::Scalar mrpt::math::minimum ( const CONTAINER &  v)
inline

◆ minimum() [2/3]

template<class Derived >
Derived::Scalar mrpt::math::minimum ( const Eigen::MatrixBase< Derived > &  v)
inline

Definition at line 154 of file ops_containers.h.

◆ minimum() [3/3]

template<typename T >
T mrpt::math::minimum ( const std::vector< T > &  v)
inline

Definition at line 168 of file ops_containers.h.

References ASSERT_, and mrpt::keep_min().

Here is the call graph for this function:

◆ minimum_maximum() [1/2]

template<typename T >
void mrpt::math::minimum_maximum ( const std::vector< T > &  V,
T &  curMin,
T &  curMax 
)
inline

Return the maximum and minimum values of a std::vector.

Definition at line 254 of file ops_containers.h.

References ASSERT_, mrpt::keep_max(), and mrpt::keep_min().

Referenced by adjustRange(), and mrpt::opengl::CPointCloud::render().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ minimum_maximum() [2/2]

template<class Derived >
void mrpt::math::minimum_maximum ( const Eigen::MatrixBase< Derived > &  V,
typename Eigen::MatrixBase< Derived >::Scalar curMin,
typename Eigen::MatrixBase< Derived >::Scalar curMax 
)
inline

Return the maximum and minimum values of a Eigen-based vector or matrix.

Definition at line 268 of file ops_containers.h.

◆ multiply_A_skew3()

template<class MAT_A , class SKEW_3VECTOR , class MAT_OUT >
void mrpt::math::multiply_A_skew3 ( const MAT_A &  A,
const SKEW_3VECTOR &  v,
MAT_OUT &  out 
)

Only for vectors/arrays "v" of length3, compute out = A * Skew(v), where Skew(v) is the skew symmetric matric generated from v (see mrpt::math::skew_symmetric3)

Definition at line 165 of file ops_matrices.h.

References ASSERT_EQUAL_, MRPT_END, MRPT_START, and out.

Referenced by TEST().

Here is the caller graph for this function:

◆ multiply_HCHt() [1/2]

template<typename MAT_H , typename MAT_C , typename MAT_R >
void mrpt::math::multiply_HCHt ( const MAT_H &  H,
const MAT_C &  C,
MAT_R &  R,
bool  accumResultInOutput = false 
)
inline

R = H * C * H^t.

Definition at line 28 of file ops_matrices.h.

References mat2eig(), and R.

Referenced by mrpt::bayes::detail::addNewLandmarks(), mrpt::slam::CGridMapAligner::AlignPDF_robustMatch(), mrpt::poses::CPose3DQuatPDFGaussianInf::changeCoordinatesReference(), mrpt::poses::CPose3DQuatPDFGaussian::changeCoordinatesReference(), mrpt::poses::CPose3DPDFGaussian::changeCoordinatesReference(), mrpt::poses::CPosePDFSOG::changeCoordinatesReference(), mrpt::obs::CActionRobotMovement2D::computeFromOdometry_modelGaussian(), mrpt::poses::CPose3DQuatPDFGaussian::copyFrom(), mrpt::poses::CPose3DPDFGaussian::copyFrom(), mrpt::maps::CBeacon::generateRingSOG(), mrpt::poses::CPose3DQuatPDFGaussianInf::inverse(), mrpt::poses::CPose3DQuatPDFGaussian::inverse(), mrpt::poses::CPosePDFGaussian::inverseComposition(), mrpt::maps::CLandmarksMap::loadSiftFeaturesFromImageObservation(), mrpt::poses::CPose3DQuatPDFGaussianInf::operator+=(), mrpt::poses::CPose3DQuatPDFGaussian::operator+=(), mrpt::poses::CPose3DPDFGaussianInf::operator+=(), mrpt::poses::CPose3DPDFGaussian::operator+=(), mrpt::poses::CPosePDFGaussian::operator+=(), mrpt::poses::CPosePDFGaussianInf::operator+=(), mrpt::poses::CPosePDFSOG::rotateAllCovariances(), mrpt::vision::StereoObs2BRObs(), TEST(), and transform_gaussian_linear().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ multiply_HCHt() [2/2]

template<std::size_t H_ROWS, std::size_t H_COLS, typename Scalar >
mrpt::math::CMatrixFixed<Scalar, H_ROWS, H_ROWS> mrpt::math::multiply_HCHt ( const mrpt::math::CMatrixFixed< Scalar, H_ROWS, H_COLS > &  H,
const mrpt::math::CMatrixFixed< Scalar, H_COLS, H_COLS > &  C 
)

return a fixed-size matrix with the result of: H * C * H^t

Definition at line 43 of file ops_matrices.h.

References mat2eig(), and R.

Here is the call graph for this function:

◆ multiply_HCHt_scalar()

template<typename VECTOR_H , typename MAT_C >
MAT_C::Scalar mrpt::math::multiply_HCHt_scalar ( const VECTOR_H &  H,
const MAT_C &  C 
)

r (scalar) = H*C*H^t (H: row vector, C: symmetric matrix)

Definition at line 63 of file ops_matrices.h.

References ASSERT_EQUAL_, and mat2eig().

Referenced by mrpt::graphs::detail::graph_ops< graph_t >::auxMaha2Dist(), mrpt::maps::CLandmarksMap::compute3DMatchingRatio(), mrpt::maps::CLandmarksMap::computeLikelihood_SIFT_LandmarkMap(), mrpt::maps::CLandmarksMap::computeMatchingWith3DLandmarks(), mrpt::maps::CBeaconMap::internal_computeObservationLikelihood(), mrpt::maps::CLandmarksMap::internal_computeObservationLikelihood(), mrpt::maps::CBeaconMap::internal_insertObservation(), KLD_Gaussians(), mahalanobisDistance2(), mrpt::poses::CPointPDFGaussian::mahalanobisDistanceTo(), productIntegralAndMahalanobisTwoGaussians(), and TEST().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ multiply_HtCH_scalar()

template<typename VECTOR_H , typename MAT_C >
MAT_C::Scalar mrpt::math::multiply_HtCH_scalar ( const VECTOR_H &  H,
const MAT_C &  C 
)

r (scalar) = H^t*C*H (H: column vector, C: symmetric matrix)

Definition at line 54 of file ops_matrices.h.

References ASSERT_EQUAL_, and mat2eig().

Referenced by mrpt::graphs::detail::graph_ops< graph_t >::auxMaha2Dist(), mrpt::graphslam::deciders::CLoopCloserERD< GRAPH_T >::generatePWConsistencyElement(), mrpt::slam::joint_pdf_metric(), mahalanobisDistance2(), mahalanobisDistance2AndLogPDF(), mrpt::poses::CPosePDFGaussian::mahalanobisDistanceTo(), mrpt::poses::CPosePDFGaussianInf::mahalanobisDistanceTo(), mrpt::poses::CPose3DPDFGaussianInf::mahalanobisDistanceTo(), mrpt::poses::CPose3DPDFGaussian::mahalanobisDistanceTo(), normalPDF(), and normalPDFInf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ multiply_skew3_A()

template<class SKEW_3VECTOR , class MAT_A , class MAT_OUT >
void mrpt::math::multiply_skew3_A ( const SKEW_3VECTOR &  v,
const MAT_A &  A,
MAT_OUT &  out 
)

Only for vectors/arrays "v" of length3, compute out = Skew(v) * A, where Skew(v) is the skew symmetric matric generated from v (see mrpt::math::skew_symmetric3)

Definition at line 186 of file ops_matrices.h.

References ASSERT_EQUAL_, MRPT_END, MRPT_START, and out.

Referenced by TEST().

Here is the caller graph for this function:

◆ ncc_vector()

template<class CONT1 , class CONT2 >
double mrpt::math::ncc_vector ( const CONT1 &  patch1,
const CONT2 &  patch2 
)

Normalised Cross Correlation between two vector patches The Matlab code for this is a = a - mean2(a); b = b - mean2(b); r = sum(sum(a.

*b))/sqrt(sum(sum(a.*a))*sum(sum(b.*b)));

Definition at line 433 of file ops_containers.h.

References ASSERT_, ASSERTMSG_, and mrpt::square().

Here is the call graph for this function:

◆ norm()

template<class CONTAINER >
CONTAINER::Scalar mrpt::math::norm ( const CONTAINER &  v)
inline

◆ norm_inf()

template<class CONTAINER >
CONTAINER::Scalar mrpt::math::norm_inf ( const CONTAINER &  v)
inline

Definition at line 128 of file ops_containers.h.

Referenced by mrpt::math::CLevenbergMarquardtTempl< VECTORTYPE, USERPARAM >::execute(), and mrpt::graphslam::optimize_graph_spa_levmarq().

Here is the caller graph for this function:

◆ normalize()

template<class CONTAINER , typename Scalar >
void mrpt::math::normalize ( CONTAINER &  c,
Scalar  valMin,
Scalar  valMax 
)

Scales all elements such as the minimum & maximum values are shifted to the given values.

Definition at line 279 of file ops_containers.h.

Referenced by mrpt::topography::ENUToGeocentric(), mrpt::vision::CFeatureExtraction::internal_computeSpinImageDescriptors(), mrpt::img::CImage::normalize(), mrpt::opengl::CMesh::updateColorsMatrix(), and mrpt::opengl::CMeshFast::updateColorsMatrix().

Here is the caller graph for this function:

◆ operator!=() [1/6]

bool mrpt::math::operator!= ( const TSegment2D s1,
const TSegment2D s2 
)
inline

Definition at line 108 of file TSegment2D.h.

References mrpt::math::TSegment2D::point1, and mrpt::math::TSegment2D::point2.

◆ operator!=() [2/6]

bool mrpt::math::operator!= ( const TSegment3D s1,
const TSegment3D s2 
)
inline

Definition at line 113 of file TSegment3D.h.

References mrpt::math::TSegment3D::point1, and mrpt::math::TSegment3D::point2.

◆ operator!=() [3/6]

bool mrpt::math::operator!= ( const TPose2D p1,
const TPose2D p2 
)
inline

Exact comparison between 2D poses, taking possible cycles into account.

Definition at line 152 of file TPose2D.h.

References mrpt::math::TPose2D::phi, wrapTo2Pi(), mrpt::math::TPose2D::x, and mrpt::math::TPose2D::y.

Here is the call graph for this function:

◆ operator!=() [4/6]

constexpr bool mrpt::math::operator!= ( const TPoint2D p1,
const TPoint2D p2 
)

Exact comparison between 2D points.

Definition at line 178 of file TPoint2D.h.

References mrpt::math::TPoint2D_data::x, and mrpt::math::TPoint2D_data::y.

◆ operator!=() [5/6]

bool mrpt::math::operator!= ( const TPose3D p1,
const TPose3D p2 
)
inline

Exact comparison between 3D poses, taking possible cycles into account.

Definition at line 225 of file TPose3D.h.

References mrpt::math::TPose3D::pitch, mrpt::math::TPose3D::roll, wrapTo2Pi(), mrpt::math::TPose3D::x, mrpt::math::TPose3D::y, mrpt::math::TPose3D::yaw, and mrpt::math::TPose3D::z.

Here is the call graph for this function:

◆ operator!=() [6/6]

constexpr bool mrpt::math::operator!= ( const TPoint3D p1,
const TPoint3D p2 
)

Exact comparison between 3D points.

Definition at line 341 of file TPoint3D.h.

References mrpt::math::TPoint3D_data::x, mrpt::math::TPoint3D_data::y, and mrpt::math::TPoint3D_data::z.

◆ operator-() [1/3]

TPose3D mrpt::math::operator- ( const TPose3D p)

Unary $$ operator: computes inverse SE(3) element.

Definition at line 480 of file TPoseOrPoint.cpp.

References mrpt::math::TPose3D::fromHomogeneousMatrix().

Here is the call graph for this function:

◆ operator-() [2/3]

TPose3D mrpt::math::operator- ( const TPose3D b,
const TPose3D a 
)

Binary $$ operator: $b a$ computes the relative SE(3) pose of b "as seen from" a

Definition at line 488 of file TPoseOrPoint.cpp.

References mrpt::math::CMatrixFixed< T, ROWS, COLS >::asEigen(), and mrpt::math::TPose3D::fromHomogeneousMatrix().

Here is the call graph for this function:

◆ operator-() [3/3]

constexpr TPoint3D mrpt::math::operator- ( const TPoint3D p1)

Unary minus operator for 3D points.

Definition at line 330 of file TPoint3D.h.

References mrpt::math::TPoint3D_data::x, mrpt::math::TPoint3D_data::y, and mrpt::math::TPoint3D_data::z.

◆ operator<<() [1/19]

template<class PoseOrPoint , typename = std::enable_if_t<std::is_base_of_v< mrpt::math::TPoseOrPoint, PoseOrPoint>>>
std::ostream& mrpt::math::operator<< ( std::ostream &  o,
const PoseOrPoint &  p 
)

Text streaming function.

Definition at line 69 of file TPoseOrPoint.h.

◆ operator<<() [2/19]

CArchive & mrpt::math::operator<< ( mrpt::serialization::CArchive out,
const mrpt::math::TLine3D l 
)

Definition at line 550 of file TPoseOrPoint.cpp.

References mrpt::math::TLine3D::director, out, and mrpt::math::TLine3D::pBase.

◆ operator<<() [3/19]

template<class PoseOrPoint , typename = std::enable_if_t<std::is_base_of_v< mrpt::math::TPoseOrPoint, PoseOrPoint>>>
mrpt::serialization::CArchive& mrpt::math::operator<< ( mrpt::serialization::CArchive out,
const PoseOrPoint &  o 
)

Binary streaming function.

Definition at line 90 of file TPoseOrPoint.h.

References out.

◆ operator<<() [4/19]

CArchive & mrpt::math::operator<< ( mrpt::serialization::CArchive out,
const mrpt::math::TPlane p 
)

Definition at line 558 of file TPoseOrPoint.cpp.

References out.

◆ operator<<() [5/19]

CArchive & mrpt::math::operator<< ( mrpt::serialization::CArchive out,
const mrpt::math::TLine2D l 
)

Definition at line 533 of file TPoseOrPoint.cpp.

References mrpt::math::TLine2D::coefs, and out.

◆ operator<<() [6/19]

CArchive & mrpt::math::operator<< ( mrpt::serialization::CArchive out,
const mrpt::math::TSegment2D s 
)

Definition at line 525 of file TPoseOrPoint.cpp.

References out.

◆ operator<<() [7/19]

CArchive & mrpt::math::operator<< ( mrpt::serialization::CArchive out,
const mrpt::math::TSegment3D s 
)

Definition at line 542 of file TPoseOrPoint.cpp.

References out.

◆ operator<<() [8/19]

CArchive & mrpt::math::operator<< ( mrpt::serialization::CArchive out,
const mrpt::math::TTwist2D o 
)

Definition at line 1551 of file TPoseOrPoint.cpp.

References out, and mrpt::math::internal::ProvideStaticResize< Derived >::size().

Here is the call graph for this function:

◆ operator<<() [9/19]

CArchive & mrpt::math::operator<< ( mrpt::serialization::CArchive out,
const mrpt::math::TTwist3D o 
)

Definition at line 1562 of file TPoseOrPoint.cpp.

References out, and mrpt::math::internal::ProvideStaticResize< Derived >::size().

Here is the call graph for this function:

◆ operator<<() [10/19]

CArchive & mrpt::math::operator<< ( mrpt::serialization::CArchive out,
const mrpt::math::TObject2D o 
)

Definition at line 1613 of file TPoseOrPoint.cpp.

References GEOMETRIC_TYPE_LINE, GEOMETRIC_TYPE_POINT, GEOMETRIC_TYPE_POLYGON, GEOMETRIC_TYPE_SEGMENT, mrpt::math::TObject2D::getLine(), mrpt::math::TObject2D::getPoint(), mrpt::math::TObject2D::getPolygon(), mrpt::math::TObject2D::getSegment(), mrpt::math::TObject2D::getType(), and out.

Here is the call graph for this function:

◆ operator<<() [11/19]

CArchive & mrpt::math::operator<< ( mrpt::serialization::CArchive s,
const CVectorFloat a 
)

Definition at line 627 of file math.cpp.

References mrpt::serialization::CArchive::WriteAs().

Here is the call graph for this function:

◆ operator<<() [12/19]

CArchive & mrpt::math::operator<< ( mrpt::serialization::CArchive s,
const CVectorDouble a 
)

Definition at line 633 of file math.cpp.

References mrpt::serialization::CArchive::WriteAs().

Here is the call graph for this function:

◆ operator<<() [13/19]

CArchive & mrpt::math::operator<< ( mrpt::serialization::CArchive out,
const mrpt::math::TObject3D o 
)

◆ operator<<() [14/19]

template<typename Scalar , class Derived , typename = std::enable_if_t< Derived::RowsAtCompileTime == Derived::ColsAtCompileTime || (Derived::ColsAtCompileTime == 1)>>
std::ostream& mrpt::math::operator<< ( std::ostream &  o,
const MatrixVectorBase< Scalar, Derived > &  m 
)

Stream as text.

Implemented for all matrices and vectors, except for non-square fixed-size matrices.

Definition at line 461 of file MatrixVectorBase.h.

References mrpt::math::MatrixVectorBase< Scalar, Derived >::asString().

Here is the call graph for this function:

◆ operator<<() [15/19]

std::ostream& mrpt::math::operator<< ( std::ostream &  o,
const TPoint2D p 
)

Definition at line 500 of file TPoseOrPoint.cpp.

◆ operator<<() [16/19]

std::ostream& mrpt::math::operator<< ( std::ostream &  o,
const TPoint3D p 
)

Definition at line 504 of file TPoseOrPoint.cpp.

◆ operator<<() [17/19]

std::ostream& mrpt::math::operator<< ( std::ostream &  o,
const TPose2D p 
)

Definition at line 508 of file TPoseOrPoint.cpp.

◆ operator<<() [18/19]

std::ostream& mrpt::math::operator<< ( std::ostream &  o,
const TPose3D p 
)

Definition at line 512 of file TPoseOrPoint.cpp.

◆ operator<<() [19/19]

std::ostream& mrpt::math::operator<< ( std::ostream &  o,
const TPose3DQuat p 
)

Definition at line 516 of file TPoseOrPoint.cpp.

◆ operator==() [1/6]

bool mrpt::math::operator== ( const TSegment2D s1,
const TSegment2D s2 
)
inline

Definition at line 103 of file TSegment2D.h.

References mrpt::math::TSegment2D::point1, and mrpt::math::TSegment2D::point2.

◆ operator==() [2/6]

bool mrpt::math::operator== ( const TSegment3D s1,
const TSegment3D s2 
)
inline

Definition at line 108 of file TSegment3D.h.

References mrpt::math::TSegment3D::point1, and mrpt::math::TSegment3D::point2.

◆ operator==() [3/6]

bool mrpt::math::operator== ( const TPose2D p1,
const TPose2D p2 
)
inline

Exact comparison between 2D poses, taking possible cycles into account.

Definition at line 145 of file TPose2D.h.

References mrpt::math::TPose2D::phi, wrapTo2Pi(), mrpt::math::TPose2D::x, and mrpt::math::TPose2D::y.

Here is the call graph for this function:

◆ operator==() [4/6]

constexpr bool mrpt::math::operator== ( const TPoint2D p1,
const TPoint2D p2 
)

Exact comparison between 2D points.

Definition at line 173 of file TPoint2D.h.

References mrpt::math::TPoint2D_data::x, and mrpt::math::TPoint2D_data::y.

◆ operator==() [5/6]

bool mrpt::math::operator== ( const TPose3D p1,
const TPose3D p2 
)
inline

Exact comparison between 3D poses, taking possible cycles into account.

Definition at line 215 of file TPose3D.h.

References mrpt::math::TPose3D::pitch, mrpt::math::TPose3D::roll, wrapTo2Pi(), mrpt::math::TPose3D::x, mrpt::math::TPose3D::y, mrpt::math::TPose3D::yaw, and mrpt::math::TPose3D::z.

Here is the call graph for this function:

◆ operator==() [6/6]

constexpr bool mrpt::math::operator== ( const TPoint3D p1,
const TPoint3D p2 
)

Exact comparison between 3D points.

Definition at line 336 of file TPoint3D.h.

References mrpt::math::TPoint3D_data::x, mrpt::math::TPoint3D_data::y, and mrpt::math::TPoint3D_data::z.

◆ operator>>() [1/13]

mrpt::serialization::CArchive & mrpt::math::operator>> ( mrpt::serialization::CArchive in,
CMatrixD::Ptr pObj 
)

◆ operator>>() [2/13]

CArchive & mrpt::math::operator>> ( mrpt::serialization::CArchive in,
mrpt::math::TLine3D l 
)

Definition at line 546 of file TPoseOrPoint.cpp.

References mrpt::math::TLine3D::director, and mrpt::math::TLine3D::pBase.

◆ operator>>() [3/13]

template<class PoseOrPoint , typename = std::enable_if_t<std::is_base_of_v< mrpt::math::TPoseOrPoint, PoseOrPoint>>>
mrpt::serialization::CArchive& mrpt::math::operator>> ( mrpt::serialization::CArchive in,
PoseOrPoint &  o 
)

Binary streaming function.

Definition at line 79 of file TPoseOrPoint.h.

◆ operator>>() [4/13]

CArchive & mrpt::math::operator>> ( mrpt::serialization::CArchive in,
mrpt::math::TPlane p 
)

Definition at line 554 of file TPoseOrPoint.cpp.

◆ operator>>() [5/13]

CArchive & mrpt::math::operator>> ( mrpt::serialization::CArchive in,
mrpt::math::TLine2D l 
)

Definition at line 529 of file TPoseOrPoint.cpp.

References mrpt::math::TLine2D::coefs.

◆ operator>>() [6/13]

CArchive & mrpt::math::operator>> ( mrpt::serialization::CArchive in,
mrpt::math::TSegment2D s 
)

Definition at line 521 of file TPoseOrPoint.cpp.

◆ operator>>() [7/13]

CArchive & mrpt::math::operator>> ( mrpt::serialization::CArchive in,
mrpt::math::TSegment3D s 
)

Definition at line 538 of file TPoseOrPoint.cpp.

◆ operator>>() [8/13]

CArchive & mrpt::math::operator>> ( mrpt::serialization::CArchive in,
mrpt::math::TTwist2D o 
)

Definition at line 1546 of file TPoseOrPoint.cpp.

References mrpt::math::internal::ProvideStaticResize< Derived >::size().

Here is the call graph for this function:

◆ operator>>() [9/13]

CArchive & mrpt::math::operator>> ( mrpt::serialization::CArchive in,
mrpt::math::TTwist3D o 
)

Definition at line 1557 of file TPoseOrPoint.cpp.

References mrpt::math::internal::ProvideStaticResize< Derived >::size().

Here is the call graph for this function:

◆ operator>>() [10/13]

CArchive & mrpt::math::operator>> ( mrpt::serialization::CArchive in,
mrpt::math::TObject2D o 
)

◆ operator>>() [11/13]

CArchive & mrpt::math::operator>> ( mrpt::serialization::CArchive in,
CVectorDouble a 
)

Definition at line 621 of file math.cpp.

References mrpt::serialization::CArchive::ReadBufferFixEndianness().

Here is the call graph for this function:

◆ operator>>() [12/13]

CArchive & mrpt::math::operator>> ( mrpt::serialization::CArchive in,
CVectorFloat a 
)

Definition at line 615 of file math.cpp.

References mrpt::serialization::CArchive::ReadBufferFixEndianness().

Here is the call graph for this function:

◆ operator>>() [13/13]

CArchive & mrpt::math::operator>> ( mrpt::serialization::CArchive in,
mrpt::math::TObject3D o 
)

◆ ransac2Dline_degenerate()

template<typename T >
bool mrpt::math::ransac2Dline_degenerate ( const CMatrixDynamic< T > &  allData,
const std::vector< size_t > &  useIndices 
)

Return "true" if the selected points are a degenerate (invalid) case.

Definition at line 251 of file ransac_applications.cpp.

References MRPT_UNUSED_PARAM.

◆ ransac2Dline_distance()

template<typename T >
void mrpt::math::ransac2Dline_distance ( const CMatrixDynamic< T > &  allData,
const vector< CMatrixDynamic< T >> &  testModels,
const T  distanceThreshold,
unsigned int &  out_bestModelIndex,
std::vector< size_t > &  out_inlierIndices 
)

Definition at line 215 of file ransac_applications.cpp.

References ASSERT_, ASSERTMSG_, mrpt::math::TLine2D::coefs, mrpt::math::CMatrixDynamic< T >::cols(), and mrpt::format().

Here is the call graph for this function:

◆ ransac2Dline_fit()

template<typename T >
void mrpt::math::ransac2Dline_fit ( const CMatrixDynamic< T > &  allData,
const std::vector< size_t > &  useIndices,
vector< CMatrixDynamic< T >> &  fitModels 
)

Definition at line 189 of file ransac_applications.cpp.

References ASSERT_, mrpt::math::TLine2D::coefs, and mrpt::math::CMatrixDynamic< T >::setSize().

Here is the call graph for this function:

◆ ransac3Dplane_degenerate()

template<typename T >
bool mrpt::math::ransac3Dplane_degenerate ( const CMatrixDynamic< T > &  allData,
const std::vector< size_t > &  useIndices 
)

Return "true" if the selected points are a degenerate (invalid) case.

Definition at line 91 of file ransac_applications.cpp.

References MRPT_UNUSED_PARAM.

◆ ransac3Dplane_distance()

template<typename T >
void mrpt::math::ransac3Dplane_distance ( const CMatrixDynamic< T > &  allData,
const vector< CMatrixDynamic< T >> &  testModels,
const T  distanceThreshold,
unsigned int &  out_bestModelIndex,
std::vector< size_t > &  out_inlierIndices 
)

Definition at line 60 of file ransac_applications.cpp.

References ASSERT_, mrpt::math::TPlane::coefs, mrpt::math::CMatrixDynamic< T >::cols(), and mrpt::math::CMatrixDynamic< T >::rows().

Here is the call graph for this function:

◆ ransac3Dplane_fit()

template<typename T >
void mrpt::math::ransac3Dplane_fit ( const CMatrixDynamic< T > &  allData,
const std::vector< size_t > &  useIndices,
vector< CMatrixDynamic< T >> &  fitModels 
)

Definition at line 27 of file ransac_applications.cpp.

References ASSERT_, mrpt::math::TPlane::coefs, and mrpt::math::CMatrixDynamic< T >::setSize().

Here is the call graph for this function:

◆ rdft()

static void mrpt::math::rdft ( int  n,
int  isgn,
FFT_TYPE a,
int *  ip,
FFT_TYPE w 
)
static

Definition at line 567 of file fourier.cpp.

References bitrv2(), cftbsub(), cftfsub(), makect(), makewt(), rftbsub(), and rftfsub().

Referenced by rdft2d().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rdft2d()

static void mrpt::math::rdft2d ( int  n1,
int  n2,
int  isgn,
FFT_TYPE **  a,
FFT_TYPE t,
int *  ip,
FFT_TYPE w 
)
static


Copyright(C) 1997 Takuya OOURA (email: ooura.nosp@m.@mmm.nosp@m..t.u-.nosp@m.toky.nosp@m.o.ac..nosp@m.jp).

You may use, copy, modify this code for any purpose and without fee. You may distribute this ORIGINAL package.

-----— Real DFT / Inverse of Real DFT -----— [definition] <case1> RDFT R[k1][k2] = sum_j1=0^n1-1 sum_j2=0^n2-1 a[j1][j2] * cos(2*pi*j1*k1/n1 + 2*pi*j2*k2/n2), 0<=k1<n1, 0<=k2<n2 I[k1][k2] = sum_j1=0^n1-1 sum_j2=0^n2-1 a[j1][j2] * sin(2*pi*j1*k1/n1 + 2*pi*j2*k2/n2), 0<=k1<n1, 0<=k2<n2 <case2> IRDFT (excluding scale) a[k1][k2] = (1/2) * sum_j1=0^n1-1 sum_j2=0^n2-1 (R[j1][j2] * cos(2*pi*j1*k1/n1 + 2*pi*j2*k2/n2) + I[j1][j2] * sin(2*pi*j1*k1/n1 + 2*pi*j2*k2/n2)), 0<=k1<n1, 0<=k2<n2 (notes: R[n1-k1][n2-k2] = R[k1][k2], I[n1-k1][n2-k2] = -I[k1][k2], R[n1-k1][0] = R[k1][0], I[n1-k1][0] = -I[k1][0], R[0][n2-k2] = R[0][k2], I[0][n2-k2] = -I[0][k2], 0<k1<n1, 0<k2<n2) [usage] <case1> ip[0] = 0; // first time only rdft2d(n1, n2, 1, a, t, ip, w); <case2> ip[0] = 0; // first time only rdft2d(n1, n2, -1, a, t, ip, w); [parameters] n1 :data length (int) n1 >= 2, n1 = power of 2 n2 :data length (int) n2 >= 2, n2 = power of 2 a[0...n1-1][0...n2-1] :input/output data (FFT_TYPE **) <case1> output data a[k1][2*k2] = R[k1][k2] = R[n1-k1][n2-k2], a[k1][2*k2+1] = I[k1][k2] = -I[n1-k1][n2-k2], 0<k1<n1, 0<k2<n2/2, a[0][2*k2] = R[0][k2] = R[0][n2-k2], a[0][2*k2+1] = I[0][k2] = -I[0][n2-k2], 0<k2<n2/2, a[k1][0] = R[k1][0] = R[n1-k1][0], a[k1][1] = I[k1][0] = -I[n1-k1][0], a[n1-k1][1] = R[k1][n2/2] = R[n1-k1][n2/2], a[n1-k1][0] = -I[k1][n2/2] = I[n1-k1][n2/2], 0<k1<n1/2, a[0][0] = R[0][0], a[0][1] = R[0][n2/2], a[n1/2][0] = R[n1/2][0], a[n1/2][1] = R[n1/2][n2/2] <case2> input data a[j1][2*j2] = R[j1][j2] = R[n1-j1][n2-j2], a[j1][2*j2+1] = I[j1][j2] = -I[n1-j1][n2-j2], 0<j1<n1, 0<j2<n2/2, a[0][2*j2] = R[0][j2] = R[0][n2-j2], a[0][2*j2+1] = I[0][j2] = -I[0][n2-j2], 0<j2<n2/2, a[j1][0] = R[j1][0] = R[n1-j1][0], a[j1][1] = I[j1][0] = -I[n1-j1][0], a[n1-j1][1] = R[j1][n2/2] = R[n1-j1][n2/2], a[n1-j1][0] = -I[j1][n2/2] = I[n1-j1][n2/2], 0<j1<n1/2, a[0][0] = R[0][0], a[0][1] = R[0][n2/2], a[n1/2][0] = R[n1/2][0], a[n1/2][1] = R[n1/2][n2/2] t[0...2*n1-1] :work area (FFT_TYPE *) ip[0...*] :work area for bit reversal (int *) length of ip >= 2+sqrt(n) ; if n % 4 == 0 2+sqrt(n/2); otherwise (n = max(n1, n2/2)) ip[0],ip[1] are pointers of the cos/sin table. w[0...*] :cos/sin table (FFT_TYPE *) length of w >= max(n1/2, n2/4) + n2/4 w[],ip[] are initialized if ip[0] == 0. [remark] Inverse of rdft2d(n1, n2, 1, a, t, ip, w); is rdft2d(n1, n2, -1, a, t, ip, w); for (j1 = 0; j1 <= n1 - 1; j1++) { for (j2 = 0; j2 <= n2 - 1; j2++) { a[j1][j2] *= 2.0 / (n1 * n2); } }

Definition at line 735 of file fourier.cpp.

References cdft(), makect(), makewt(), and rdft().

Referenced by dft2_real(), and idft2_real().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ realft()

static void mrpt::math::realft ( float  data[],
unsigned long  n 
)
static

Definition at line 101 of file fourier.cpp.

References four1().

Referenced by fft_real().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeRepVertices()

template<class T >
void mrpt::math::removeRepVertices ( T &  poly)
inline

Definition at line 1057 of file TPoseOrPoint.cpp.

References distance(), and getEpsilon().

Referenced by mrpt::math::TPolygon2D::removeRepeatedVertices(), and mrpt::math::TPolygon3D::removeRepeatedVertices().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeUnusedVertices()

template<class T >
void mrpt::math::removeUnusedVertices ( T &  poly)
inline

Definition at line 1025 of file TPoseOrPoint.cpp.

References distance(), and getEpsilon().

Referenced by mrpt::math::TPolygon2D::removeRedundantVertices(), and mrpt::math::TPolygon3D::removeRedundantVertices().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resizeLike() [1/2]

template<class EIGEN_CONTAINER >
void mrpt::math::resizeLike ( EIGEN_CONTAINER &  trg,
const EIGEN_CONTAINER &  src 
)

Definition at line 83 of file ops_containers.h.

Referenced by cumsum_tmpl().

Here is the caller graph for this function:

◆ resizeLike() [2/2]

template<typename T >
void mrpt::math::resizeLike ( std::vector< T > &  trg,
const std::vector< T > &  src 
)

Definition at line 88 of file ops_containers.h.

◆ rftbsub()

static void mrpt::math::rftbsub ( int  n,
FFT_TYPE a,
int  nc,
FFT_TYPE c 
)
static

Definition at line 612 of file fourier.cpp.

Referenced by rdft().

Here is the caller graph for this function:

◆ rftfsub()

static void mrpt::math::rftfsub ( int  n,
FFT_TYPE a,
int  nc,
FFT_TYPE c 
)
static

Definition at line 543 of file fourier.cpp.

Referenced by rdft().

Here is the caller graph for this function:

◆ size()

template<class MATRIXLIKE >
size_t mrpt::math::size ( const MATRIXLIKE &  m,
const int  dim 
)
inline

◆ squareNorm()

template<size_t N, class T , class U >
T mrpt::math::squareNorm ( const U &  v)
inline

Compute the square norm of anything implementing [].

See also
norm

Definition at line 191 of file ops_containers.h.

References mrpt::square().

Here is the call graph for this function:

◆ squareNorm_accum()

template<class CONTAINER , typename VALUE >
VALUE mrpt::math::squareNorm_accum ( const VALUE  total,
const CONTAINER &  v 
)

Accumulate the squared-norm of a vector/array/matrix into "total" (this function is compatible with std::accumulate).

Definition at line 183 of file ops_containers.h.

◆ stddev()

template<class VECTORLIKE >
double mrpt::math::stddev ( const VECTORLIKE &  v,
bool  unbiased = true 
)
inline

Computes the standard deviation of a vector.

Parameters
vThe set of data
unbiasedIf set to true or false the std is normalized by "N-1" or "N", respectively.
See also
math::mean,math::meanAndStd

Definition at line 359 of file ops_containers.h.

References meanAndStd().

Referenced by mrpt::apps::CGridMapAlignerApp::run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sum() [1/2]

template<class CONTAINER >
CONTAINER::Scalar mrpt::math::sum ( const CONTAINER &  v)
inline

◆ sum() [2/2]

template<typename T >
T mrpt::math::sum ( const std::vector< T > &  v)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 228 of file ops_containers.h.

◆ sumRetType()

template<class CONTAINER , typename RET >
RET mrpt::math::sumRetType ( const CONTAINER &  v)
inline

Computes the sum of all the elements, with a custom return type.

See also
sum, cumsum

Definition at line 236 of file ops_containers.h.

Variable Documentation

◆ GEOMETRIC_TYPE_LINE

constexpr unsigned char mrpt::math::GEOMETRIC_TYPE_LINE = 2
static

◆ GEOMETRIC_TYPE_PLANE

constexpr unsigned char mrpt::math::GEOMETRIC_TYPE_PLANE = 4
static

◆ GEOMETRIC_TYPE_POINT

constexpr unsigned char mrpt::math::GEOMETRIC_TYPE_POINT = 0
static

◆ GEOMETRIC_TYPE_POLYGON

constexpr unsigned char mrpt::math::GEOMETRIC_TYPE_POLYGON = 3
static

◆ GEOMETRIC_TYPE_SEGMENT

constexpr unsigned char mrpt::math::GEOMETRIC_TYPE_SEGMENT = 1
static

◆ GEOMETRIC_TYPE_UNDEFINED

constexpr unsigned char mrpt::math::GEOMETRIC_TYPE_UNDEFINED = 255
static



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 45d659fbb Tue Dec 10 18:21:14 2019 +0100 at mar dic 10 18:30:09 CET 2019