Functions

/home/pascal/depot/filedata/src/statistic.h File Reference

#include <numeric>
#include <algorithm>
Include dependency graph for statistic.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<class T , class Iter_T >
mean (Iter_T first, Iter_T last)
 compute the mean value of a vector
double bilinear_interpolation (const double &x, const double &y, const double &x1, const double &y1, const double &x2, const double &y2, const double &f11, const double &f12, const double &f21, const double &f22)
double linear_interpolation (const double x, const double x1, const double x2, const double f1, const double f2)
template<class T1 , class Iter_T1 , class T2 , class Iter_T2 >
void interpolate (Iter_T1 v1_start, Iter_T1 v1_end, Iter_T2 v2_start, Iter_T2 v2_end, T1 &val1, T2 &val2)
 linear interpolation the val1 value This method supports either classic C arrays and STL's vector
template<class Iter_T1 , class Iter_T2 >
void interpolate (Iter_T1 v1_start, Iter_T1 v1_end, Iter_T2 v2_start, Iter_T2 v2_end, Iter_T1 vin_start, Iter_T1 vin_end, Iter_T2 vout_start)
 linear interpolation of the values of a vector. This method supports either classic C arrays and STL's vector
template<typename NumType >
long get_nearest_val_idx (const NumType *v_start, const NumType *v_end, const NumType &val)
 search the value that is the nearest to val in a sorted vector If val is situed exactly between 2 values, the upper index is returned

Detailed Description

contain some statistics computing methods


Function Documentation

double bilinear_interpolation ( const double &  x,
const double &  y,
const double &  x1,
const double &  y1,
const double &  x2,
const double &  y2,
const double &  f11,
const double &  f12,
const double &  f21,
const double &  f22 
) [inline]

Make a generic bilinear interpolation

Parameters:
x 
y 
x1 
x2 
y1 
y2 
f11 f(x1,y1)
f12 f(x1,y2)
f21 f(x2,y1)
f22 f(x2,y2)
Returns:
f(x,y)
template<typename NumType >
long get_nearest_val_idx ( const NumType *  v_start,
const NumType *  v_end,
const NumType &  val 
)

search the value that is the nearest to val in a sorted vector If val is situed exactly between 2 values, the upper index is returned

Warning:
The method does not support vectors that contain equal value. In other mathematical words, the vector has to be in strict monotonic order This method supports either classic C arrays (v_start and v_end will be pointers) and STL's vector (use iterators in the case)
Parameters:
v_start vector start position (pointer or iterator)
v_end vector end position (pointer that points just after the last value to check or iterator)
val the value we are searching the nearest position
Returns:
the index of the nearest value in the vector. In range [0,vector_size-1]. Return -1 in case of problem : empty vector, v_start or v_end NULL
template<class Iter_T1 , class Iter_T2 >
void interpolate ( Iter_T1  v1_start,
Iter_T1  v1_end,
Iter_T2  v2_start,
Iter_T2  v2_end,
Iter_T1  vin_start,
Iter_T1  vin_end,
Iter_T2  vout_start 
) [inline]

linear interpolation of the values of a vector. This method supports either classic C arrays and STL's vector

Parameters:
v1_start start of input abscissa values. Must be sorted either in ascending or descending order
v1_end end of input abscissa values
v2_start start of output abscissa values
v2_end end of output abscissa values
vin_start start of the input data to interpolate
vin_end end of the input data to interpolate
vout_start start of the interpolated output data

References interpolate().

template<class T1 , class Iter_T1 , class T2 , class Iter_T2 >
void interpolate ( Iter_T1  v1_start,
Iter_T1  v1_end,
Iter_T2  v2_start,
Iter_T2  v2_end,
T1 &  val1,
T2 &  val2 
) [inline]

linear interpolation the val1 value This method supports either classic C arrays and STL's vector

Parameters:
v1 the input abscissa values. Must be sorted either in ascending or descending order. Doesn't support STL vectors
v2 the output abscissa values
val1 the input value (in v1 coordinates)
val2 the value interpolated in v2 corresponding to val1

References linear_interpolation().

Referenced by interpolate().

double linear_interpolation ( const double  x,
const double  x1,
const double  x2,
const double  f1,
const double  f2 
) [inline]

Make a generic linear interpolation

Parameters:
x 
x1 
x2 
f1 f(x1)
f2 f(x2)
Returns:
f(x)

Referenced by MODISFileData::get_5_to_1km_index(), and interpolate().

template<class T , class Iter_T >
T mean ( Iter_T  first,
Iter_T  last 
) [inline]

compute the mean value of a vector

Parameters:
first the first element of the vector to consider
last the last one
Returns:
the computed mean