stats.hpp

Functions for calculating various statistics about an ensemble.

Note

Status: BETA

Functions

template<typename C>
remove_ptr_type<typename C::value_type>::type Sum(C &elements)

Calculate sum of the values in a container; if pointers to scalars, convert to scalar type.

template<typename C, typename FUN>
auto SumScalarResults(C &elements, FUN &&fun)

Sum the RESULTS of scalar values in a container; if pointers to scalars, convert to scalar type.

template<typename C>
double ShannonEntropy(C &elements)

Calculate Shannon Entropy of the members of the container passed.

template<typename C>
sfinae_decoy<double, typename C::value_type> Mean(C &elements)

Calculate the mean of the values in a container If values are pointers, they will be automatically de-referenced Values must be numeric.

template<typename C>
sfinae_decoy<double, typename C::value_type> Median(C elements)
template<typename C>
auto Variance(C &elements)

Calculate variance of the members of the container passed Only works on containers with a scalar member type

template<typename C>
sfinae_decoy<double, typename C::value_type> StandardDeviation(C &elements)

Calculate the standard deviation of the values in a container If values are pointers, they will be automatically de-referenced Values must be numeric.

template<typename C>
sfinae_decoy<double, typename C::value_type> StandardError(C &elements)

Calculate the standard error of the values in a container If values are pointers, they will be automatically de-referenced Values must be numeric.

template<typename C>
std::enable_if<!is_ptr_type<typename C::value_type>::value, int>::type UniqueCount(C &elements)

Count the number of unique elements in a container.

template<typename C, typename RET_TYPE, typename ARG_TYPE>
RET_TYPE MaxResult(std::function<RET_TYPE(ARG_TYPE)> &fun, C &elements)

Run the provided function on every member of a container and return the MAXIMUM result.

template<typename C, typename RET_TYPE, typename ARG_TYPE>
RET_TYPE MinResult(std::function<RET_TYPE(ARG_TYPE)> &fun, C &elements)

Run the provided function on every member of a container and return the MINIMUM result.

template<typename C, typename RET_TYPE, typename ARG_TYPE>
std::enable_if<std::is_scalar<RET_TYPE>::value, double>::type MeanResult(std::function<RET_TYPE(ARG_TYPE)> &fun, C &elements)

Run the provided function on every member of a container and return the AVERAGE result. Function must return a scalar (i.e. numeric) type.

template<typename C, typename RET_TYPE, typename ARG_TYPE>
vector<RET_TYPE> ApplyFunction(std::function<RET_TYPE(ARG_TYPE)> &fun, C &elements)

Run the provided function on every member of a container and return a vector of ALL results.