FunctionMean and variance with weights
Syntax C/C++#include <VFmath.h>
float VF_meanvarwW( float *Var, fVector X, fVector Wt, ui size );
C++ VecObj#include <OptiVec.h>
T vector<T>::meanvarwW( T *Var, const vector<T>& Wt );
Pascal/Delphiuses VFmath;
function VF_meanvarwW( var variance:Single; X, Wt:fVector; size:UIntSize ): Single;
CUDA function C/C++#include <cudaVFstd.h>
int cudaVF_meanvarwW( float *h_RetValMean, float *h_RetValVariance, fVector d_X, fVector d_Wt, ui size );
int cusdVF_meanvarwW( float *d_RetValMean, float *d_RetValVariance, fVector d_X, fVector d_Wt, ui size );
float VFcu_meanvarwW( float *h_RetValVariance, fVector h_X, fVector h_Wt, ui size );
CUDA function Pascal/Delphiuses VFstd;
function cudaVF_meanvarwW( var h_RetValMean, h_RetValVariance:Single; d_X, d_Wt:fVector; size:UIntSize ): IntBool;
function cusdVF_meanvarwW( d_RetValMean, d_RetValVariance:PSingle; d_X, d_Wt:fVector; size:UIntSize ): IntBool;
function VFcu_meanvarwW( h_X, h_Wt:fVector; size:UIntSize ): Single;
Descriptionmean = (1 / sum( Wti )) * sum( Xi * Wti )
var = (1 / sum( Wti )) * sum( Wti * (Xi - mean)2 )
The weighted mean is returned and the variance stored at the address passed as "Var" (C/C++) or in the variable "variance" (Pascal/Delphi).
Error handlingnone
Return valuemean of the vector elements.
See alsoVF_meanwW,   VF_varianceCwW,   VF_varianceVwW,   VF_linregress

VectorLib Table of Contents  OptiVec home