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

Overview

Slices input floats and and returns 1 when the input >= 0 and 0 when < 0. Results are converted to 8-bit chars.

Dispatcher Prototype

void volk_32f_binary_slicer_8i(int8_t* cVector, const float* aVector, unsigned int
num_points)

Inputs

  • aVector: The input vector of floats.
  • num_points: The number of data points.

Outputs

  • cVector: The output vector of 8-bit chars.

Example Generate bytes of a 7-bit barker code from floats.

int N = 7;
unsigned int alignment = volk_get_alignment();
float* in = (float*)volk_malloc(sizeof(float)*N, alignment);
int8_t* out = (int8_t*)volk_malloc(sizeof(int8_t)*N, alignment);
in[0] = 0.9f;
in[1] = 1.1f;
in[2] = 0.4f;
in[3] = -0.7f;
in[5] = -1.2f;
in[6] = 0.2f;
in[7] = -0.8f;
volk_32f_binary_slicer_8i(out, in, N);
for(unsigned int ii = 0; ii < N; ++ii){
printf("out(%i) = %i\n", ii, out[ii]);
}
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