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

Overview

Computes the standard deviation of the input buffer using the supplied mean.

Dispatcher Prototype

void volk_32f_s32f_stddev_32f(float* stddev, const float* inputBuffer, const float
mean, unsigned int num_points)

Inputs

  • inputBuffer: The input vector of floats.
  • mean: The mean of the input buffer.
  • num_points: The number of data points.

Outputs

  • stddev: The output vector.

Example Calculate the standard deviation from numbers generated with c++11's normal generator

int N = 1000;
unsigned int alignment = volk_get_alignment();
float* increasing = (float*)volk_malloc(sizeof(float)*N, alignment);
float mean = 0.0f;
float* stddev = (float*)volk_malloc(sizeof(float), alignment);
// Use a normal generator with 0 mean, stddev = 1
std::default_random_engine generator;
std::normal_distribution<float> distribution(mean,1);
for(unsigned int ii = 0; ii < N; ++ii){
increasing[ii] = distribution(generator);
}
volk_32f_s32f_power_32f(stddev, increasing, mean, N);
printf("std. dev. = %f\n", *stddev);
volk_free(increasing);
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