Ocean
Ocean::Median Class Reference

This class implements a median determination value. More...

Static Public Member Functions

template<typename T >
static T median2 (const T &v0, const T &v1)
 Returns the median of two given values (the lower of both). More...
 
template<typename T >
static T median3 (const T &v0, const T &v1, const T &v2)
 Returns the median of three given values. More...
 
template<typename T >
static T median4 (const T &v0, const T &v1, const T &v2, const T &v3)
 Returns the median of four given values (the second smallest value). More...
 
template<typename T >
static T median5 (const T &v0, const T &v1, const T &v2, const T &v3, const T &v4)
 Returns the median of five given values. More...
 
template<typename T >
static T median (T *values, const size_t number)
 Returns the median value in a given data array. More...
 
template<typename T >
static T constMedian (const T *values, const size_t number)
 Returns the median value in a given data array. More...
 

Detailed Description

This class implements a median determination value.

Member Function Documentation

◆ constMedian()

template<typename T >
T Ocean::Median::constMedian ( const T *  values,
const size_t  number 
)
static

Returns the median value in a given data array.

If the given number is even, the median value is selected left from the exact center.
Beware: In the case one of the given values is not a number (nan) the result may be arbitrary as the comparison operator is not defined for such values.

Parameters
valuesArray with values from which the median will be determined, must be valid
numberNumber of values, with range [1, infinity)
Returns
The median value out of 'values'
Template Parameters
TType of the data for that the median has to be determined

◆ median()

template<typename T >
T Ocean::Median::median ( T *  values,
const size_t  number 
)
static

Returns the median value in a given data array.

If the given number is even, the median value is selected left from the exact center.
Beware: In the case one of the given values is not a number (nan) the result may be arbitrary as the comparison operator is not defined for such values.

Parameters
valuesArray with values that will be reordered during the execution, must be valid
numberNumber of values, with range [1, infinity)
Returns
The median value out of 'values'
Template Parameters
TType of the data for that the median has to be determined

◆ median2()

template<typename T >
T Ocean::Median::median2 ( const T &  v0,
const T &  v1 
)
inlinestatic

Returns the median of two given values (the lower of both).

Beware: In the case one of the given values is not a number (nan) the result may be arbitrary as the comparison operator is not defined for such values.

Parameters
v0First value
v1Second value
Returns
Resulting median
Template Parameters
TData type of the data elements

◆ median3()

template<typename T >
T Ocean::Median::median3 ( const T &  v0,
const T &  v1,
const T &  v2 
)
inlinestatic

Returns the median of three given values.

Beware: In the case one of the given values is not a number (nan) the result may be arbitrary as the comparison operator is not defined for such values.

Parameters
v0First value
v1Second value
v2Third value
Returns
Resulting median
Template Parameters
TData type of the data elements

◆ median4()

template<typename T >
T Ocean::Median::median4 ( const T &  v0,
const T &  v1,
const T &  v2,
const T &  v3 
)
inlinestatic

Returns the median of four given values (the second smallest value).

Beware: In the case one of the given values is not a number (nan) the result may be arbitrary as the comparison operator is not defined for such values.

Parameters
v0First value
v1Second value
v2Third value
v3Fourth value
Returns
Resulting median
Template Parameters
TData type of the data elements

◆ median5()

template<typename T >
T Ocean::Median::median5 ( const T &  v0,
const T &  v1,
const T &  v2,
const T &  v3,
const T &  v4 
)
inlinestatic

Returns the median of five given values.

Beware: In the case one of the given values is not a number (nan) the result may be arbitrary as the comparison operator is not defined for such values.

Parameters
v0First value
v1Second value
v2Third value
v3Fourth value
v4Fifth value
Returns
Resulting median
Template Parameters
TData type of the data elements

The documentation for this class was generated from the following file: