eDSP
0.0.1
A cross-platform DSP library written in C++.
|
Classes | |
struct | histogram |
Histogram density estimator. More... | |
Functions | |
template<typename ForwardIt > | |
constexpr meta::value_type_t< ForwardIt > | centroid (ForwardIt first, ForwardIt last) |
Computes the centroid value of the range [first, last) More... | |
template<typename ForwardIt > | |
constexpr meta::value_type_t< ForwardIt > | centroid (ForwardIt first1, ForwardIt last1, ForwardIt first2) |
Computes the centroid value of the range [first1, last1) More... | |
template<typename ForwardIt > | |
constexpr meta::value_type_t< ForwardIt > | crest (ForwardIt first, ForwardIt last) |
Computes the crest value of the range [first, last) More... | |
template<typename ForwardIt > | |
constexpr meta::value_type_t< ForwardIt > | entropy (ForwardIt first, ForwardIt last) |
Computes the normalized entropy of the probability mass function given in the range [first, last). More... | |
template<typename ForwardIt > | |
constexpr meta::value_type_t< ForwardIt > | flatness (ForwardIt first, ForwardIt last) |
Computes the flatness value of the range [first, last) More... | |
template<distances d, typename InputIt > | |
constexpr meta::value_type_t< InputIt > | flux (InputIt first1, InputIt last1, InputIt first2) |
Computes the flux between the elements in the range [first1, last1) and the elements starting at first2. More... | |
template<typename ForwardIt , typename Integer > | |
constexpr meta::value_type_t< ForwardIt > | generalized_mean (ForwardIt first, ForwardIt last, Integer beta) |
Computes the generalized mean of the range [first, last) More... | |
template<typename ForwardIt > | |
constexpr meta::value_type_t< ForwardIt > | geometric_mean (ForwardIt first, ForwardIt last) |
Computes the geometric mean of the range [first, last) More... | |
template<typename ForwardIt > | |
constexpr meta::value_type_t< ForwardIt > | harmonic_mean (ForwardIt first, ForwardIt last) |
Computes the harmonic mean of the range [first, last) More... | |
template<typename ForwardIt > | |
constexpr meta::value_type_t< ForwardIt > | kurtosis (ForwardIt first, ForwardIt last) |
Computes the Kurtosis of the range [first, last) More... | |
template<typename ForwardIt > | |
constexpr meta::value_type_t< ForwardIt > | max (ForwardIt first, ForwardIt last) |
Computes the maximum value of the range [first, last) More... | |
template<typename ForwardIt > | |
constexpr meta::value_type_t< ForwardIt > | maxabs (ForwardIt first, ForwardIt last) |
Computes the maximum absolute value of the range [first, last) More... | |
template<typename ForwardIt > | |
constexpr meta::value_type_t< ForwardIt > | mean (ForwardIt first, ForwardIt last) |
Computes the average or mean value of the range [first, last) More... | |
template<typename ForwardIt > | |
constexpr meta::value_type_t< ForwardIt > | median (ForwardIt first, ForwardIt last) |
Computes the median of the range [first, last) More... | |
template<typename ForwardIt > | |
constexpr meta::value_type_t< ForwardIt > | min (ForwardIt first, ForwardIt last) |
Computes the minimum value of the range [first, last) More... | |
template<typename ForwardIt > | |
constexpr meta::value_type_t< ForwardIt > | minabs (ForwardIt first, ForwardIt last) |
Computes the minimum absolute value of the range [first, last) More... | |
template<std::size_t N, typename ForwardIt > | |
constexpr meta::value_type_t< ForwardIt > | moment (ForwardIt first, ForwardIt last) |
Computes the n-th moment of the range [first, last) More... | |
template<std::size_t N, typename ForwardIt > | |
constexpr meta::value_type_t< ForwardIt > | moment (ForwardIt first, ForwardIt last, const meta::value_type_t< ForwardIt > mean) |
Computes the nth moment of the range [first, last) considering the precomputed average. More... | |
template<typename InputIt > | |
constexpr meta::value_type_t< InputIt > | norm (InputIt first, InputIt last) |
Compute the L2-norm of the signals in the range [first1, last1). More... | |
template<typename ForwardIt > | |
constexpr auto | peak (ForwardIt first, ForwardIt last) -> std::pair< typename meta::diff_type_t< ForwardIt >, typename meta::value_type_t< ForwardIt >> |
Computes the peak value of the range [first, last) More... | |
template<typename ForwardIt > | |
constexpr auto | peakabs (ForwardIt first, ForwardIt last) -> std::pair< typename meta::diff_type_t< ForwardIt >, typename meta::value_type_t< ForwardIt >> |
Computes the absolute peak value of the range [first, last) More... | |
template<typename ForwardIt > | |
constexpr meta::value_type_t< ForwardIt > | rms (ForwardIt first, ForwardIt last) |
Computes the root-mean-square (RMS) value of the range [first, last) More... | |
template<typename ForwardIt , typename Floating > | |
constexpr auto | rolloff (ForwardIt first, ForwardIt last, Floating percentage) |
Computes the roll-off index of the elements in the range [first, last) More... | |
template<typename ForwardIt > | |
constexpr meta::value_type_t< ForwardIt > | rssq (ForwardIt first, ForwardIt last) |
Computes the root-sum-of-squares (RSSS) value of the range [first, last) More... | |
template<typename ForwardIt > | |
constexpr meta::value_type_t< ForwardIt > | skewness (ForwardIt first, ForwardIt last) |
Computes the skewness of the range [first, last) More... | |
template<typename InputIt , typename Allocator = std::allocator<meta::value_type_t<InputIt>>> | |
constexpr meta::value_type_t< InputIt > | snr (InputIt first1, InputIt last1, InputIt first2) |
Compute the SNR of the signals in the range [first1, last1) and the signal starting in first2. More... | |
template<typename ForwardIt > | |
constexpr meta::value_type_t< ForwardIt > | variance (ForwardIt first, ForwardIt last) |
Computes the variance of the range [first, last) More... | |
template<typename ForwardIt > | |
meta::value_type_t< ForwardIt > | standard_deviation (ForwardIt first, ForwardIt last) |
Computes the standard deviation of the range [first, last) More... | |
constexpr meta::value_type_t<ForwardIt> edsp::statistics::centroid | ( | ForwardIt | first, |
ForwardIt | last | ||
) |
Computes the centroid value of the range [first, last)
It is calculated as the division of the weighted mean of the the signal and the average of the magnitudes.
\[ y = \frac{\sum_{n=0}^{N-1}nx(n)}{\sum_{n=0}^{N-1}x(n)} \]
first | Forward iterator defining the begin of the range to examine. |
last | Forward iterator defining the end of the range to examine. |
constexpr meta::value_type_t<ForwardIt> edsp::statistics::centroid | ( | ForwardIt | first1, |
ForwardIt | last1, | ||
ForwardIt | first2 | ||
) |
Computes the centroid value of the range [first1, last1)
It is calculated as the division of the weighted mean of the the signal and the average of the magnitudes.
\[ y = \frac{\sum_{n=0}^{N-1}f(n)x(n)}{\sum_{n=0}^{N-1}x(n)} \]
first1 | Forward iterator defining the begin of the range to examine. |
last1 | Forward iterator defining the end of the range to examine. |
first2 | Forward iterator defining the beginning of the range representing the weights, \(f(i)\). |
constexpr meta::value_type_t<ForwardIt> edsp::statistics::crest | ( | ForwardIt | first, |
ForwardIt | last | ||
) |
Computes the crest value of the range [first, last)
It is calculated as the division of mean of the the signal and the maximum value of the magnitudes.
\[ y = \frac{ \frac{1}{N} \sum_{n=0}^{N-1}x(n)}{max \left( x \right)} \]
first | Forward iterator defining the begin of the range to examine. |
last | Forward iterator defining the end of the range to examine. |
constexpr meta::value_type_t<ForwardIt> edsp::statistics::entropy | ( | ForwardIt | first, |
ForwardIt | last | ||
) |
Computes the normalized entropy of the probability mass function given in the range [first, last).
Given a normalized probability mass function \( p(n) \), the entropy can explicitly be written as:
\[ H = - \sum_{n=0}^{N-1} p(n) \log_2 \left( p(n) \right) \]
Normalizing:
\[ H_n = - \frac{H}{log2(N)} \]
first | Forward iterator defining the begin of the probability mass function. |
last | Forward iterator defining the end of the probability mass function. |
constexpr meta::value_type_t<ForwardIt> edsp::statistics::flatness | ( | ForwardIt | first, |
ForwardIt | last | ||
) |
Computes the flatness value of the range [first, last)
It is calculated as the division of geometric mean and the average of the magnitudes.
\[ y = \frac{\mu_g}{\mu} \]
first | Forward iterator defining the begin of the range to examine. |
last | Forward iterator defining the end of the range to examine. |
constexpr meta::value_type_t<InputIt> edsp::statistics::flux | ( | InputIt | first1, |
InputIt | last1, | ||
InputIt | first2 | ||
) |
Computes the flux between the elements in the range [first1, last1) and the elements starting at first2.
The flux is a measure of the difference between two signals, it is frequently used to estimates the differences in the power spectral between consecutive frames.
d | Type of distance to be compute between each point. |
first1 | Input iterator defining the beginning of the first input range. |
last1 | Input iterator defining the ending of the first input range. |
first2 | Input iterator defining the beginning of the second input range. |
constexpr meta::value_type_t<ForwardIt> edsp::statistics::generalized_mean | ( | ForwardIt | first, |
ForwardIt | last, | ||
Integer | beta | ||
) |
Computes the generalized mean of the range [first, last)
The generalized mean or power mean with exponent \( \beta \) is defined as:
\[ \mu_{\beta} = \left( \frac{1}{N}\sum_{n=0}^{N-1}x(n)^{\beta} \right) ^{\frac{1}{\beta}} \]
first | Forward iterator defining the begin of the range to examine. |
last | Forward iterator defining the end of the range to examine. |
beta | Exponent ( \( \beta \)). |
constexpr meta::value_type_t<ForwardIt> edsp::statistics::geometric_mean | ( | ForwardIt | first, |
ForwardIt | last | ||
) |
Computes the geometric mean of the range [first, last)
The geometric mean is defined as:
\[ {\displaystyle \left(\prod _{i=1}^{n}x_{i}\right)^{\frac {1}{n}}={\sqrt[{n}]{x_{1}x_{2}\cdots x_{n}}}} \]
first | Forward iterator defining the begin of the range to examine. |
last | Forward iterator defining the end of the range to examine. |
constexpr meta::value_type_t<ForwardIt> edsp::statistics::harmonic_mean | ( | ForwardIt | first, |
ForwardIt | last | ||
) |
Computes the harmonic mean of the range [first, last)
The harmonic mean is defined as:
\[ {\displaystyle H={\frac {n}{{\frac {1}{x_{1}}}+{\frac {1}{x_{2}}}+\cdots +{\frac {1}{x_{n}}}}} ={\frac {n}{\sum \limits _{i=1}^{n}{\frac {1}{x_{i}}}}}=\left({\frac {\sum \limits _{i=1}^{n}x_{i}^{-1}}{n}}\right)^{-1}.} \]
first | Forward iterator defining the begin of the range to examine. |
last | Forward iterator defining the end of the range to examine. |
constexpr meta::value_type_t<ForwardIt> edsp::statistics::kurtosis | ( | ForwardIt | first, |
ForwardIt | last | ||
) |
Computes the Kurtosis of the range [first, last)
The kurtosis is the fourth standardized moment, defined as:
\[ {\displaystyle K [X] =E \left[\left({\frac {X-\mu }{\sigma }}\right)^{4}\right]={\frac {\mu _{4}}{\sigma ^{4}}} ={\frac {E [(X-\mu )^{4}]}{(E[(X-\mu )^{2}])^{2}}},} \]
where \( \mu_4 \) is the fourth central moment and \( \sigma \) is the standard deviation.
first | Forward iterator defining the begin of the range to examine. |
last | Forward iterator defining the end of the range to examine. |
constexpr meta::value_type_t<ForwardIt> edsp::statistics::max | ( | ForwardIt | first, |
ForwardIt | last | ||
) |
Computes the maximum value of the range [first, last)
first | Forward iterator defining the begin of the range to examine. |
last | Forward iterator defining the end of the range to examine. |
constexpr meta::value_type_t<ForwardIt> edsp::statistics::maxabs | ( | ForwardIt | first, |
ForwardIt | last | ||
) |
Computes the maximum absolute value of the range [first, last)
first | Forward iterator defining the begin of the range to examine. |
last | Forward iterator defining the end of the range to examine. |
constexpr meta::value_type_t<ForwardIt> edsp::statistics::mean | ( | ForwardIt | first, |
ForwardIt | last | ||
) |
Computes the average or mean value of the range [first, last)
The average is defined as:
\[ \mu = \frac{1}{N}\sum_{n=0}^{N-1}x(n) \]
first | Forward iterator defining the begin of the range to examine. |
last | Forward iterator defining the end of the range to examine. |
constexpr meta::value_type_t<ForwardIt> edsp::statistics::median | ( | ForwardIt | first, |
ForwardIt | last | ||
) |
Computes the median of the range [first, last)
The median of a finite list of numbers can be found by arranging all the numbers from smallest to greatest. If there is an odd number of numbers, the middle one is picked. If there is an even number of observations, then there is no single middle value; the median is then usually defined to be the mean of the two middle values
first | Forward iterator defining the begin of the range to examine. |
last | Forward iterator defining the end of the range to examine. |
constexpr meta::value_type_t<ForwardIt> edsp::statistics::min | ( | ForwardIt | first, |
ForwardIt | last | ||
) |
Computes the minimum value of the range [first, last)
first | Forward iterator defining the begin of the range to examine. |
last | Forward iterator defining the end of the range to examine. |
constexpr meta::value_type_t<ForwardIt> edsp::statistics::minabs | ( | ForwardIt | first, |
ForwardIt | last | ||
) |
Computes the minimum absolute value of the range [first, last)
first | Forward iterator defining the begin of the range to examine. |
last | Forward iterator defining the end of the range to examine. |
constexpr meta::value_type_t<ForwardIt> edsp::statistics::moment | ( | ForwardIt | first, |
ForwardIt | last | ||
) |
Computes the n-th moment of the range [first, last)
first | Forward iterator defining the begin of the range to examine. |
last | Forward iterator defining the end of the range to examine. |
N | Order of the moment. |
constexpr meta::value_type_t<ForwardIt> edsp::statistics::moment | ( | ForwardIt | first, |
ForwardIt | last, | ||
const meta::value_type_t< ForwardIt > | mean | ||
) |
Computes the nth moment of the range [first, last) considering the precomputed average.
first | Forward iterator defining the begin of the range to examine. |
last | Forward iterator defining the end of the range to examine. |
mean | Average of the range [first, last) |
N | Order of the moment. |
constexpr meta::value_type_t<InputIt> edsp::statistics::norm | ( | InputIt | first, |
InputIt | last | ||
) |
Compute the L2-norm of the signals in the range [first1, last1).
The \( l^2 \)-norm is defined as:
\[ |x|=\sqrt(\sum_{n=0}^{N - 1}|x(n)|^2), \]
where \( |x_k| \) denotes the complex modules.
first | Input iterator defining the beginning of the first input range. |
last | Input iterator defining the ending of the first input range. |
constexpr auto edsp::statistics::peak | ( | ForwardIt | first, |
ForwardIt | last | ||
) | -> std::pair<typename meta::diff_type_t<ForwardIt>, typename meta::value_type_t<ForwardIt>> |
Computes the peak value of the range [first, last)
first | Forward iterator defining the begin of the range to examine. |
last | Forward iterator defining the end of the range to examine. |
constexpr auto edsp::statistics::peakabs | ( | ForwardIt | first, |
ForwardIt | last | ||
) | -> std::pair<typename meta::diff_type_t<ForwardIt>, typename meta::value_type_t<ForwardIt>> |
Computes the absolute peak value of the range [first, last)
first | Forward iterator defining the begin of the range to examine. |
last | Forward iterator defining the end of the range to examine. |
constexpr meta::value_type_t<ForwardIt> edsp::statistics::rms | ( | ForwardIt | first, |
ForwardIt | last | ||
) |
Computes the root-mean-square (RMS) value of the range [first, last)
The RMS value is defined as:
\[ x_{\mathrm {rms} }={\sqrt {{\frac {1}{n}}\left(x_{1}^{2}+x_{2}^{2}+\cdots +x_{n}^{2}\right)}} \]
first | Forward iterator defining the begin of the range to examine. |
last | Forward iterator defining the end of the range to examine. |
constexpr auto edsp::statistics::rolloff | ( | ForwardIt | first, |
ForwardIt | last, | ||
Floating | percentage | ||
) |
Computes the roll-off index of the elements in the range [first, last)
The roll-off index is defined as the index under which some percentage (cutoff) of the total energy of the signal is contained.
first | Forward iterator defining the begin of the range to examine. |
last | Forward iterator defining the end of the range to examine. |
percentage | Number between [0, 1] representing the percentage of the total energy of the roll-off index.. |
constexpr meta::value_type_t<ForwardIt> edsp::statistics::rssq | ( | ForwardIt | first, |
ForwardIt | last | ||
) |
Computes the root-sum-of-squares (RSSS) value of the range [first, last)
\[ x_{\mathrm {rms} }={\sqrt {\left(x_{1}^{2}+x_{2}^{2}+\cdots +x_{n}^{2}\right)}} \]
first | Forward iterator defining the begin of the range to examine. |
last | Forward iterator defining the end of the range to examine. |
constexpr meta::value_type_t<ForwardIt> edsp::statistics::skewness | ( | ForwardIt | first, |
ForwardIt | last | ||
) |
Computes the skewness of the range [first, last)
The skewness is the third standardized moment, defined as:
\[ {\displaystyle K [X] =E \left[\left({\frac {X-\mu }{\sigma }}\right)^{3}\right]={\frac {\mu _{3}}{\sigma ^{3}}} ={\frac {E [(X-\mu )^{3}]}{(E[(X-\mu )^{2}])^{2}}},} \]
where \( \mu_3 \) is the fourth central moment and \( \sigma \) is the standard deviation.
first | Forward iterator defining the begin of the range to examine. |
last | Forward iterator defining the end of the range to examine. |
constexpr meta::value_type_t<InputIt> edsp::statistics::snr | ( | InputIt | first1, |
InputIt | last1, | ||
InputIt | first2 | ||
) |
Compute the SNR of the signals in the range [first1, last1) and the signal starting in first2.
Signal-to-noise ratio (abbreviated SNR or S/N) is a measure used in science and engineering that compares the level of a desired signal to the level of background noise. SNR is defined as the ratio of signal power to the noise power, often expressed in decibels. A ratio higher than 1:1 (greater than 0 dB) indicates more signal than noise.
If the variance of the signal and noise are known, and the signal and noise are both zero-mean, SNR can be:
\[ \mathrm{SNR} = \frac{\sigma^2_\mathrm{signal}}{\sigma^2_\mathrm{noise}}. \]
first1 | Input iterator defining the beginning of the first input range. |
last1 | Input iterator defining the ending of the first input range. |
first2 | Input iterator defining the beginning of the second input range. |
|
inline |
Computes the standard deviation of the range [first, last)
The standard deviation is defined as the square root of the variance:
\[ \sigma = \sqrt(v) \]
first | Forward iterator defining the begin of the range to examine. |
last | Forward iterator defining the end of the range to examine. |
constexpr meta::value_type_t<ForwardIt> edsp::statistics::variance | ( | ForwardIt | first, |
ForwardIt | last | ||
) |
Computes the variance of the range [first, last)
The variance is defined as:
\[ v =\sum _{i=1}^{n}p_{i}\cdot (x_{i}-\mu )^{2} \]
first | Forward iterator defining the begin of the range to examine. |
last | Forward iterator defining the end of the range to examine. |