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

Overview

Takes input vector iBuffer as the real (inphase) part and input vector qBuffer as the imag (quadrature) part and combines them into a complex output vector.

c[i] = complex(a[i], b[i])

Dispatcher Prototype

void volk_32f_x2_interleave_32fc(lv_32fc_t* complexVector, const float* iBuffer, const
float* qBuffer, unsigned int num_points)
float complex lv_32fc_t
Definition: volk_complex.h:74

Inputs

  • iBuffer: Input vector of samples for the real part.
  • qBuffer: Input vector of samples for the imaginary part.
  • num_points: The number of values in both input vectors.

Outputs

  • complexVector: The output vector of complex numbers.

Example Generate the top half of the unit circle with real points equally spaced.

int N = 10;
unsigned int alignment = volk_get_alignment();
float* imag = (float*)volk_malloc(sizeof(float)*N, alignment);
float* real = (float*)volk_malloc(sizeof(float)*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){
real[ii] = 2.f * ((float)ii / (float)N) - 1.f;
imag[ii] = std::sqrt(1.f - real[ii] * real[ii]);
}
volk_32f_x2_interleave_32fc(out, imag, real, N);
for(unsigned int ii = 0; ii < N; ++ii){
printf("out[%u] = %1.2f + %1.2fj\n", ii, std::real(out[ii]), std::imag(out[ii]));
}
volk_free(imag);
volk_free(real);
volk_free(out);
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