Loading...
Searching...
No Matches
volk_32fc_x2_square_dist_32f

Overview

Calculates the square distance between a single complex input for each point in a complex vector.

Dispatcher Prototype

void volk_32fc_x2_square_dist_32f(float* target, const lv_32fc_t* src0, lv_32fc_t*
points, unsigned int num_points) {

Inputs

- src0: The complex input. Only the first point is used.
- points: A complex vector of reference points.
- num_points: The number of data points.

Outputs

- target: A vector of distances between src0 and the vector of points.

Example Calculate the distance between an input and reference points in a square 16-qam constellation.

int N = 16;
unsigned int alignment = volk_get_alignment();
lv_32fc_t* constellation = (lv_32fc_t*)volk_malloc(sizeof(lv_32fc_t)*N, alignment);
lv_32fc_t* rx = (lv_32fc_t*)volk_malloc(sizeof(lv_32fc_t)*N, alignment);
float* out = (float*)volk_malloc(sizeof(float)*N, alignment);
float const_vals[] = {-3, -1, 1, 3};
// Generate 16-QAM constellation points
unsigned int jj = 0;
for(unsigned int ii = 0; ii < N; ++ii){
constellation[ii] = lv_cmake(const_vals[ii%4], const_vals[jj]);
if((ii+1)%4 == 0) ++jj;
}
*rx = lv_cmake(0.5f, 2.f);
volk_32fc_x2_square_dist_32f(out, rx, constellation, N);
printf("Distance from each constellation point:\n");
for(unsigned int ii = 0; ii < N; ++ii){
printf("%.4f ", out[ii]);
if((ii+1)%4 == 0) printf("\n");
}
volk_free(rx);
volk_free(constellation);
volk_free(out);