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

Overview

Conjugate the input complex vector, multiply them by a complex scalar, add the another input complex vector and returns the results.

c[i] = a[i] + conj(b[i]) * scalar

Dispatcher Prototype

void volk_32fc_x2_s32fc_multiply_conjugate_add_32fc(lv_32fc_t* cVector, const
lv_32fc_t* aVector, const lv_32fc_t* bVector, const lv_32fc_t scalar, unsigned int
num_points);
float complex lv_32fc_t
Definition: volk_complex.h:74

Inputs

  • aVector: The input vector to be added.
  • bVector: The input vector to be conjugate and multiplied.
  • scalar: The complex scalar to multiply against conjugated bVector.
  • num_points: The number of complex values in aVector and bVector to be conjugate, multiplied and stored into cVector.

Outputs

  • cVector: The vector where the results will be stored.

Example Calculate coefficients.

int n_filter = 2 * N + 1;
unsigned int alignment = volk_get_alignment();
// state is a queue of input IQ data.
lv_32fc_t* state = (lv_32fc_t*)volk_malloc(sizeof(lv_32fc_t) * n_filter, alignment);
// weight and next one.
lv_32fc_t* weight = (lv_32fc_t*)volk_malloc(sizeof(lv_32fc_t) * n_filter, alignment);
lv_32fc_t* next = (lv_32fc_t*)volk_malloc(sizeof(lv_32fc_t) * n_filter, alignment);
...
// push back input IQ data into state.
foo_push_back_queue(state, input);
// get filtered output.
lv_32fc_t output = lv_cmake(0.f,0.f);
for (int i = 0; i < n_filter; i++) {
output += state[i] * weight[i];
}
// update weight using output.
float real = lv_creal(output) * (1.0 - std::norm(output)) * MU;
lv_32fc_t factor = lv_cmake(real, 0.f);
volk_32fc_x2_s32fc_multiply_conjugate_add_32fc(next, weight, state, factor, n_filter);
lv_32fc_t *tmp = next;
next = weight;
weight = tmp;
weight[N + 1] = lv_cmake(lv_creal(weight[N + 1]), 0.f);
...
volk_free(state);
volk_free(weight);
volk_free(next);
size_t volk_get_alignment(void)
Get the machine alignment in bytes.
Definition: volk.tmpl.c:90
#define lv_cmake(r, i)
Definition: volk_complex.h:77
#define lv_creal(x)
Definition: volk_complex.h:96
for i
Definition: volk_config_fixed.tmpl.h:13
__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