Overview
Calculates the square distance between a single complex input for each point in a complex vector scaled by a scalar value.
Dispatcher Prototype
void volk_32fc_x2_s32f_square_dist_scalar_mult_32f(
float* target,
lv_32fc_t* src0,
lv_32fc_t* points,
float scalar,
unsigned int num_points)
float complex lv_32fc_t
Definition: volk_complex.h:74
Inputs
- src0: The complex input. Only the first point is used.
- points: A complex vector of reference points.
- scalar: A float to scale the distances by
- 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. Normalize distances by the area of the 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;
}
float scale = 1.f/64.f;
volk_32fc_x2_s32f_square_dist_scalar_mult_32f(out, rx, constellation, scale, 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");
}
size_t volk_get_alignment(void)
Get the machine alignment in bytes.
Definition: volk.tmpl.c:90
#define lv_cmake(r, i)
Definition: volk_complex.h:77
__VOLK_DECL_BEGIN VOLK_API void * volk_malloc(size_t size, size_t alignment)
Allocate size bytes of data aligned to alignment.
Definition: volk_malloc.c:38
VOLK_API void volk_free(void *aptr)
Free's memory allocated by volk_malloc.
Definition: volk_malloc.c:80