26 #ifndef MLN_ACCU_STAT_VAR_HH
27 # define MLN_ACCU_STAT_VAR_HH
35 # include <mln/accu/internal/base.hh>
36 # include <mln/algebra/vec.hh>
37 # include <mln/algebra/mat.hh>
38 # include <mln/fun/i2v/all_to.hh>
39 # include <mln/util/pix.hh>
58 struct var :
public mln::accu::internal::base< algebra::mat< T::dim, T::dim, float >,
61 enum { dim = T::dim };
63 typedef algebra::mat<dim,dim,float> result;
70 void take(
const argument& v);
73 void take_as_init_(
const argument& v);
74 void take_n_times_(
unsigned n_times,
const argument& v);
88 typedef algebra::vec<dim,float>
mean_t;
100 algebra::vec<dim,float> sum_;
101 algebra::mat<dim,dim,float> cov_;
106 # ifndef MLN_INCLUDE_ONLY
108 template <
typename T>
115 template <
typename T>
125 template <
typename T>
135 template <
typename T>
138 var<T>::take(
const var<T>& other)
144 template <
typename T>
147 var<T>::take_as_init_(
const argument& v)
154 template <
typename T>
157 var<T>::take_n_times_(
unsigned n_times,
const argument& v)
161 cov_ += n_times * v * v.t();
165 template <
typename T>
175 return (cov_ - sum_ * sum_.t() / n_) / n_;
181 template <
typename T>
189 template <
typename T>
197 template <
typename T>
210 template <
typename T>
218 # endif // ! MLN_INCLUDE_ONLY
227 #endif // ! MLN_ACCU_STAT_VAR_HH