26 #ifndef MLN_FUN_STAT_MAHALANOBIS_HH
27 # define MLN_FUN_STAT_MAHALANOBIS_HH
34 # include <mln/core/concept/function.hh>
35 # include <mln/algebra/vec.hh>
36 # include <mln/algebra/mat.hh>
50 :
public Function_v2v< mahalanobis<V> >,
51 private metal::equal< V, algebra::vec<V::dim,float> >::check_t
56 mahalanobis(
const algebra::mat<n,n,float>& var,
57 const algebra::vec<n,float>& mean);
60 float operator()(
const V& v)
const;
62 typedef algebra::vec<n,float> mean_t;
67 algebra::mat<n,n,float> var_1_;
68 algebra::vec<n,float> mean_;
72 # ifndef MLN_INCLUDE_ONLY
76 mahalanobis<V>::mahalanobis(
const algebra::mat<n,n,float>& var,
77 const algebra::vec<n,float>& mean)
86 mahalanobis<V>::operator()(
const V& v)
const
88 return std::sqrt((v - mean_).t() * var_1_ * (v - mean_));
93 typename mahalanobis<V>::mean_t
94 mahalanobis<V>::mean()
const
99 # endif // ! MLN_INCLUDE_ONLY
108 #endif // ! MLN_FUN_STAT_MAHALANOBIS_HH