CartToPolar

Converts the elements of a complex vector to polar coordinate form.

Syntax

IppStatus ippsCartToPolar_32f(const Ipp32f* pSrcRe, const Ipp32f* pSrcIm, Ipp32f* pDstMagn, Ipp32f* pDstPhase, int len);

IppStatus ippsCartToPolar_64f(const Ipp64f* pSrcRe, const Ipp64f* pSrcIm, Ipp64f* pDstMagn, Ipp64f* pDstPhase, int len);

IppStatus ippsCartToPolar_32fc(const Ipp32fc* pSrc, Ipp32f* pDstMagn, Ipp32f* pDstPhase, int len);

IppStatus ippsCartToPolar_64fc(const Ipp64fc* pSrc, Ipp64f* pDstMagn, Ipp64f* pDstPhase, int len);

IppStatus ippsCartToPolar_16sc_Sfs(const Ipp16sc* pSrc, Ipp16s* pDstMagn, Ipp16s* pDstPhase, int len, int magnScaleFactor, int phaseScaleFactor);

Parameters

pSrc

Pointer to the source vector.

pSrcRe

Pointer to the source vector which stores the real components of Cartesian X,Y pairs.

pSrcIm

Pointer to the source vector which stores the imaginary components of Cartesian X,Y pairs.

pDstMagn

Pointer to the vector which stores the magnitude (radius) component of the elements of the vector pSrc.

pDstPhase

Pointer to the vector which stores the phase (angle) component of the elements of the vector pSrc in radians. Phase values are in the range (-π, π].

len

Number of elements in the vector.

magnScaleFactor

Integer scale factor for the magnitude component, refer to Integer Scaling.

phaseScaleFactor

Integer scale factor for the phase component, refer to Integer Scaling.

Description

The function ippsCartToPolar is declared in the ipps.h file. This function converts the elements of a complex input vector pSrcor the complex input vector whose real and imaginary components are specified in the vectors pSrcRe and pSrcIm, respectively, to polar coordinate form, and stores the magnitude (radius) component of each element in the vector pDstMagn and the phase (angle) component of each element in the vector pDstPhase.

The example below verifies that points are lying in the unit radius circle.

Return Values

ippStsNoErr

Indicates no error.

ippStsNullPtrErr

Indicates an error when at least one of the specified pointers is NULL.

ippStsSizeErr

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

Using the ippsCartToPolar Function

IppStatus cart2polar( void ) {
     Ipp64f cart[6], magn[4], phase[4];
     int n;
     for (n=0; n<6; ++n) cart[n] = sin(IPP_2PI * n / 8);
     IppStatus st = ippsCartToPolar_64f( cart, cart+2, magn, phase, 4 );
     printf_64f( "magn =", magn, 4, st );
     return st;
}

		
Output:
    magn =  1.000000 1.000000 1.000000 1.000000

Submit feedback on this help topic

Copyright © 2000 - 2011, Intel Corporation. All rights reserved.