SLIP
1.4
|
Provides some statistics algorithms. More...
#include <iostream>
#include <algorithm>
#include <iterator>
#include <numeric>
#include <cassert>
#include <cmath>
#include <set>
#include <vector>
#include "Array.hpp"
#include "macros.hpp"
#include "iterator_types.hpp"
#include "Block.hpp"
Go to the source code of this file.
Classes | |
struct | slip::Statistics< T > |
This is a structure to store descriptive statistics. More... | |
Namespaces | |
slip | |
This namespace corresponds to the kernel of the Simple Library on Image Processing (SLIP). That is to say that it contains the data structures and the algorithms needed by these data strucutres. | |
Functions | |
template<typename Integer , typename InputIterator > | |
Integer | slip::cardinal (InputIterator first, InputIterator last) |
Computes the cardinal or the number of elements of a range. More... | |
template<typename Value_T , typename InputIterator > | |
Value_T | slip::mean (InputIterator first, InputIterator last) |
Computes the mean value of a range
. More... | |
template<typename Value_T , typename InputIterator > | |
Value_T | slip::weighted_mean (InputIterator first, InputIterator last, InputIterator w_first, InputIterator w_last) |
Computes the weighted mean value of a range:
. More... | |
template<typename T , int N, typename InputIterator > | |
T | slip::nth_moment (InputIterator first, InputIterator last, T mean) |
Computes the nth moment of a range
. More... | |
template<typename T , typename InputIterator , typename InputIterator2 > | |
T | slip::covariance (InputIterator first, InputIterator last, InputIterator2 first2, T mean1, T mean2) |
Computes the covariance of a two sequences
. More... | |
template<typename T , typename InputIterator , typename InputIterator2 > | |
T | slip::unbiased_covariance (InputIterator first, InputIterator last, InputIterator2 first2, T mean1, T mean2) |
Computes the unbiased covariance of a two sequences
. More... | |
template<typename T , typename InputIterator > | |
T | slip::variance (InputIterator first, InputIterator last, T mean) |
Computes the variance of a range
. More... | |
template<typename T , typename InputIterator > | |
T | slip::unbiased_variance (InputIterator first, InputIterator last, T mean) |
Computes the unbiased variance of a range
. More... | |
template<typename T , typename InputIterator > | |
T | slip::std_dev (InputIterator first, InputIterator last, T mean) |
Computes the standard deviation of a range
. More... | |
template<typename T , typename InputIterator > | |
T | slip::unbiased_std_dev (InputIterator first, InputIterator last, T mean) |
Computes the unbiased standard deviation of a range
. More... | |
template<typename T , typename InputIterator > | |
T | slip::kurtosis (InputIterator first, InputIterator last, T mean) |
Computes the kurtosis of a range
A high kurtosis distribution has a sharper peak and longer, fatter tails, while a low kurtosis distribution has a more rounded peak and shorter thinner tails. Here are some common value of kurtosis for unimodal and symmetric densities: More... | |
template<typename T , typename InputIterator > | |
T | slip::unbiased_kurtosis (InputIterator first, InputIterator last, T mean) |
Computes the unbiased kurtosis of a range
A high kurtosis distribution has a sharper peak and longer, fatter tails, while a low kurtosis distribution has a more rounded peak and shorter thinner tails. More... | |
template<typename T , typename InputIterator > | |
T | slip::skewness (InputIterator first, InputIterator last, T mean) |
Computes the skewness of a range
skewness is a measure of the asymmetry of the probability distribution of a real-valued random variable. More... | |
template<typename T , typename InputIterator > | |
T | slip::unbiased_skewness (InputIterator first, InputIterator last, T mean) |
Computes the unbiased skewness of a range
skewness is a measure of the asymmetry of the probability distribution of a real-valued random variable. More... | |
template<typename T , typename InputIterator > | |
T | slip::rms (InputIterator first, InputIterator last) |
Computes the root mean square (rms) value of a range
. More... | |
template<typename InputIterator > | |
std::iterator_traits < InputIterator >::value_type | slip::median_from_sorted_data (InputIterator first, InputIterator last) |
Computes the median value from a sorted range: returns *(first + (last - first) / 2) More... | |
template<typename RandomAccessIterator , typename Size > | |
std::iterator_traits < RandomAccessIterator > ::value_type | slip::median_from_sorted_data_n (RandomAccessIterator first, Size n) |
Computes the median value from a sorted range: returns *(first + n/2). More... | |
template<typename RandomAccessIterator , typename Size > | |
std::iterator_traits < RandomAccessIterator > ::value_type | slip::median_from_data_n (RandomAccessIterator first, RandomAccessIterator last, Size n) |
Computes the median value from a non sorted range. More... | |
template<typename RandomAccessIterator , typename Size , typename StrictWeakOrdering > | |
std::iterator_traits < RandomAccessIterator > ::value_type | slip::median_from_data_n (RandomAccessIterator first, RandomAccessIterator last, Size n, StrictWeakOrdering comp) |
Computes the median value from a non sorted range. More... | |
template<typename RandomAccessIterator > | |
std::iterator_traits < RandomAccessIterator > ::value_type | slip::median (RandomAccessIterator first, RandomAccessIterator last) |
Computes the median value from a range. More... | |
template<typename RandomAccessIterator , typename StrictWeakOrdering > | |
std::iterator_traits < RandomAccessIterator > ::value_type | slip::median (RandomAccessIterator first, RandomAccessIterator last, StrictWeakOrdering comp) |
Computes the median value from a range. More... | |
template<typename RandomAccessIterator , typename SizeType > | |
std::iterator_traits < RandomAccessIterator > ::value_type | slip::median_n (RandomAccessIterator first, RandomAccessIterator last, SizeType n) |
Computes the median value from a range of size n. More... | |
template<typename RandomAccessIterator , typename SizeType , typename StrictWeakOrdering > | |
std::iterator_traits < RandomAccessIterator > ::value_type | slip::median_n (RandomAccessIterator first, RandomAccessIterator last, SizeType n, StrictWeakOrdering comp) |
Computes the median value from a range of size n. More... | |
template<typename RandomAccessIterator > | |
std::iterator_traits < RandomAccessIterator > ::value_type | slip::first_quartile (RandomAccessIterator first, RandomAccessIterator last) |
Computes the first quartile value from a non sorted range. More... | |
template<typename RandomAccessIterator > | |
std::iterator_traits < RandomAccessIterator > ::value_type | slip::third_quartile (RandomAccessIterator first, RandomAccessIterator last) |
Computes the third quartile value from a non sorted range. More... | |
template<typename ForwardIterator > | |
void | slip::n_max_elements (ForwardIterator first, ForwardIterator last, std::vector< ForwardIterator > &max, const std::size_t n=1) |
finds the n largest elements in the range [first, last). More... | |
template<typename ForwardIterator > | |
void | slip::n_min_elements (ForwardIterator first, ForwardIterator last, std::vector< ForwardIterator > &min, const std::size_t n=1) |
finds the n smallest elements in the range [first, last). More... | |
template<typename RandomAccessIterator , typename RandomAccessIterator2 > | |
void | slip::center (RandomAccessIterator first, RandomAccessIterator last, RandomAccessIterator2 out_first) |
Substracts its mean to a range. More... | |
template<typename RandomAccessIterator , typename RandomAccessIterator2 > | |
void | slip::studentize (RandomAccessIterator first, RandomAccessIterator last, RandomAccessIterator2 out_first) |
Substracts its mean to a range and divide it by its standard deviation. More... | |
template<typename Value_T , typename InputIterator , typename MaskIterator > | |
Value_T | slip::mean_mask (InputIterator first, InputIterator last, MaskIterator mask_first, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1)) |
Computes the mean value of a range over a mask
. More... | |
template<typename T , int N, typename InputIterator , typename MaskIterator > | |
T | slip::nth_moment_mask (InputIterator first, InputIterator last, MaskIterator mask_first, T mean, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1)) |
Computes the nth moment of a range over a mask
. More... | |
template<typename T , typename InputIterator , typename InputIterator2 , typename MaskIterator > | |
T | slip::covariance_mask (InputIterator first, InputIterator last, InputIterator2 first2, MaskIterator mask_first, T mean1, T mean2, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1)) |
Computes the covariance of a two sequences over a mask
. More... | |
template<typename T , typename InputIterator , typename InputIterator2 , typename MaskIterator > | |
T | slip::unbiased_covariance_mask (InputIterator first, InputIterator last, InputIterator2 first2, MaskIterator mask_first, T mean1, T mean2, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1)) |
Computes the unbiased covariance of a two sequences over a mask
. More... | |
template<typename T , typename InputIterator , typename MaskIterator > | |
T | slip::variance_mask (InputIterator first, InputIterator last, MaskIterator mask_first, T mean, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1)) |
Computes the variance of a range over a mask
. More... | |
template<typename T , typename InputIterator , typename MaskIterator > | |
T | slip::unbiased_variance_mask (InputIterator first, InputIterator last, MaskIterator mask_first, T mean, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1)) |
Computes the unbiased variance of a range over a mask
. More... | |
template<typename T , typename InputIterator , typename MaskIterator > | |
T | slip::std_dev_mask (InputIterator first, InputIterator last, MaskIterator mask_first, T mean, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1)) |
Computes the standard deviation of a range over a mask
. More... | |
template<typename T , typename InputIterator , typename MaskIterator > | |
T | slip::unbiased_std_dev_mask (InputIterator first, InputIterator last, MaskIterator mask_first, T mean, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1)) |
Computes the unbiased standard deviation of a range over a mask
. More... | |
template<typename T , typename InputIterator , typename MaskIterator > | |
T | slip::kurtosis_mask (InputIterator first, InputIterator last, MaskIterator mask_first, T mean, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1)) |
Computes the kurtosis of a range over a mask
A high kurtosis distribution has a sharper peak and longer, fatter tails, while a low kurtosis distribution has a more rounded peak and shorter thinner tails. Here are some common value of kurtosis for unimodal and symmetric densities: More... | |
template<typename T , typename InputIterator , typename MaskIterator > | |
T | slip::unbiased_kurtosis_mask (InputIterator first, InputIterator last, MaskIterator mask_first, T mean, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1)) |
Computes the unbiased kurtosis of a range over a mask
A high kurtosis distribution has a sharper peak and longer, fatter tails, while a low kurtosis distribution has a more rounded peak and shorter thinner tails. More... | |
template<typename T , typename InputIterator , typename MaskIterator > | |
T | slip::skewness_mask (InputIterator first, InputIterator last, MaskIterator mask_first, T mean, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1)) |
Computes the skewness of a range over a mask
skewness is a measure of the asymmetry of the probability distribution of a real-valued random variable. More... | |
template<typename T , typename InputIterator , typename MaskIterator > | |
T | slip::unbiased_skewness_mask (InputIterator first, InputIterator last, MaskIterator mask_first, T mean, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1)) |
Computes the unbiased skewness of a range over a mask
skewness is a measure of the asymmetry of the probability distribution of a real-valued random variable. More... | |
template<typename T , typename InputIterator , typename MaskIterator > | |
T | slip::rms_mask (InputIterator first, InputIterator last, MaskIterator mask_first, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1)) |
Computes the root mean square (rms) value of a range over a mask
. More... | |
template<typename Integer , typename MaskIterator > | |
Integer | slip::cardinal_mask (MaskIterator mask_first, MaskIterator mask_last, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1)) |
Computes the cardinal or the number of elements of a mask range. More... | |
template<typename InputIterator , typename MaskIterator > | |
std::iterator_traits < InputIterator >::value_type | slip::median_from_sorted_data_mask (InputIterator first, InputIterator last, MaskIterator mask_first, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1)) |
Computes the median value from a sorted range over a mask. More... | |
template<typename InputIterator , typename MaskIterator > | |
std::iterator_traits < InputIterator >::value_type | slip::median_mask (InputIterator first, InputIterator last, MaskIterator mask_first, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1)) |
Computes the median value from a non sorted range over a mask. More... | |
template<typename InputIterator , typename MaskIterator > | |
std::iterator_traits < InputIterator >::value_type | slip::first_quartile_mask (InputIterator first, InputIterator last, MaskIterator mask_first, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1)) |
Computes the first quartile value from a non sorted range over a mask. More... | |
template<typename InputIterator , typename MaskIterator > | |
std::iterator_traits < InputIterator >::value_type | slip::third_quartile_mask (InputIterator first, InputIterator last, MaskIterator mask_first, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1)) |
Computes the third quartile value from a non sorted range over a mask. More... | |
template<typename InputIterator , typename MaskIterator , typename OutputIterator > | |
void | slip::center_mask (InputIterator first, InputIterator last, MaskIterator mask_first, OutputIterator out_first, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1)) |
Substracts its mean to a range according a mask. More... | |
template<typename InputIterator , typename MaskIterator , typename OutputIterator > | |
void | slip::studentize_mask (InputIterator first, InputIterator last, MaskIterator mask_first, OutputIterator out_first, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1)) |
Substracts its mean to a range and divide it by its standard deviation according a mask. More... | |
template<typename Integer , typename InputIterator , typename Predicate > | |
Integer | slip::cardinal_if (InputIterator first, InputIterator last, Predicate pred) |
Computes the cardinal or the number of elements of a range using a predicate. More... | |
template<typename Value_T , typename InputIterator , typename Predicate > | |
Value_T | slip::mean_if (InputIterator first, InputIterator last, Predicate pred) |
Computes the mean value of a range using a predicate
. More... | |
template<typename T , int N, typename InputIterator , typename Predicate > | |
T | slip::nth_moment_if (InputIterator first, InputIterator last, T mean, Predicate pred) |
Computes the nth moment of a range using a predicate
. More... | |
template<typename T , typename InputIterator , typename InputIterator2 , typename Predicate > | |
T | slip::covariance_if (InputIterator first, InputIterator last, InputIterator2 first2, T mean1, T mean2, Predicate pred) |
Computes the covariance of a two sequences using a predicate on the first one
. More... | |
template<typename T , typename InputIterator , typename InputIterator2 , typename Predicate > | |
T | slip::unbiased_covariance_if (InputIterator first, InputIterator last, InputIterator2 first2, T mean1, T mean2, Predicate pred) |
Computes the unbiased covariance of a two sequences using a predicate on the first one
. More... | |
template<typename T , typename InputIterator , typename Predicate > | |
T | slip::variance_if (InputIterator first, InputIterator last, T mean, Predicate pred) |
Computes the variance of a range using a predicate
. More... | |
template<typename T , typename InputIterator , typename Predicate > | |
T | slip::unbiased_variance_if (InputIterator first, InputIterator last, T mean, Predicate pred) |
Computes the unbiased variance of a range using a predicate
. More... | |
template<typename T , typename InputIterator , typename Predicate > | |
T | slip::std_dev_if (InputIterator first, InputIterator last, T mean, Predicate pred) |
Computes the standard deviation of a range using a predicate
. More... | |
template<typename T , typename InputIterator , typename Predicate > | |
T | slip::unbiased_std_dev_if (InputIterator first, InputIterator last, T mean, Predicate pred) |
Computes the unbiased standard deviation of a range using a predicate
. More... | |
template<typename T , typename InputIterator , typename Predicate > | |
T | slip::kurtosis_if (InputIterator first, InputIterator last, T mean, Predicate pred) |
Computes the kurtosis of a range using a predicate
A high kurtosis distribution has a sharper peak and longer, fatter tails, while a low kurtosis distribution has a more rounded peak and shorter thinner tails. Here are some common value of kurtosis for unimodal and symmetric densities: More... | |
template<typename T , typename InputIterator , typename Predicate > | |
T | slip::unbiased_kurtosis_if (InputIterator first, InputIterator last, T mean, Predicate pred) |
Computes the unbiased kurtosis of a range using a predicate
A high kurtosis distribution has a sharper peak and longer, fatter tails, while a low kurtosis distribution has a more rounded peak and shorter thinner tails. More... | |
template<typename T , typename InputIterator , typename Predicate > | |
T | slip::skewness_if (InputIterator first, InputIterator last, T mean, Predicate pred) |
Computes the skewness of a range using a predicate
skewness is a measure of the asymmetry of the probability distribution of a real-valued random variable. More... | |
template<typename T , typename InputIterator , typename Predicate > | |
T | slip::unbiased_skewness_if (InputIterator first, InputIterator last, T mean, Predicate pred) |
Computes the unbiased skewness of a range using a predicate
skewness is a measure of the asymmetry of the probability distribution of a real-valued random variable. More... | |
template<typename T , typename InputIterator , typename Predicate > | |
T | slip::rms_if (InputIterator first, InputIterator last, Predicate pred) |
Computes the root mean square (rms) value of a range using a predicate
. More... | |
template<typename InputIterator , typename Predicate > | |
std::iterator_traits < InputIterator >::value_type | slip::median_from_sorted_data_if (InputIterator first, InputIterator last, Predicate pred) |
Computes the median value from a sorted range using a predicate. More... | |
template<typename InputIterator , typename Predicate > | |
std::iterator_traits < InputIterator >::value_type | slip::median_if (InputIterator first, InputIterator last, Predicate pred) |
Computes the median value from a non sorted range using a predicate. More... | |
template<typename InputIterator , typename Predicate > | |
std::iterator_traits < InputIterator >::value_type | slip::first_quartile_if (InputIterator first, InputIterator last, Predicate pred) |
Computes the first quartile value from a non sorted range using a predicate. More... | |
template<typename InputIterator , typename Predicate > | |
std::iterator_traits < InputIterator >::value_type | slip::third_quartile_if (InputIterator first, InputIterator last, Predicate pred) |
Computes the third quartile value from a non sorted range using a predicate. More... | |
template<typename InputIterator , typename Predicate , typename OutputIterator > | |
void | slip::center_if (InputIterator first, InputIterator last, Predicate pred, OutputIterator out_first) |
Substracts its mean to a range using a predicate. More... | |
template<typename InputIterator , typename Predicate , typename OutputIterator > | |
void | slip::studentize_if (InputIterator first, InputIterator last, Predicate pred, OutputIterator out_first) |
Substracts its mean to a range and divide it by its standard deviation using a predicate. More... | |
template<typename InputIterator , typename T > | |
void | slip::statistics (InputIterator first, InputIterator last, slip::Statistics< T > &statistic) |
compute all statistics of a range More... | |
template<typename InputIterator , typename T > | |
void | slip::unbiased_statistics (InputIterator first, InputIterator last, slip::Statistics< T > &statistic) |
compute all unbiased statistics of a range More... | |
template<typename InputIterator , typename T , typename MaskIterator > | |
void | slip::statistics_mask (InputIterator first, InputIterator last, MaskIterator mask_first, slip::Statistics< T > &statistic, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1)) |
compute all statistics of a range according to a mask range. More... | |
template<typename InputIterator , typename T , typename MaskIterator > | |
void | slip::unbiased_statistics_mask (InputIterator first, InputIterator last, MaskIterator mask_first, slip::Statistics< T > &statistic, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1)) |
compute all unbiased statistics of a range according to a mask range. More... | |
template<typename InputIterator , typename T , typename Predicate > | |
void | slip::statistics_if (InputIterator first, InputIterator last, slip::Statistics< T > &statistic, Predicate pred) |
compute all statistics of a range according to a preidcate. More... | |
template<typename InputIterator , typename T , typename Predicate > | |
void | slip::unbiased_statistics_if (InputIterator first, InputIterator last, slip::Statistics< T > &statistic, Predicate pred) |
compute all unbiased statistics of a range according to a preidcate. More... | |
recursive statistics algorithms | |
template<typename DataT , typename MeanT > | |
MeanT | slip::mean_next (const int n, const MeanT &prev_mean, const DataT &xnp1) |
Recursive mean algorithm. More... | |
template<typename DataT , typename VarT > | |
void | slip::var_next (const int n, const VarT &prev_mean, const VarT &prev_var, const DataT &xnp1, VarT &next_mean, VarT &next_var) |
Recursive variance algorithm. More... | |
Provides some statistics algorithms.
Definition in file statistics.hpp.