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

Overview

Returns Argmin_i x[i]. Finds and returns the index which contains the fist minimum value in the given vector.

Note that num_points is a uint32_t, but the return value is uint16_t. Providing a vector larger than the max of a uint16_t (65536) would miss anything outside of this boundary. The kernel will check the length of num_points and cap it to this max value, anyways.

Dispatcher Prototype

void volk_32f_index_min_16u(uint16_t* target, const float* source, uint32_t num_points)

Inputs

  • source: The input vector of floats.
  • num_points: The number of data points.

Outputs

  • target: The index of the fist minimum value in the input buffer.

Example

int N = 10;
uint32_t alignment = volk_get_alignment();
float* in = (float*)volk_malloc(sizeof(float)*N, alignment);
uint16_t* out = (uint16_t*)volk_malloc(sizeof(uint16_t), alignment);
for(uint32_t ii = 0; ii < N; ++ii){
float x = (float)ii;
// a parabola with a minimum at x=4
in[ii] = (x-4) * (x-4) - 5;
}
volk_32f_index_min_16u(out, in, N);
printf("minimum is %1.2f at index %u\n", in[*out], *out);
volk_free(out);
size_t volk_get_alignment(void)
Get the machine alignment in bytes.
Definition: volk.tmpl.c:90
__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