Loading...
Searching...
No Matches
volk_32fc_magnitude_squared_32f

Overview

Calculates the magnitude squared of the complexVector and stores the results in the magnitudeVector.

Dispatcher Prototype

void volk_32fc_magnitude_squared_32f(float* magnitudeVector, const lv_32fc_t*
complexVector, unsigned int num_points)

Inputs

- complexVector: The complex input vector.
- num_points: The number of samples.

Outputs

- magnitudeVector: The output value.

Example Calculate the magnitude squared of for 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* magnitude = (float*)volk_malloc(sizeof(float)*N, alignment);
for(unsigned int ii = 0; ii < N/2; ++ii){
float real = 2.f * ((float)ii / (float)N) - 1.f;
float imag = std::sqrt(1.f - real * real);
in[ii] = lv_cmake(real, imag);
in[ii] = in[ii] * in[ii] + in[ii];
in[N-ii] = lv_cmake(real, imag);
in[N-ii] = in[N-ii] * in[N-ii] + in[N-ii];
}
volk_32fc_magnitude_32f(magnitude, in, N);
for(unsigned int ii = 0; ii < N; ++ii){
printf("out(%i) = %+.1f\n", ii, magnitude[ii]);
}
volk_free(in);
volk_free(magnitude);