Magnitude

Computes the magnitude of a complex vector.

Syntax

Intel IPP style:

IppStatus ippsqMagnitude_32fc(const Ipp32fc* pSrc, Ipp32f* pDst, Ipp32u len);

IppStatus ippsqMagnitudeQ15Q14_16sc_Rm(const Ipp16sc* pSrc, Ipp16s* pDst, Ipp32u len);

IppStatus ippsqMagnitudeQ31Q30_32sc_Rm(const Ipp32sc* pSrc, Ipp32s* pDst, Ipp32u len);

DSP style:

void ippsq_cmplx_mag_f32(const float32_t* pSrc, float32_t* pDst, uint32_t len);

void ippsq_cmplx_mag_q15(const q15_t* pSrc, q15_t* pDst, uint32_t len);

void ippsq_cmplx_mag_q31(const q31_t* pSrc, q31_t* pDst, uint32_t len);

Include Files

ippsq.h

dsp.h

Parameters

pSrc

Pointer to the source vector.

pDst

Pointer to the destination vector.

len

Number of elements in the vector.

Description

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

pDst[n]=SQRT((pSrc[n].re)2+(pSrc[n].im)2)

Function flavors with the _Rm suffix round down the result.

Scaling, Truncation, Saturation

Function Description

ippsqMagnitudeQ15Q14_16sc_Rm

ippsq_cmplx_mag_q15

The pSrc values are represented in Q15 complex format. The result of magnitude calculation of each complex number is represented in Q2.30. After calculation of the square root, the function shifts right the resulting values by 1 bit. Finally, the pDst values are represented in Q2.14 format.

ippsqMagnitudeQ31Q30_32sc_Rm

ippsq_cmplx_mag_q31

The pSrc values are represented in Q31 complex format. The result of magnitude calculation of each complex number is represented in Q2.62. After calculation of the square root, the function shifts right the resulting values by 1 bit. Finally, the pDst values are represented in Q2.30 format.

Return Values

ippStsNoErr

Indicates no error.

ippStsNullPtrErr

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