Developer Reference

  • 2020.2
  • 07/15/2020
  • Public Content

Auxiliary Data Transformations

This section presents C examples for conversion from the Cartesian to polar representation of complex data and vice versa.
Conversion from Cartesian to polar representation of complex data
// Cartesian->polar conversion of complex data // Cartesian representation: z = re + I*im // Polar representation: z = r * exp( I*phi ) #include <mkl_vml.h>   void variant1_Cartesian2Polar(int n,const double *re,const double *im, double *r,double *phi) { vdHypot(n,re,im,r); // compute radii r[] vdAtan2(n,im,re,phi); // compute phases phi[] }   void variant2_Cartesian2Polar(int n,const MKL_Complex16 *z,double *r,double *phi, double *temp_re,double *temp_im) { vzAbs(n,z,r); // compute radii r[] vdPackI(n, (double*)z + 0, 2, temp_re); vdPackI(n, (double*)z + 1, 2, temp_im); vdAtan2(n,temp_im,temp_re,phi); // compute phases phi[] }
Conversion from polar to Cartesian representation of complex data
// Polar->Cartesian conversion of complex data. // Polar representation: z = r * exp( I*phi ) // Cartesian representation: z = re + I*im #include <mkl_vml.h>   void variant1_Polar2Cartesian(int n,const double *r,const double *phi, double *re,double *im) { vdSinCos(n,phi,im,re); // compute direction, i.e. z[]/abs(z[]) vdMul(n,r,re,re); // scale real part vdMul(n,r,im,im); // scale imaginary part }   void variant2_Polar2Cartesian(int n,const double *r,const double *phi, MKL_Complex16 *z, double *temp_re,double *temp_im) { vdSinCos(n,phi,temp_im,temp_re); // compute direction, i.e. z[]/abs(z[]) vdMul(n,r,temp_im,temp_im); // scale imaginary part vdMul(n,r,temp_re,temp_re); // scale real part vdUnpackI(n,temp_re,(double*)z + 0, 2); // fill in vdUnpackI(n,temp_im,(double*)z + 1, 2); // fill in }

Product and Performance Information


Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804