SynAPSE  0.6.0
Synergistic Analysis of Phase Space Evolution
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
Functions
Math Namespace Reference

Mathematics environment (includes Statistics and Geometry packages) More...

Functions

std::vector< double > PlaneParameters (const std::vector< Vector< double >> &points)
 Computes the equation parameters of a plane given three points. More...
 
std::vector< double > PlaneParameters (const Vector< double > &v0, const Vector< double > &v1, const Vector< double > &v2)
 Computes the equation parameters of a plane given three points. More...
 
double PlaneDistance (const std::vector< double > &pars, const std::vector< double > &point)
 Computes the distance between a plane of given equation parameters and a point. More...
 
bool LeftHanded (const Vector< double > &a, const Vector< double > &b)
 Returns true if the a lies to the left of b in the 2d plane. More...
 
bool RightHanded (const Vector< double > &a, const Vector< double > &b)
 Returns true if the a lies to the right of b in the 2d plane. More...
 
void SortCW (std::vector< Vector< double >> &points)
 Sorts the input points clockwise in the the 2D plane. More...
 
void SortACW (std::vector< Vector< double >> &points)
 Sorts the input points anticlockwise in the the 2D plane. More...
 
double BoundingBox (const std::vector< std::vector< double >> &points, Vector< double > &lower, Vector< double > &upper, double buff=0.)
 Builds a bounding box around a set of points with a certain buff. More...
 
std::vector< std::vector
< double > > 
SimplexVertices (const size_t n)
 Returns the n+1 vertices of an n-simplex. More...
 
bool IsInsideSimplex (const std::vector< double > &point, const std::vector< std::vector< double >> &simplex)
 Returns true if a point is inside a provided simplex. More...
 
double LpNormp (const std::vector< double > &v, const double &p)
 Returns the lp-norm of a vector to the power of p. More...
 
double LpNorm (const std::vector< double > &v, const double &p)
 Returns the lp-norm of a vector. More...
 
double UnitBallVolume (const size_t &d, const double p=2.)
 Returns the volume of the unit d-ball. More...
 
double HullVolumeUniformFactor (const double &d, const double &p)
 Returns the hull volume bias factor for N points uniformly distributed inside a ball. More...
 
double HullVolumeUniformRelativeBias (const double &d, const double &p, const size_t N)
 Returns the relative bias (i.e. E(^V-V)/V) on the volume of the convexe hull of N points uniformly distributed inside a p-unit ball in d dimensions. More...
 
double HullVolumeTGausRelativeBias (const double &d, const double &alpha, const size_t N)
 Returns the relative bias (i.e. E(^V-V)/V) on the volume of the convexe hull of of a fraction alpha of N points selected from a multivariate Gaussian in dimension d. More...
 
double HullVolumeUniformRelativeRMS (const double &d, const double &p, const size_t N)
 Returns the relative RMS (i.e. RMS(^V)/^V) on the volume of the convexe hull of N points uniformly distributed inside a p-unit ball in d dimensions. More...
 
double HullVolumeTGausRelativeRMS (const double &d, const double &alpha, const size_t N)
 Returns the relative RMS (i.e. RMS(^V)/^V) on the volume of the convexe hull of of a fraction alpha of N points selected from a multivariate Gaussian in dimension d. More...
 
double Mean (const std::vector< double > &vx)
 Computes the mean of a variable sample. More...
 
double MeanError (const std::vector< double > &vx, const std::vector< double > &vex=std::vector< double >())
 Computes the error on the mean of a variable sample. More...
 
double MeanMError (const std::vector< double > &vex)
 Computes the measurement error on the mean of a variable sample. More...
 
double MeanSError (const std::vector< double > &vx)
 Computes the statistical error on the mean of a variable sample. More...
 
double RobustMean (const std::vector< double > &vx)
 Computes the MCD robust mean of a variable sample. More...
 
double TMean (const std::vector< double > &vx, const double &frac)
 Computes the trimmed mean of a variable sample. More...
 
double TMeanSError (const std::vector< double > &vx, const double &frac)
 Computes the statistical error on the trimmed mean of a variable sample. More...
 
double WMean (const std::vector< double > &vx, const double &frac)
 Computes the winsorized mean of a variable sample. More...
 
void DecrementMean (const size_t &n, double &mean, const double &x)
 Removes an element from a precomputed mean. More...
 
void IncrementMean (const size_t &n, double &mean, const double &x)
 Adds an element to a precomputed mean. More...
 
double Variance (const std::vector< double > &vx)
 Computes the variance of a variable sample. More...
 
double VarianceError (const std::vector< double > &vx, const std::vector< double > &vex=std::vector< double >())
 Computes the error on the variance of a variable sample. More...
 
double VarianceMError (const std::vector< double > &vx, const std::vector< double > &vex=std::vector< double >())
 Computes the measurement error on the variance of a variable sample. More...
 
double VarianceSError (const std::vector< double > &vx)
 Computes the statistical error on the variance of a variable sample. More...
 
double RMS (const std::vector< double > &vx)
 Computes the standard deviation of a variable sample. More...
 
double RMSError (const std::vector< double > &vx, const std::vector< double > &vex=std::vector< double >())
 Computes the error on the standard deviation of a variable sample. More...
 
double RMSMError (const std::vector< double > &vx, const std::vector< double > &vex)
 Computes the measurement error on the standard deviation of a variable sample. More...
 
double RMSSError (const std::vector< double > &vx)
 Computes the statistical error on the standard deviation of a variable sample. More...
 
double WRMS (const std::vector< double > &vx, const double &frac)
 Computes the winsorized standard deviation of a variable sample. More...
 
double Covariance (const std::vector< double > &vx, const std::vector< double > &vy)
 Computes the covariance of two variable samples. More...
 
double CovarianceError (const std::vector< double > &vx, const std::vector< double > &vy, const std::vector< double > &vex=std::vector< double >(), const std::vector< double > &vey=std::vector< double >())
 Computes the error on the covariance of two variable samples. More...
 
double CovarianceMError (const std::vector< double > &vx, const std::vector< double > &vy, const std::vector< double > &vex, const std::vector< double > &vey)
 Computes the measurement error on the covariance of two variable samples. More...
 
double CovarianceSError (const std::vector< double > &vx, const std::vector< double > &vy)
 Computes the statistical error on the covariance of two variable samples. More...
 
void DecrementCovariance (const size_t &n, double &cov, const double &xmean, const double &ymean, const double &x, const double &y)
 Removes an pair of elements from a precomputed covariance. More...
 
void IncrementCovariance (const size_t &n, double &cov, const double &xmean, const double &ymean, const double &x, const double &y)
 Adds an pair of elements from a precomputed covariance. More...
 
Matrix< double > CovarianceMatrix (const Matrix< double > &mat)
 Returns the covariance matrix of a multivariate sample. More...
 
Matrix< double > RobustCovarianceMatrix (const Matrix< double > &mat, const double hh=0)
 Returns the MCD robust covariance matrix of a multivariate sample. More...
 
void DecrementCovarianceMatrix (const size_t &n, Matrix< double > &covmat, const std::vector< double > &means, const std::vector< double > &v)
 Removes an element array from a precomputed covariance matrix. More...
 
void IncrementCovarianceMatrix (const size_t &n, Matrix< double > &covmat, const std::vector< double > &means, const std::vector< double > &v)
 Adds an element array to a precomputed covariance matrix. More...
 
double DeterminantError (const Matrix< double > &mat, const Matrix< double > &mat_error=Matrix< double >())
 Returns the exact error on the determinant of the covariance matrix. More...
 
double DeterminantMError (const Matrix< double > &mat, const Matrix< double > &mat_error)
 Returns the measurement error on the determinant of the covariance matrix. More...
 
double DeterminantSError (const Matrix< double > &mat)
 Returns the statistical error on the determinant of the covariance matrix. More...
 
double Median (const std::vector< double > &vx)
 Computes the median of a variable sample. More...
 
double MedianSError (const size_t n, const double &density)
 Computes the statistical error on the median of a variable sample. More...
 
double LWidth (const std::vector< double > &vx, const double &p)
 Computes the Lebesgues width for a given metric (RMS = L2) More...
 
double Quantile (const std::vector< double > &vx, const double &alpha)
 Computes the quantile of a variable sample at probability alpha. More...
 
double QuantileSError (const size_t n, const double &alpha, const double &density)
 Computes the statistical error on the quantile of a variable sample at probability alpha. More...
 
double Mode (const std::vector< double > &vx)
 Computes the most probable value of the variable sample. More...
 
double Min (const std::vector< double > &vx)
 Returns the minimum value in the array. More...
 
double Max (const std::vector< double > &vx)
 Returns the maximum value in the array. More...
 
double Mahalanobis (const Matrix< double > &invcov, const Matrix< double > &vec)
 Returns the Mahalanobis distance of a point to a distribution. More...
 
double MahalanobisSquared (const Matrix< double > &invcov, const Matrix< double > &vec)
 Returns the squared Mahalanobis distance of a point to a distribution. More...
 
double GeneralisedDistance (const double &rhoR, const double &rho0)
 Returns the generalised distance of a point to a distribution. More...
 
double GeneralisedDistanceSquared (const double &rhoR, const double &rho0)
 Returns the squared generalised distance of a point to a distribution. More...
 
size_t Factorial (const size_t n)
 Returns the factorial of the provided integer. More...
 
template<typename T >
void Trim (std::vector< T > &vx, const double &frac)
 Trim the n% lowest and n% largest values. More...
 
template<typename T >
std::vector< T > Trimmed (std::vector< T > vx, const double &frac)
 Trim the n% lowest and n% largest values. More...
 
template<typename T >
void Winsorize (std::vector< T > &vx, const double &frac)
 Winsorize to keep only a fraction frac of the original sample. More...
 
template<typename T >
std::vector< T > Winsorized (std::vector< T > vx, const double &frac)
 Winsorize to keep only a fraction frac of the original sample. More...
 
template<typename I >
I RandomElement (I begin, I end)
 Randomly select a single element from an array. More...
 
template<typename T >
std::vector< T > Resample (const std::vector< T > &vx, size_t m=0, const bool rep=true)
 Randomly resample n data points into m data points with or without replacement. More...
 

Detailed Description

Mathematics environment (includes Statistics and Geometry packages)

Function Documentation

double Math::BoundingBox ( const std::vector< std::vector< double >> &  points,
Vector< double > &  lower,
Vector< double > &  upper,
double  buff = 0. 
)

Builds a bounding box around a set of points with a certain buff.

Parameters
pointsArray of points to bound
lowerArray of lower bounds to set
upperArray of upper bounds to set
buffFraction of the range in the buffer space
Returns
Volume of the bounding box
double Math::Covariance ( const std::vector< double > &  vx,
const std::vector< double > &  vy 
)

Computes the covariance of two variable samples.

Parameters
vxArray of x
vyArray of y
Returns
Covariance
double Math::CovarianceError ( const std::vector< double > &  vx,
const std::vector< double > &  vy,
const std::vector< double > &  vex = std::vector< double >(),
const std::vector< double > &  vey = std::vector< double >() 
)

Computes the error on the covariance of two variable samples.

Parameters
vxArray of x
vyArray of y
vexArray of x errors
veyArray of y errors
Returns
Uncertainty on the covariance
Matrix< double > Math::CovarianceMatrix ( const Matrix< double > &  mat)

Returns the covariance matrix of a multivariate sample.

Parameters
matMatrix that contains the relevant sample
Returns
Covariance matrix
double Math::CovarianceMError ( const std::vector< double > &  vx,
const std::vector< double > &  vy,
const std::vector< double > &  vex,
const std::vector< double > &  vey 
)

Computes the measurement error on the covariance of two variable samples.

Parameters
vxArray of x
vyArray of y
vexArray of x errors
veyArray of y errors
Returns
Measurement uncertainty on the covariance
double Math::CovarianceSError ( const std::vector< double > &  vx,
const std::vector< double > &  vy 
)

Computes the statistical error on the covariance of two variable samples.

Parameters
vxArray of x
vyArray of y
Returns
Statistical uncertainty on the covariance
void Math::DecrementCovariance ( const size_t &  n,
double &  cov,
const double &  xmean,
const double &  ymean,
const double &  x,
const double &  y 
)

Removes an pair of elements from a precomputed covariance.

Parameters
nCurrent number of pair of elements in the covariance
covValue of the covariance of n elements
xmeanCurrent mean of the first variable
ymeanCurrent mean of the second variable
xValue of the first variable to remove from the sample
yValue of the second variable to remove from the sample
void Math::DecrementCovarianceMatrix ( const size_t &  n,
Matrix< double > &  covmat,
const std::vector< double > &  means,
const std::vector< double > &  v 
)

Removes an element array from a precomputed covariance matrix.

Parameters
nCurrent number of element arrays in the covariance matrix
covmatValue of the covariance matrix
meansVector of means
vElement array to remove from the sample
void Math::DecrementMean ( const size_t &  n,
double &  mean,
const double &  x 
)

Removes an element from a precomputed mean.

Parameters
nCurrent number of elements in the mean
meanValue of the mean of n elements
xValue to remove from the sample
double Math::DeterminantError ( const Matrix< double > &  mat,
const Matrix< double > &  mat_error = Matrix< double >() 
)

Returns the exact error on the determinant of the covariance matrix.

Parameters
matMatrix that contains the samples
mat_errorMatrix that contains the errors on those samples
Returns
Uncertainty on the determinant of the covariance matrix
double Math::DeterminantMError ( const Matrix< double > &  mat,
const Matrix< double > &  mat_error 
)

Returns the measurement error on the determinant of the covariance matrix.

Parameters
matMatrix that contains the samples
mat_errorMatrix that contains the errors on those samples
Returns
Measurement uncertainty on the determinant of the covariance matrix
double Math::DeterminantSError ( const Matrix< double > &  mat)

Returns the statistical error on the determinant of the covariance matrix.

Parameters
matMatrix that contains the samples
Returns
Statistical uncertainty on the determinant of the covariance matrix
size_t Math::Factorial ( const size_t  n)

Returns the factorial of the provided integer.

Parameters
nInteger
Returns
Factorial
double Math::GeneralisedDistance ( const double &  rhoR,
const double &  rho0 
)

Returns the generalised distance of a point to a distribution.

Parameters
rhoRDensity of the distribution at the level of the point
rho0Maximum density of the distribution
Returns
Generalised distance
double Math::GeneralisedDistanceSquared ( const double &  rhoR,
const double &  rho0 
)

Returns the squared generalised distance of a point to a distribution.

Parameters
rhoRDensity of the distribution at the level of the point
rho0Maximum density of the distribution
Returns
Generalised squared distance
double Math::HullVolumeTGausRelativeBias ( const double &  d,
const double &  alpha,
const size_t  N 
)

Returns the relative bias (i.e. E(^V-V)/V) on the volume of the convexe hull of of a fraction alpha of N points selected from a multivariate Gaussian in dimension d.

Parameters
dDimension of the space
alphaFraction of the total number of points
NTotal number of samples
Returns
Bias factor (1+beta)
double Math::HullVolumeTGausRelativeRMS ( const double &  d,
const double &  alpha,
const size_t  N 
)

Returns the relative RMS (i.e. RMS(^V)/^V) on the volume of the convexe hull of of a fraction alpha of N points selected from a multivariate Gaussian in dimension d.

Parameters
dDimension of the space
alphaFraction of the total number of points
NTotal number of samples
Returns
Relative RMS
double Math::HullVolumeUniformFactor ( const double &  d,
const double &  p 
)

Returns the hull volume bias factor for N points uniformly distributed inside a ball.

Parameters
dDimension of the space
pParameter of the Lebesgue norm
Returns
Bias factor
double Math::HullVolumeUniformRelativeBias ( const double &  d,
const double &  p,
const size_t  N 
)

Returns the relative bias (i.e. E(^V-V)/V) on the volume of the convexe hull of N points uniformly distributed inside a p-unit ball in d dimensions.

Parameters
dDimension of the space
pParameter of the Lebesgue norm
NNumber of samples
Returns
Bias factor (1+beta)
double Math::HullVolumeUniformRelativeRMS ( const double &  d,
const double &  p,
const size_t  N 
)

Returns the relative RMS (i.e. RMS(^V)/^V) on the volume of the convexe hull of N points uniformly distributed inside a p-unit ball in d dimensions.

Parameters
dDimension of the space
pParameter of the Lebesgue norm
NNumber of samples
Returns
Relative RMS
void Math::IncrementCovariance ( const size_t &  n,
double &  cov,
const double &  xmean,
const double &  ymean,
const double &  x,
const double &  y 
)

Adds an pair of elements from a precomputed covariance.

Parameters
nCurrent number of pair of elements in the covariance
covValue of the covariance of n elements
xmeanCurrent mean of the first variable
ymeanCurrent mean of the second variable
xValue of the first variable to remove from the sample
yValue of the second variable to remove from the sample
void Math::IncrementCovarianceMatrix ( const size_t &  n,
Matrix< double > &  covmat,
const std::vector< double > &  means,
const std::vector< double > &  v 
)

Adds an element array to a precomputed covariance matrix.

Parameters
nCurrent number of element arrays in the covariance matrix
covmatValue of the covariance matrix
meansVector of means
vElement array to add to the sample
void Math::IncrementMean ( const size_t &  n,
double &  mean,
const double &  x 
)

Adds an element to a precomputed mean.

Parameters
nCurrent number of elements in the mean
meanValue of the mean of n elements
xValue to add to the sample
bool Math::IsInsideSimplex ( const std::vector< double > &  point,
const std::vector< std::vector< double >> &  simplex 
)

Returns true if a point is inside a provided simplex.

Parameters
pointTest point
simplexTest simplex
Returns
True if the point is inside the simplex
bool Math::LeftHanded ( const Vector< double > &  a,
const Vector< double > &  b 
)

Returns true if the a lies to the left of b in the 2d plane.

Parameters
aFirst vector
bSecond
Returns
True if to a to the left of b
double Math::LpNorm ( const std::vector< double > &  v,
const double &  p 
)

Returns the lp-norm of a vector.

Parameters
vVector
pParameter of the norm
Returns
||v||_p
double Math::LpNormp ( const std::vector< double > &  v,
const double &  p 
)

Returns the lp-norm of a vector to the power of p.

Parameters
vVector
pParameter of the Lebesgue norm
Returns
||v||_p^p
double Math::LWidth ( const std::vector< double > &  vx,
const double &  p 
)

Computes the Lebesgues width for a given metric (RMS = L2)

Parameters
vxArray of x
pParameter p of the Lp space
Returns
Sample mode
double Math::Mahalanobis ( const Matrix< double > &  invcov,
const Matrix< double > &  vec 
)

Returns the Mahalanobis distance of a point to a distribution.

Parameters
invcovInverse covariance matrix of the data
vecVector of measurements
Returns
Mahalanobis distance
double Math::MahalanobisSquared ( const Matrix< double > &  invcov,
const Matrix< double > &  vec 
)

Returns the squared Mahalanobis distance of a point to a distribution.

Parameters
invcovInverse covariance matrix of the data
vecVector of measurements
Returns
Mahalanobis squared distance
double Math::Max ( const std::vector< double > &  vx)

Returns the maximum value in the array.

Parameters
vxArray of x
Returns
Sample maximum
double Math::Mean ( const std::vector< double > &  vx)

Computes the mean of a variable sample.

Parameters
vxArray of x
Returns
Mean
double Math::MeanError ( const std::vector< double > &  vx,
const std::vector< double > &  vex = std::vector< double >() 
)

Computes the error on the mean of a variable sample.

Parameters
vxArray of x
vexArray of x errors
Returns
Uncertainty on the mean
double Math::MeanMError ( const std::vector< double > &  vex)

Computes the measurement error on the mean of a variable sample.

Parameters
vexArray of x errors
Returns
Measurement uncertainty on the mean
double Math::MeanSError ( const std::vector< double > &  vx)

Computes the statistical error on the mean of a variable sample.

Parameters
vxArray of x
Returns
Statistical uncertainty on the mean
double Math::Median ( const std::vector< double > &  vx)

Computes the median of a variable sample.

Parameters
vxArray of x
Returns
Median
double Math::MedianSError ( const size_t  n,
const double &  density 
)

Computes the statistical error on the median of a variable sample.

Parameters
nTotal number of samples points
densityDensity at the point in question (essential)
Returns
Median statistical error
double Math::Min ( const std::vector< double > &  vx)

Returns the minimum value in the array.

Parameters
vxArray of x
Returns
Sample minimum
double Math::Mode ( const std::vector< double > &  vx)

Computes the most probable value of the variable sample.

Parameters
vxArray of x
Returns
Sample mode
double Math::PlaneDistance ( const std::vector< double > &  pars,
const std::vector< double > &  point 
)

Computes the distance between a plane of given equation parameters and a point.

Parameters
parsArray of parameters n_x, n_y, n_z, r_0
pointCoordinates of the point
Returns
Distance
std::vector< double > Math::PlaneParameters ( const std::vector< Vector< double >> &  points)

Computes the equation parameters of a plane given three points.

Parameters
pointsVector of coordinates of the 3 points
Returns
Array of parameters n_x, n_y, n_z, r_0
std::vector< double > Math::PlaneParameters ( const Vector< double > &  v0,
const Vector< double > &  v1,
const Vector< double > &  v2 
)

Computes the equation parameters of a plane given three points.

Parameters
v0,v1,v2Coordinates of the 3 points
Returns
Array of parameters n_x, n_y, n_z, r_0
double Math::Quantile ( const std::vector< double > &  vx,
const double &  alpha 
)

Computes the quantile of a variable sample at probability alpha.

Parameters
vxArray of x
alphaProbability value, at which the quantile is computed
Returns
Quantile at probability alpha
double Math::QuantileSError ( const size_t  n,
const double &  alpha,
const double &  density 
)

Computes the statistical error on the quantile of a variable sample at probability alpha.

Parameters
nTotal number of samples points
alphaProbability value, at which the quantile is computed
densityDensity at the point in question (essential)
Returns
Quantile statistical error at probability alpha
template<typename I >
I Math::RandomElement ( I  begin,
I  end 
)

Randomly select a single element from an array.

Parameters
beginIterator to the first element
endIterator to the last element
Returns
Iterator to the randomly selected element
template<typename T >
std::vector< T > Math::Resample ( const std::vector< T > &  vx,
size_t  m = 0,
const bool  rep = true 
)

Randomly resample n data points into m data points with or without replacement.

Parameters
vxInput sample
mAmount of points in the subsample
repWith replacement if true
Returns
Subsample of m data points
bool Math::RightHanded ( const Vector< double > &  a,
const Vector< double > &  b 
)

Returns true if the a lies to the right of b in the 2d plane.

Parameters
aFirst vector
bSecond
Returns
True if to a to the right of b
double Math::RMS ( const std::vector< double > &  vx)

Computes the standard deviation of a variable sample.

Parameters
vxArray of x
Returns
Standard deviation
double Math::RMSError ( const std::vector< double > &  vx,
const std::vector< double > &  vex = std::vector< double >() 
)

Computes the error on the standard deviation of a variable sample.

Parameters
vxArray of x
vexArray of x errors
Returns
Uncertainty on the standard deviation
double Math::RMSMError ( const std::vector< double > &  vx,
const std::vector< double > &  vex 
)

Computes the measurement error on the standard deviation of a variable sample.

Parameters
vxArray of x
vexArray of x errors
Returns
Measurement uncertainty on the standard deviation
double Math::RMSSError ( const std::vector< double > &  vx)

Computes the statistical error on the standard deviation of a variable sample.

Parameters
vxArray of x
Returns
Statistical uncertainty on the standard deviation
Matrix< double > Math::RobustCovarianceMatrix ( const Matrix< double > &  mat,
const double  hh = 0 
)

Returns the MCD robust covariance matrix of a multivariate sample.

Parameters
matMatrix that contains the relevant sample
hhNumber of elements in the subsamble of which to get the MCD
Returns
Robust covariance matrix
double Math::RobustMean ( const std::vector< double > &  vx)

Computes the MCD robust mean of a variable sample.

Parameters
vxArray of x
Returns
Mean
std::vector< std::vector< double > > Math::SimplexVertices ( const size_t  n)

Returns the n+1 vertices of an n-simplex.

Parameters
nDimension of the space
Returns
Array of n+1 points with n coordinates
void Math::SortACW ( std::vector< Vector< double >> &  points)

Sorts the input points anticlockwise in the the 2D plane.

Parameters
pointsArray of points to sort
void Math::SortCW ( std::vector< Vector< double >> &  points)

Sorts the input points clockwise in the the 2D plane.

Parameters
pointsArray of points to sort
double Math::TMean ( const std::vector< double > &  vx,
const double &  frac 
)

Computes the trimmed mean of a variable sample.

Parameters
vxArray of x
fracFraction of lowest and highest values to discard
Returns
Trimmed mean
double Math::TMeanSError ( const std::vector< double > &  vx,
const double &  frac 
)

Computes the statistical error on the trimmed mean of a variable sample.

Parameters
vxArray of x
fracFraction of lowest and highest values to discard
Returns
Statistical uncertainty on the trimmed mean
template<typename T >
void Math::Trim ( std::vector< T > &  vx,
const double &  frac 
)

Trim the n% lowest and n% largest values.

Parameters
vxInput sample to trim
fracFraction of lowest and highest values to discard
template<typename T >
std::vector< T > Math::Trimmed ( std::vector< T >  vx,
const double &  frac 
)

Trim the n% lowest and n% largest values.

Parameters
vxInput sample to trim
fracFraction of lowest and highest values to discard
Returns
Trimmed sample
double Math::UnitBallVolume ( const size_t &  d,
const double  p = 2. 
)

Returns the volume of the unit d-ball.

Parameters
dDimension
pLebesgue Metric
Returns
Volume of B_d^p
double Math::Variance ( const std::vector< double > &  vx)

Computes the variance of a variable sample.

Parameters
vxArray of x
Returns
Variance
double Math::VarianceError ( const std::vector< double > &  vx,
const std::vector< double > &  vex = std::vector< double >() 
)

Computes the error on the variance of a variable sample.

Parameters
vxArray of x
vexArray of x errors
Returns
Uncertainty on the variance
double Math::VarianceMError ( const std::vector< double > &  vx,
const std::vector< double > &  vex = std::vector< double >() 
)

Computes the measurement error on the variance of a variable sample.

Parameters
vxArray of x
vexArray of x errors
Returns
Measurement uncertainty on the variance
double Math::VarianceSError ( const std::vector< double > &  vx)

Computes the statistical error on the variance of a variable sample.

Parameters
vxArray of x
Returns
Statistical uncertainty on the variance
template<typename T >
void Math::Winsorize ( std::vector< T > &  vx,
const double &  frac 
)

Winsorize to keep only a fraction frac of the original sample.

Parameters
vxInput sample to winsorize
fracFraction of lowest and highest values to winsorize
template<typename T >
std::vector< T > Math::Winsorized ( std::vector< T >  vx,
const double &  frac 
)

Winsorize to keep only a fraction frac of the original sample.

Parameters
vxInput sample to winsorize
fracFraction of lowest and highest values to winsorize
Returns
Winsorized sample
double Math::WMean ( const std::vector< double > &  vx,
const double &  frac 
)

Computes the winsorized mean of a variable sample.

Parameters
vxArray of x
fracFraction of lowest and highest values to winsorize
Returns
Winsorized mean
double Math::WRMS ( const std::vector< double > &  vx,
const double &  frac 
)

Computes the winsorized standard deviation of a variable sample.

Parameters
vxArray of x
fracFraction of lowest and highest values to winsorize
Returns
Standard deviation