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

Overview

This block computes the dot product (or inner product) between two vectors, the input and taps vectors. Given a set of num_points taps, the result is the sum of products between the two vectors. The result is a single value stored in the result address and is returned as a float.

Dispatcher Prototype

void volk_32f_x2_dot_prod_32f(float* result, const float* input, const float* taps,
unsigned int num_points)

Inputs

  • input: vector of floats.
  • taps: float taps.
  • num_points: number of samples in both input and taps.

Outputs

  • result: pointer to a float value to hold the dot product result.

Example Take the dot product of an increasing vector and a vector of ones. The result is the sum of integers (0,9).

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