Vector Optimized Library of Kernels 3.1.0
Architecture-tuned implementations of math kernels
volk_32fc_x2_add_32fc

Overview

Adds two vectors together element by element:

c[i] = a[i] + b[i]

Dispatcher Prototype

void volk_32fc_x2_add_32fc(lv_32fc_t* cVector, const lv_32fc_t* aVector, const
lv_32fc_t* bVector, unsigned int num_points)

Inputs

  • aVector: First vector of input points.
  • bVector: Second vector of input points.
  • num_points: The number of values in both input vector.

Outputs

  • cVector: The output vector.

Example

The follow example adds the increasing and decreasing vectors such that the result of every summation pair is 10

int N = 10;
unsigned int alignment = volk_get_alignment();
lv_32fc_t* increasing = (lv_32fc_t*)volk_malloc(sizeof(lv_32fc_t)*N, alignment);
lv_32fc_t* decreasing = (lv_32fc_t*)volk_malloc(sizeof(lv_32fc_t)*N, alignment);
lv_32fc_t* out = (lv_32fc_t*)volk_malloc(sizeof(lv_32fc_t)*N, alignment);
for(unsigned int ii = 0; ii < N; ++ii){
increasing[ii] = (lv_32fc_t)ii;
decreasing[ii] = 10.f - (lv_32fc_t)ii;
}
volk_32fc_x2_add_32fc(out, increasing, decreasing, N);
for(unsigned int ii = 0; ii < N; ++ii){
printf("out[%u] = %1.2f\n", ii, out[ii]);
}
volk_free(increasing);
volk_free(decreasing);
volk_free(out);