Loading...
Searching...
No Matches
volk_32f_stddev_and_mean_32f_x2

Overview

Computes the standard deviation and mean of the input buffer by means of Youngs and Cramer's Algorithm

Dispatcher Prototype

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

Inputs

- inputBuffer: The buffer of points.
- num_points The number of values in input buffer.

Outputs

- stddev: The calculated standard deviation.
- mean: The mean of the input buffer.

Example Generate random numbers with c++11's normal distribution and estimate the mean and standard deviation

int N = 1000;
unsigned int alignment = volk_get_alignment();
float* rand_numbers = (float*) volk_malloc(sizeof(float)*N, alignment);
float* mean = (float*) volk_malloc(sizeof(float), alignment);
float* stddev = (float*) volk_malloc(sizeof(float), alignment);
// Use a normal generator with 0 mean, stddev 1000
std::default_random_engine generator;
std::normal_distribution<float> distribution(0, 1000);
for(unsigned int ii = 0; ii < N; ++ii) {
rand_numbers[ii] = distribution(generator);
}
volk_32f_stddev_and_mean_32f_x2(stddev, mean, rand_numbers, N);
printf("std. dev. = %f\n", *stddev);
printf("mean = %f\n", *mean);
volk_free(rand_numbers);
volk_free(mean);
volk_free(stddev);