VF_meanvarVD_meanvarVE_meanvar
FunctionMean and variance of a one-dimensional distribution
Syntax C/C++#include <VFstd.h>
float VF_meanvar( float *Var, fVector X, ui size );
C++ VecObj#include <OptiVec.h>
T vector<T>::meanvar( T *Var );
Pascal/Delphiuses VFstd;
function VF_meanvar( var Variance:Single; X:fVector; size:UIntSize ): Single;
CUDA function C/C++#include <cudaVFstd.h>
int cudaVF_meanvar( float *h_RetValMean, float *h_RetValVariance, fVector d_X, ui size );
int cusdVF_meanvar( float *d_RetValMean, float *d_RetValVariance, fVector d_X, ui size );
float VFcu_meanvar( float *h_RetValVariance, fVector h_X, ui size );
CUDA function Pascal/Delphiuses VFstd;
function cudaVF_meanvar( var h_RetValMean, h_RetValVariance:Single; d_X:fVector; size:UIntSize ): IntBool;
function cusdVF_meanvar( d_RetValMean, d_RetValVariance:PSingle; d_X:fVector; size:UIntSize ): IntBool;
function VFcu_meanvar( h_X:fVector; size:UIntSize ): Single;
Descriptionmean = (1 / size) * sum( Xi )
var = (1 / (size−1)) * sum( (Xi - mean)2 )
Note that the denominator in the definition of var is size−1, whereas, in the routine VF_varianceC, it is simply size.The reason for that difference is that here the mean is calculated first and then the variance is determined using this value, whereas in VF_varianceC, the parameter C is pre-set. The mean is returned and the variance stored at the address passed as "Var" (C/C++), or in the variable "variance" (Pascal/Delphi).
Error handlingIn the case of size=1, the variance (which should be infinitely large) is set to HUGE_VAL.
Return valuemean of the vector elements.
See alsoVF_mean,   VF_selected_mean,   VF_min_max_mean_stddev,   VF_varianceC,   VF_varianceV,   VF_sum,   VF_ssq,   VF_ssqdevC,   VF_linregress

VectorLib Table of Contents  OptiVec home