12 #ifndef MLPACK_CORE_METRICS_MAHALANOBIS_DISTANCE_HPP 13 #define MLPACK_CORE_METRICS_MAHALANOBIS_DISTANCE_HPP 59 template<
bool TakeRoot = true>
76 covariance(arma::eye<arma::mat>(dimensionality, dimensionality)) { }
85 covariance(
std::move(covariance)) { }
96 template<
typename VecTypeA,
typename VecTypeB>
97 double Evaluate(
const VecTypeA& a,
const VecTypeB& b);
114 template<
typename Archive>
115 void serialize(Archive& ar,
const uint32_t version);
119 arma::mat covariance;
125 #include "mahalanobis_distance_impl.hpp" Linear algebra utility functions, generally performed on matrices or vectors.
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.
const arma::mat & Covariance() const
Access the covariance matrix.
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(arma::mat covariance)
Initialize the Mahalanobis distance with the given covariance matrix.
void serialize(Archive &ar, const uint32_t version)
Serialize the Mahalanobis distance.
The Mahalanobis distance, which is essentially a stretched Euclidean distance.