Vector Optimized Library of Kernels 3.1.0
Architecture-tuned implementations of math kernels
volk_32fc_s32f_atan2_32f

Overview

Computes the arctan for each value in a complex vector and applies a normalization factor.

Dispatcher Prototype

void volk_32fc_s32f_atan2_32f(float* outputVector, const lv_32fc_t* complexVector,
const float normalizeFactor, unsigned int num_points)

Inputs

  • inputVector: The byte-aligned input vector containing interleaved IQ data (I = cos, Q = sin).
  • normalizeFactor: The atan results are divided by this normalization factor.
  • num_points: The number of complex values in inputVector.

Outputs

  • outputVector: The vector where the results will be stored.

Example Calculate the arctangent of points around the unit circle.

int N = 10;
unsigned int alignment = volk_get_alignment();
lv_32fc_t* in = (lv_32fc_t*)volk_malloc(sizeof(lv_32fc_t)*N, alignment);
float* out = (float*)volk_malloc(sizeof(float)*N, alignment);
float scale = 1.f; // we want unit circle
for(unsigned int ii = 0; ii < N/2; ++ii){
// Generate points around the unit circle
float real = -4.f * ((float)ii / (float)N) + 1.f;
float imag = std::sqrt(1.f - real * real);
in[ii] = lv_cmake(real, imag);
in[ii+N/2] = lv_cmake(-real, -imag);
}
volk_32fc_s32f_atan2_32f(out, in, scale, N);
for(unsigned int ii = 0; ii < N; ++ii){
printf("atan2(%1.2f, %1.2f) = %1.2f\n",
lv_cimag(in[ii]), lv_creal(in[ii]), out[ii]);
}
volk_free(out);