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

Overview

Multiplies the input complex vector by a complex scalar and returns the results.

Dispatcher Prototype

void volk_32fc_s32fc_multiply_32fc(lv_32fc_t* cVector, const lv_32fc_t* aVector, 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 multiplied.
  • scalar The complex scalar to multiply against aVector.
  • num_points: The number of complex values in aVector.

Outputs

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

Example Generate points around the unit circle and shift the phase pi/3 rad.

int N = 10;
unsigned int alignment = volk_get_alignment();
lv_32fc_t* in = (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);
lv_32fc_t scalar = lv_cmake((float)std::cos(M_PI/3.f), (float)std::sin(M_PI/3.f));
float delta = 2.f*M_PI / (float)N;
for(unsigned int ii = 0; ii < N/2; ++ii){
// Generate points around the unit circle
float real = std::cos(delta * (float)ii);
float imag = std::sin(delta * (float)ii);
in[ii] = lv_cmake(real, imag);
in[ii+N/2] = lv_cmake(-real, -imag);
}
volk_32fc_s32fc_multiply_32fc(out, in, scalar, N);
printf(" mag phase | mag phase\n");
for(unsigned int ii = 0; ii < N; ++ii){
printf("%+1.2f %+1.2f | %+1.2f %+1.2f\n",
std::abs(in[ii]), std::arg(in[ii]),
std::abs(out[ii]), std::arg(out[ii]));
}
volk_free(out);
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
__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