mahalanobis_distance.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __MLPACK_CORE_METRICS_MAHALANOBIS_DISTANCE_HPP
00023 #define __MLPACK_CORE_METRICS_MAHALANOBIS_DISTANCE_HPP
00024
00025 #include <mlpack/core.hpp>
00026
00027 namespace mlpack {
00028 namespace metric {
00029
00060 template<bool t_take_root = false>
00061 class MahalanobisDistance
00062 {
00063 public:
00068 MahalanobisDistance() { }
00069
00076 MahalanobisDistance(const size_t dimensionality) :
00077 covariance(arma::eye<arma::mat>(dimensionality, dimensionality)) { }
00078
00085 MahalanobisDistance(const arma::mat& covariance) : covariance(covariance) { }
00086
00096 template<typename VecType1, typename VecType2>
00097 double Evaluate(const VecType1& a, const VecType2& b);
00098
00104 const arma::mat& Covariance() const { return covariance; }
00105
00111 arma::mat& Covariance() { return covariance; }
00112
00113 private:
00115 arma::mat covariance;
00116 };
00117
00118 };
00119 };
00120
00121 #include "mahalanobis_distance_impl.hpp"
00122
00123 #endif