doc/Programs/LecturePrograms/programs/Blocking/parallelblocking.cpp
void meanvar(double *vals, int n_vals, double *res){
  double m2=0, m=0, val;
  for(int i=0; i<n_vals; i++){
    val=vals[i];
    m+=val;
    m2+=val*val;
  }

  m  /= double(n_vals);
  m2 /= double(n_vals);

  res[0] = m;
  res[1] = m2-(m*m);

}
// calculate mean and variance of vals, results stored in res
calculate mean and variance of vals, results stored in res
calculate mean and variance of vals results stored in res
void meanvar(double *vals, int n_vals, double *res){
  double m2=0, m=0, val;
  for(int i=0; i<n_vals; i++){
    val=vals[i];
    m+=val;
    m2+=val*val;
  }
  m  /= double(n_vals);
  m2 /= double(n_vals);
  res[0] = m;
  res[1] = m2-(m*m);
}
void meanvar ( double * vals , int n_vals , double * res ) { double m2 = 0 , m = 0 , val ; for ( int i = 0 ; i < n_vals ; i ++ ) { val = vals [ i ] ; m += val ; m2 += val * val ; } m /= double ( n_vals ) ; m2 /= double ( n_vals ) ; res [ 0 ] = m ; res [ 1 ] = m2 - ( m * m ) ; }
calculate mean and variance of vals, results stored in res
calculate mean and variance of vals results stored in res