Variance

Computes the variance of a vector.

Syntax

Intel IPP style:

IppStatus ippsqVariance_32f(const Ipp32f* pSrc, Ipp32u len, Ipp32f* pVar);

IppStatus ippsqVarianceQ15_16s32s_Rz(const Ipp16s* pSrc, Ipp32u len, Ipp32s* pVar);

IppStatus ippsqVarianceQ31_32s64s_Rz(const Ipp32s* pSrc, Ipp32u len, Ipp64s* pVar);

DSP style:

void ippsq_var_f32(const float32_t* pSrc, uint32_t len, float32_t* pVar);

void ippsq_var_q15(const q15_t* pSrc, uint32_t len, q15_t* pVar);

void ippsq_var_q31(const q31_t* pSrc, uint32_t len, q31_t* pVar);

Include Files

ippsq.h

dsp.h

Parameters

pSrc

Pointer to the source vector.

len

Number of elements in the vector.

pVar

Pointer to the result.

Description

This function computes the variance of the pSrc vector and stores the result in pVar. The variance is computed by the following formula:

Var=SUM((pSrc[n]-Mean(pSrc))2)/(len-1)

Function flavors with the _Rz suffix perform rounding to zero.

Return Values

ippStsNoErr

Indicates no error.

ippStsSizeErr

Indicates an error when len is less than 2.

ippStsNullPtrErr

Indicates an error when any of the specified pointers is NULL.
For more complete information about compiler optimizations, see our Optimization Notice.