SHORE API
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
mathops.hpp File Reference

Miscellaneous math functions. More...

Go to the source code of this file.

Classes

class  shore::incremental_mean_var
 Online calculation of mean, variance and standard deviation. More...
 
struct  shore::index_generator< T >
 A generator that increments its value after each call. More...
 
struct  shore::index_comparator< DataIter, Comparator >
 Compare indexes referring to another data structure. More...
 
struct  shore::index_comparator< DataIter, void >
 Compare indexes referring to another data structure. More...
 
struct  shore::relabs< Abs_t >
 Class that represents a value that may be either absolute or relative to another value. More...
 

Namespaces

 shore
 SHORE core API.
 

Constant Groups

 shore
 SHORE core API.
 

Functions

template<class U , class T >
shore::round (T floatval)
 brief Round a floating point value.
 
double shore::log2 (const double val)
 Base two logarithm.
 
template<class Iter >
double shore::mean (const Iter begin, const Iter end)
 Calculate the arithmetic mean of the values in a range.
 
template<class Iter >
double shore::pairs_mean (Iter begin, const Iter end)
 Calculate the arithmetic mean of the values in a range of (value,count) pairs.
 
template<class Iter >
double shore::medianize (const Iter begin, const Iter end)
 Reorder the values in a range such that the median is in the center. More...
 
template<class Iter >
double shore::geometric_mean (const Iter begin, const Iter end, const bool skipZ=false)
 Calculate the geometric mean of the values in a range.
 
template<class Iter >
double shore::harmonic_mean (const Iter begin, const Iter end)
 Calculate the harmonic mean of the values in a range.
 
template<class Iter , class Oter >
void shore::skewness_kurtosis (Iter begin, Iter end, Oter dest, const bool var_n)
 Calculate skewness and kurtosis for the values in a range. More...
 
template<class Iter >
double shore::var (const Iter begin, const Iter end, const double mu, const bool var_n=false)
 Calculate the variance of the values in a range, utilizing the previously calculated mean.
 
template<class Iter >
double shore::pairs_var (const Iter begin, const Iter end, const double mu, const bool var_n=false)
 Calculate the variance of the values in a range of value->count pairs, utilizing the previously calculated mean.
 
template<class Iter >
double shore::var (const Iter begin, const Iter end, const bool var_n=false)
 Calculate the variance of the values in a range.
 
template<class Iter >
double shore::stddev (const Iter begin, const Iter end, const bool var_n=false)
 Calculate the standard deviation of the values in a range.
 
template<class Iter >
double shore::stddev (const Iter begin, const Iter end, const double mu, const bool var_n=false)
 Calculate the standard deviation of the values in a range, utilizing the previously calculated mean.
 
template<class Iter >
double shore::pairs_stddev (const Iter begin, const Iter end, const double mu, const bool var_n=false)
 Calculate the standard deviation of a range of value->count pairs, utilizing the previously calculated mean.
 
template<class Xter , class Yter >
std::pair< double, double > shore::polycog (Xter x_beg, Xter x_end, Yter y_beg, double *const ret_area2)
 Calculate the centre of gravity of a polygon.
 
template<class Xter , class Yter >
std::pair< double, double > shore::polycog (Xter x_beg, Xter x_end, Yter y_beg)
 Calculate the centre of gravity of a polygon.
 
template<class Iter >
void shore::mean_filter (Iter beg, Iter end, const size_t width)
 Applies mean filtering to the given sequence. More...
 
template<class T , class Iter >
void shore::seq (T lb, const T ub, const size_t len, Iter dest)
 Generate sequence of equidistant values, between (inclusive) lb & ub.
 
template<class IIter , class OIter , class Rng >
void shore::random_copy (IIter b, IIter e, OIter o, Rng &rng)
 Shuffle the values in a range.
 
template<typename IndexIter >
void shore::index_fill (IndexIter ib, IndexIter ie)
 Fill a range with consecutive values.
 
template<typename DataIter , typename IndexIter >
void shore::index_sort (IndexIter ib, IndexIter ie, DataIter db)
 Sort indexes with reference to another data structure.
 
template<typename DataIter , typename IndexIter , typename Comparator >
void shore::index_sort (IndexIter ib, IndexIter ie, DataIter db, Comparator data_cmp)
 Sort indexes with reference to another data structure.
 
template<typename DataIter , typename OrderingIter , typename RankIter >
void shore::ranks (RankIter first, RankIter last, OrderingIter ob, DataIter db)
 Compute 0-based ranks given an ordering. Equal stretches share the same, highest rank value.
 
template<class Abs_t >
std::istream & shore::operator>> (std::istream &is, relabs< Abs_t > &dest)
 Parse a relabs object from a stream. A '' suffix indicates a relative value.
 
template<class Abs_t >
std::ostream & shore::operator<< (std::ostream &os, const relabs< Abs_t > &val)
 Write a relabs object to a stream. A '' suffix is used to indicate a relative value.
 

Detailed Description

Miscellaneous math functions.

Author
Felix Ott