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);
return 0;