Math/Statistics functions.
More...
#include <algorithm>
#include <map>
#include <vector>
Go to the source code of this file.
|
template<class InputIt, class T = typename std::iterator_traits<InputIt>::value_type> |
T | satdump::most_common (InputIt begin, InputIt end, T def) |
| Return the most common element within the provided sequence.
|
template<class InputIt, class T = typename std::iterator_traits<InputIt>::value_type> |
T | satdump::average_common (InputIt begin, InputIt end) |
| Returns the average of the provided elements.
|
template<typename T> |
T | satdump::percentile (T *array, int size, float percentile) |
| Returns a percentile of the provided array.
|
template<typename T> |
double | satdump::avg_overflowless (std::vector< T > const &v) |
| Returns the average of the provided elements. Version that won't overflow with very large numbers and amount of elements.
|
double | satdump::get_median (std::vector< double > values) |
| Returns the median of the provided elements.
|
Math/Statistics functions.
◆ average_common()
template<class InputIt, class T = typename std::iterator_traits<InputIt>::value_type>
T satdump::average_common |
( |
InputIt | begin, |
|
|
InputIt | end ) |
Returns the average of the provided elements.
- Parameters
-
begin | First iterator |
end | last iterator |
- Returns
- average of elements
◆ avg_overflowless()
template<typename T>
double satdump::avg_overflowless |
( |
std::vector< T > const & | v | ) |
|
Returns the average of the provided elements. Version that won't overflow with very large numbers and amount of elements.
- Parameters
-
- Returns
- average of elements
◆ get_median()
double satdump::get_median |
( |
std::vector< double > | values | ) |
|
Returns the median of the provided elements.
- Parameters
-
- Returns
- median of the elements
◆ most_common()
template<class InputIt, class T = typename std::iterator_traits<InputIt>::value_type>
T satdump::most_common |
( |
InputIt | begin, |
|
|
InputIt | end, |
|
|
T | def ) |
Return the most common element within the provided sequence.
- Parameters
-
begin | First iterator |
end | last iterator |
def | default if we don't have enough elements |
- Returns
- most common element OR default
◆ percentile()
template<typename T>
T satdump::percentile |
( |
T * | array, |
|
|
int | size, |
|
|
float | percentile ) |
Returns a percentile of the provided array.
- Parameters
-
array | to work with |
size | of the array, in elements |
percentile | to return |
- Returns
- the percentile