Esempio n. 1
0
/** Returns the Mahalanobis distance from this PDF to some point */
double CPoint2DPDFGaussian::mahalanobisDistanceToPoint( const double x, const double y ) const
{
	// The difference in means:
	Eigen::Matrix<double,2,1> deltaX;
	deltaX[0] = x - mean.x();
	deltaX[1] = y - mean.y();

	// The inverse of the combined covs:
	return std::sqrt( deltaX.multiply_HtCH_scalar( this->cov.inverse() ) );
}
Esempio n. 2
0
/*---------------------------------------------------------------
					mahalanobisDistanceTo
 ---------------------------------------------------------------*/
double CPoint2DPDFGaussian::mahalanobisDistanceTo( const CPoint2DPDFGaussian & other ) const
{
	// The difference in means:
	Eigen::Matrix<double,2,1> deltaX;
	deltaX[0] = other.mean.x() - mean.x();
	deltaX[1] = other.mean.y() - mean.y();

	// The inverse of the combined covs:
	return std::sqrt( deltaX.multiply_HtCH_scalar( (other.cov + this->cov).inverse() ) );
}