12 #ifndef MLPACK_CORE_METRICS_MAHALANOBIS_DISTANCE_IMPL_HPP 13 #define MLPACK_CORE_METRICS_MAHALANOBIS_DISTANCE_IMPL_HPP 24 template<
typename VecTypeA,
typename VecTypeB>
28 arma::vec m = (a - b);
29 arma::mat out = trans(m) * covariance * m;
37 template<
typename VecTypeA,
typename VecTypeB>
42 if (covariance.n_rows == 0)
43 covariance = arma::eye<arma::mat>(a.n_elem, a.n_elem);
45 arma::vec m = (a - b);
46 arma::mat out = trans(m) * covariance * m;
51 template<
bool TakeRoot>
52 template<
typename Archive>
56 ar(CEREAL_NVP(covariance));
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
double Evaluate(const VecTypeA &a, const VecTypeB &b)
Evaluate the distance between the two given points using this Mahalanobis distance.
void serialize(Archive &ar, const uint32_t version)
Serialize the Mahalanobis distance.
Definition: mahalanobis_distance_impl.hpp:53