Developer Reference

  • 2021
  • 01/15/2021
  • Public Content
Contents

Mean

Computes the mean value of a vector.

Syntax

IppStatus ippsMean_32f(const Ipp32f*
pSrc
, int
len
, Ipp32f*
pMean,
IppHintAlgorithm
hint
);
IppStatus ippsMean_32fc(const Ipp32fc*
pSrc
, int
len
, Ipp32fc*
pMean,
IppHintAlgorithm
hint
);
IppStatus ippsMean_64f(const Ipp64f*
pSrc
, int
len
, Ipp64f*
pMean
);
IppStatus ippsMean_64fc(const Ipp64fc*
pSrc
, int
len
, Ipp64fc*
pMean
);
IppStatus ippsMean_16s_Sfs(const Ipp16s*
pSrc
, int
len
, Ipp16s*
pMean
, int
scaleFactor
);
IppStatus ippsMean_32s_Sfs(const Ipp32s*
pSrc
,int
len
,Ipp32s*
pMean
,int
scaleFactor
);
IppStatus ippsMean_16sc_Sfs(const Ipp16sc*
pSrc
, int
len
, Ipp16sc*
pMean
, 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.
pMean
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 mean (average) of the vector
pSrc
, and stores the result in
pMean
. The mean of
pSrc
is defined by the 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
pMean
or
pSrc
pointer is
NULL
.
ippStsSizeErr
Indicates an error when
len
is less than or equal to 0.

Example

The example below shows how to use the function
ippsMean_32f
void mean(void) { Ipp32f *x = ippsMalloc_32f(1000), mean; int i; for(i = 0; i<1000; ++i) x[i] = (float)rand() / RAND_MAX; ippsMean_32f(x, 1000, &mean, ippAlgHintFast); printf_32f(“mean =”, &mean, 1, ippStsNoErr); ippsFree(x); }
Output:
mean = 0.492591 Matlab* Analog: >> x = rand(1,1000); mean(x)

Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.