Function vector_variance_fmean (o2scl)

O2scl : Function List

template<class vec_t>
double o2scl::vector_variance_fmean(size_t n, const vec_t &data, double mean)

Compute variance with specified mean known in advance.

This function computes

\[ \frac{1}{N} \sum_{i} \left( x_i - \mu \right)^2 \]
where the value of \( \mu \) is given in mean.

This function produces the same results as gsl_stats_variance_with_fixed_mean(). IF n is zero, this function returns zero.

template<class vec_t>
double o2scl::vector_variance_fmean(const vec_t &data, double mean)

Compute variance with specified mean known in advance.

This function computes

\[ \frac{1}{N} \sum_{i} \left( x_i - \mu \right)^2 \]
where the value of \( \mu \) is given in mean.

This function produces the same results as gsl_stats_variance_with_fixed_mean(). If the vector size is zero, this function will return zero.