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

Overview

Normalizes all points in the buffer by the scalar value (divides each data point by the scalar value).

Dispatcher Prototype

void volk_32f_s32f_normalize(float* vecBuffer, const float scalar, unsigned int
num_points)

Inputs

  • vecBuffer: The buffer of values to be vectorized.
  • scalar: The scale value to be applied to each buffer value.
  • num_points: The number of data points.

Outputs

  • vecBuffer: returns as an in-place calculation.

Example

int N = 10;
unsigned int alignment = volk_get_alignment();
float* increasing = (float*)volk_malloc(sizeof(float)*N, alignment);
float* out = (float*)volk_malloc(sizeof(float)*N, alignment);
for(unsigned int ii = 0; ii < N; ++ii){
increasing[ii] = 2.f * ((float)ii / (float)N) - 1.f;
}
// Normalize by the smallest delta (0.2 in this example)
float scale = 5.0f;
volk_32f_s32f_normalize(increasing, scale, N);
for(unsigned int ii = 0; ii < N; ++ii){
printf("increasing[%u] = %f\n", ii, increasing[ii]);
}
volk_free(increasing);
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