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,
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;
float* out = (
float*)
volk_malloc(
sizeof(
float)*N, alignment);
float const_vals[] = {-3, -1, 1, 3};
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;
}
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");
}