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

Overview

Accumulates the values in the input buffer.

Dispatcher Prototype

void volk_32f_accumulator_s32f(float* result, const float* inputBuffer, unsigned int
num_points)

Inputs

  • inputBuffer The buffer of data to be accumulated
  • num_points: The number of data points.

Outputs

  • result The accumulated result.

Example Calculate the sum of numbers 0 through 99

int N = 100;
unsigned int alignment = volk_get_alignment();
float* increasing = (float*)volk_malloc(sizeof(float)*N, alignment);
float* out = (float*)volk_malloc(sizeof(float), alignment);
for(unsigned int ii = 0; ii < N; ++ii){
increasing[ii] = (float)ii;
}
volk_32f_accumulator_s32f(out, increasing, N);
printf("sum(1..100) = %1.2f\n", out[0]);
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