Vector Optimized Library of Kernels  3.0.0
Architecture-tuned implementations of math kernels

Overview

Returns Argmax_i mag(x[i]). Finds and returns the index which contains the maximum magnitude for complex points in the given vector.

Dispatcher Prototype

void volk_32fc_index_max_32u(uint32_t* target, lv_32fc_t* src0, uint32_t
num_points)
float complex lv_32fc_t
Definition: volk_complex.h:74

Inputs

  • src0: The complex input vector.
  • num_points: The number of samples.

Outputs

  • target: The index of the point with maximum magnitude.

Example Calculate the index of the maximum value of $x^2 + x$ for points around the unit circle.

int N = 10;
uint32_t alignment = volk_get_alignment();
lv_32fc_t* in = (lv_32fc_t*)volk_malloc(sizeof(lv_32fc_t)*N, alignment);
uint32_t* max = (uint32_t*)volk_malloc(sizeof(uint32_t), alignment);
for(uint32_t 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_index_max_32u(max, in, N);
printf("index of max value = %u\n", *max);
volk_free(max);
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