2 #ifndef vpdt_update_gaussian_h_ 3 #define vpdt_update_gaussian_h_ 21 template<
class F,
class Covar,
class Disambiguate=
void>
49 vector ev = c.eigenvalues();
51 for (
unsigned int i=0; i<dim; ++i){
56 c.set_eigenvalues(ev);
81 for (
unsigned int i=0; i<dim; ++i){
144 template <
class F,
class Covar>
153 T rho_comp = T(1) - rho;
155 vector diff = sample - gaussian.
mean;
159 gaussian.
covar *= rho_comp;
162 gaussian.
mean += (rho * diff);
170 template <
class F,
class Covar>
181 #endif // vpdt_update_gaussian_h_ Specialized classes to update covariance of different types.
vpdt_field_traits< F >::vector_type vector
the data type used for vectors.
static void increment(T &c, const T &s, const vector &d)
update the covariance matrix with a weighted vector difference.
VNL_EXPORT T dot_product(m const &, m const &)
vpdt_field_traits< F >::vector_type vector
the data type used for vectors.
covar_type covar
the matrix covariance.
static void enforce_min(T &c, const T &min_var)
enforce a minimum covariance value in all dimensions.
static void increment(Covar &c, const T &s, const vector &d)
update the covariance matrix with a weighted vector difference.
void vpdt_update_gaussian(vpdt_gaussian< F, Covar > &gaussian, typename vpdt_field_traits< F >::scalar_type rho, const F &sample)
Update the statistics given a 1D Gaussian distribution and a learning rate.
T & vpdt_index(vnl_vector< T > &v, unsigned int i)
Index into a vnl_vector.
vpdt_field_traits< F >::scalar_type T
the data type used for scalars.
static void enforce_min(T &c, const T &min_var)
enforce a minimum covariance value in all dimensions.
vpdt_field_traits< F >::scalar_type T
the data type used for scalars.
VNL_EXPORT m element_product(m const &, m const &)
A Gaussian with variance independent in each dimension.
vpdt_field_traits< F >::scalar_type T
the data type used for scalars.
A generic Gaussian distribution.
specialized template trait classes for properties of a field type
The field traits class (scalar).
generate the vpdt_eigen_sys_matrix type from a field type.
static void increment(vector &c, const T &s, const vector &d)
update the covariance matrix with a weighted vector difference.
static void enforce_min(Covar &c, const T &min_var)
enforce a minimum covariance value in all dimensions.
vpdt_field_traits< F >::scalar_type T
the data type used for scalars.
static void enforce_min(vector &c, const T &min_var)
enforce a minimum covariance value in all dimensions.
vpdt_eigen_sym_matrix_gen< F >::type Covar
the data type used for covariance.
vpdt_field_traits< F >::vector_type vector
the data type used for vectors.
unsigned int vpdt_size(const vnl_vector< T > &v)
Access the size of a vnl_vector.
float outer_product(const float &v1, const float &v2)
vnl defines outer_product for vectors but not scalars.
static void increment(T &c, const T &s, const T &d)
update the covariance matrix with a weighted vector difference.