GNU Radio Manual and C++ API Reference  3.7.7
The Free & Open Software Radio Ecosystem
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages

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);