12 #ifndef MLPACK_CORE_METRICS_MAHALANOBIS_DISTANCE_HPP
13 #define MLPACK_CORE_METRICS_MAHALANOBIS_DISTANCE_HPP
52 template<
bool TakeRoot = true>
69 covariance(arma::eye<arma::mat>(dimensionality, dimensionality)) { }
88 template<
typename VecTypeA,
typename VecTypeB>
89 double Evaluate(
const VecTypeA& a,
const VecTypeB& b);
96 const arma::mat&
Covariance()
const {
return covariance; }
106 template<
typename Archive>
107 void Serialize(Archive& ar,
const unsigned int version);
111 arma::mat covariance;
117 #include "mahalanobis_distance_impl.hpp"
double Evaluate(const VecTypeA &a, const VecTypeB &b)
Evaluate the distance between the two given points using this Mahalanobis distance.
The core includes that mlpack expects; standard C++ includes and Armadillo.
MahalanobisDistance(const size_t dimensionality)
Initialize the Mahalanobis distance with the identity matrix of the given dimensionality.
MahalanobisDistance()
Initialize the Mahalanobis distance with the empty matrix as covariance.
arma::mat & Covariance()
Modify the covariance matrix.
MahalanobisDistance(const arma::mat &covariance)
Initialize the Mahalanobis distance with the given covariance matrix.
void Serialize(Archive &ar, const unsigned int version)
Serialize the Mahalanobis distance.
const arma::mat & Covariance() const
Access the covariance matrix.
The Mahalanobis distance, which is essentially a stretched Euclidean distance.