1 #ifndef STAN_MATH_PRIM_MAT_FUN_WELFORD_COVAR_ESTIMATOR_HPP
2 #define STAN_MATH_PRIM_MAT_FUN_WELFORD_COVAR_ESTIMATOR_HPP
14 :
_m(Eigen::VectorXd::Zero(n)),
15 _m2(Eigen::MatrixXd::Zero(n, n)) {
28 Eigen::VectorXd delta(q -
_m);
30 _m2 += (q -
_m) * delta.transpose();
void add_sample(const Eigen::VectorXd &q)
void sample_mean(Eigen::VectorXd &mean)
void sample_covariance(Eigen::MatrixXd &covar)
boost::math::tools::promote_args< T >::type mean(const std::vector< T > &v)
Returns the sample mean (i.e., average) of the coefficients in the specified standard vector...
welford_covar_estimator(int n)