Vector Optimized Library of Kernels  2.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);