Intel® Integrated Performance Primitives (Intel® IPP) Developer Guide and Reference

ID 790148
Date 3/22/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

StdDev

Computes the standard deviation value of a vector.

Syntax

IppStatus ippsStdDev_32f(const Ipp32f* pSrc, int len, Ipp32f* pStdDev, IppHintAlgorithm hint);

IppStatus ippsStdDev_64f(const Ipp64f* pSrc, int len, Ipp64f* pStdDev);

IppStatus ippsStdDev_16s_Sfs(const Ipp16s* pSrc, int len, Ipp16s* pStdDev, int scaleFactor);

IppStatus ippsStdDev_16s32s_Sfs(const Ipp16s* pSrc, int len, Ipp32s* pStdDev, int scaleFactor);

Include Files

ipps.h

Domain Dependencies

Headers: ippcore.h, ippvm.h

Libraries: ippcore.lib, ippvm.lib

Parameters

pSrc

Pointer to the source vector.

pStdDev

Pointer to the output result.

len

Number of elements in the vector.

hint

Suggests using specific code. The possible values for the hint argument are described in Hint Arguments.

scaleFactor

Scale factor, refer to Integer Scaling.

Description

This function computes the standard deviation of the input vector pSrc, and stores the result in pStdDev. The vector length can not be less than 2. The standard deviation of pSrc is defined by the unbiased estimate formula:



The hint argument suggests using specific code, either faster but less accurate calculation, or more accurate but slower calculation.

Return Values

ippStsNoErr

Indicates no error.

ippStsNullPtrErr

Indicates an error when the pStdDev or pSrc pointer is NULL.

ippStsSizeErr

Indicates an error when len is less than or equal to 1.

Example

The example below shows how to use the function ippsStdDev_32f.

void stdev(void) {
      Ipp32f *x = ippsMalloc_32f(1000), stdev;
      int i;
      for (i = 0; i<1000; ++i) x[i] = (float)rand() / RAND_MAX;
      ippsStdDev_32f(x, 1000, &stdev, ippAlgHintFast);
      printf_32f("stdev =", &stdev, 1, ippStsNoErr);
      ippsFree(x);
}   

Output:

 stdev = 0.286813
Matlab* Analog: 
    >> x = rand(1,1000); std(x)