20 #include <Eigen/Dense> 39 :
mean(init_Mean),
cov(init_Cov)
116 if (
this == &o)
return;
129 if (!f)
return false;
143 const CPose3D& newReferenceBase)
163 const auto C1 = p1.
cov;
164 const auto C2 = p2.
cov;
168 x1(0, 0) = p1.
mean.
x();
169 x1(1, 0) = p1.
mean.
y();
170 x1(2, 0) = p1.
mean.z();
171 x2(0, 0) = p2.
mean.
x();
172 x2(1, 0) = p2.
mean.
y();
173 x2(2, 0) = p2.
mean.z();
178 C2_inv.
asEigen() * x2.asEigen());
204 const Eigen::Vector3d MU(
208 exp(-0.5 * (MU.transpose() * C_inv.
asEigen() * MU)(0, 0));
228 const auto C =
cov.
blockCopy<2, 2>(0, 0) +
p.cov.blockCopy<2, 2>(0, 0);
231 const Eigen::Vector2d MU(
mean.
x() -
p.mean.x(),
mean.
y() -
p.mean.y());
234 (1.0 / std::sqrt(C.det())) *
235 exp(-0.5 * (MU.transpose() * C_inv.
asEigen() * MU)(0, 0));
269 outSample.
x(
mean.
x() + vec[0]);
270 outSample.
y(
mean.
y() + vec[1]);
271 outSample.z(
mean.z() + vec[2]);
281 const double minMahalanobisDistToDrop)
305 deltaX(0, 2) = other.
mean.z() -
mean.z();
void copyFrom(const CPointPDF &o) override
Copy operator, translating if necesary (for example, between particles and gaussian representations) ...
A namespace of pseudo-random numbers generators of diferent distributions.
void getMean(CPoint3D &p) const override
CMatrixFixed< double, 1, 2 > CMatrixDouble12
This class is a "CSerializable" wrapper for "CMatrixDynamic<double>".
#define THROW_EXCEPTION(msg)
int void fclose(FILE *f)
An OS-independent version of fclose.
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
To be added to all CSerializable-classes implementation files.
CPoint3D mean
The mean value.
uint8_t serializeGetVersion() const override
Must return the current versioning number of the object.
void changeCoordinatesReference(const CPose3D &newReferenceBase) override
this = p (+) this.
This file implements miscelaneous matrix and matrix/vector operations, and internal functions in mrpt...
MAT_C::Scalar multiply_HCHt_scalar(const VECTOR_H &H, const MAT_C &C)
r (a scalar) = H^t * C * H (with a row vector H and a symmetric matrix C)
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
Virtual base class for "schematic archives" (JSON, XML,...)
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
T square(const T x)
Inline function for the square of a number.
#define ASSERT_(f)
Defines an assertion mechanism.
void bayesianFusion(const CPointPDFGaussian &p1, const CPointPDFGaussian &p2)
Bayesian fusion of two points gauss.
CMatrixFixed< double, 3, 3 > CMatrixDouble33
This base provides a set of functions for maths stuff.
bool saveToTextFile(const std::string &file) const override
Save PDF's particles to a text file, containing the 2D pose in the first line, then the covariance ma...
#define CLASS_ID(T)
Access to runtime class ID for a defined class name.
double productIntegralNormalizedWith(const CPointPDFGaussian &p) const
Computes the "correspondence likelihood" of this PDF with another one: This is implemented as the int...
mrpt::math::CMatrixDouble33 cov
The 3x3 covariance matrix.
auto block(int start_row, int start_col)
non-const block(): Returns an Eigen::Block reference to the block
virtual const mrpt::rtti::TRuntimeClassId * GetRuntimeClass() const override
Returns information about the class of an object in runtime.
double x() const
Common members of all points & poses classes.
Derived inverse_LLt() const
Returns the inverse of a symmetric matrix using LLt.
CMatrixDouble cov(const MATRIX &v)
Computes the covariance matrix from a list of samples in an NxM matrix, where each row is a sample...
CMatrixFixed< double, 2, 2 > CMatrixDouble22
GLsizei const GLchar ** string
A class used to store a 3D point.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
#define SCHEMA_DESERIALIZE_DATATYPE_VERSION()
For use inside serializeFrom(CSchemeArchiveBase) methods.
int fprintf(FILE *fil, const char *format,...) noexcept MRPT_printf_format_check(2
An OS-independent version of fprintf.
static constexpr size_t state_length
The length of the variable, for example, 3 for a 3D point, 6 for a 3D pose (x y z yaw pitch roll)...
This class is a "CSerializable" wrapper for "CMatrixFloat".
double productIntegralNormalizedWith2D(const CPointPDFGaussian &p) const
Computes the "correspondence likelihood" of this PDF with another one: This is implemented as the int...
Virtual base class for "archives": classes abstracting I/O streams.
void drawGaussianMultivariate(std::vector< T > &out_result, const MATRIX &cov, const std::vector< T > *mean=nullptr)
Generate multidimensional random samples according to a given covariance matrix.
virtual std::tuple< cov_mat_t, type_value > getCovarianceAndMean() const =0
Returns an estimate of the pose covariance matrix (STATE_LENxSTATE_LEN cov matrix) and the mean...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
double mahalanobisDistanceTo(const CPointPDFGaussian &other, bool only_2D=false) const
Returns the Mahalanobis distance from this PDF to another PDF, that is, it's evaluation at (0...
This file implements matrix/vector text and binary serialization.
double productIntegralWith(const CPointPDFGaussian &p) const
Computes the "correspondence likelihood" of this PDF with another one: This is implemented as the int...
void drawSingleSample(CPoint3D &outSample) const override
Draw a sample from the pdf.
double mean(const CONTAINER &v)
Computes the mean value of a vector.
EIGEN_MAP asEigen()
Get as an Eigen-compatible Eigen::Map object.
FILE * fopen(const char *fileName, const char *mode) noexcept
An OS-independent version of fopen.
CMatrixFixed< Scalar, BLOCK_ROWS, BLOCK_COLS > blockCopy(int start_row=0, int start_col=0) const
const blockCopy(): Returns a copy of the given block
#define SCHEMA_SERIALIZE_DATATYPE_VERSION(ser_version)
For use inside all serializeTo(CSchemeArchiveBase) methods.
void getRotationMatrix(mrpt::math::CMatrixDouble33 &ROT) const
Get the 3x3 rotation matrix.
CRandomGenerator & getRandomGenerator()
A static instance of a CRandomGenerator class, for use in single-thread applications.
Declares a class that represents a Probability Distribution function (PDF) of a 3D point (x...
CPointPDFGaussian()
Default constructor.
CMatrixFixed< double, ROWS, COLS > cast_double() const
double productIntegralWith2D(const CPointPDFGaussian &p) const
Computes the "correspondence likelihood" of this PDF with another one: This is implemented as the int...
A gaussian distribution for 3D points.
#define MRPT_UNUSED_PARAM(a)
Determines whether this is an X86 or AMD64 platform.