PCL
Statistical Functions

Classes

struct  pcl::TwoSidedEstimate
 Two-sided descriptive statistical estimate. More...
 

Functions

template<typename T >
double pcl::AvgDev (const T *__restrict__ i, const T *__restrict__ j)
 
template<typename T >
double pcl::AvgDev (const T *__restrict__ i, const T *__restrict__ j, double center) noexcept
 
template<typename T >
double pcl::BendMidvariance (const T *__restrict__ x, const T *__restrict__ xn, double center, double beta=0.2)
 
template<typename T >
double pcl::BiweightMidvariance (const T *__restrict__ x, const T *__restrict__ xn, double center, double sigma, int k=9, bool reducedLength=false) noexcept
 
template<typename T >
double pcl::MAD (const T *__restrict__ i, const T *__restrict__ j)
 
template<typename T >
double pcl::MAD (const T *__restrict__ i, const T *__restrict__ j, double center)
 
template<typename T >
double pcl::Mean (const T *__restrict__ i, const T *__restrict__ j) noexcept
 
template<class T >
double pcl::Median (const T *__restrict__ i, const T *__restrict__ j)
 
template<typename T >
double pcl::MedianDestructive (T *__restrict__ i, T *__restrict__ j) noexcept
 
template<typename T , class BP >
double pcl::MedianDestructive (T *__restrict__ i, T *__restrict__ j, BP p) noexcept
 
template<typename T >
double pcl::Modulus (const T *__restrict__ i, const T *__restrict__ j) noexcept
 
template<typename T >
double pcl::OrderStatistic (const T *__restrict__ i, const T *__restrict__ j, distance_type k)
 
template<typename T , class BP >
double pcl::OrderStatisticDestructive (const T *__restrict__ i, const T *__restrict__ j, distance_type k, BP p) noexcept
 
template<typename T >
double pcl::OrderStatisticDestructive (T *__restrict__ i, T *__restrict__ j, distance_type k) noexcept
 
template<typename T >
TwoSidedEstimate pcl::Pow (const TwoSidedEstimate &e, T x) noexcept
 
template<typename T >
double pcl::Qn (T *__restrict__ x, T *__restrict__ xn)
 
template<typename T >
double pcl::Sn (T *__restrict__ x, T *__restrict__ xn)
 
TwoSidedEstimate pcl::Sqrt (const TwoSidedEstimate &e) noexcept
 
template<typename T >
double pcl::StableAvgDev (const T *__restrict__ i, const T *__restrict__ j)
 
template<typename T >
double pcl::StableAvgDev (const T *__restrict__ i, const T *__restrict__ j, double center) noexcept
 
template<typename T >
double pcl::StableMean (const T *__restrict__ i, const T *__restrict__ j) noexcept
 
template<typename T >
double pcl::StableModulus (const T *__restrict__ i, const T *__restrict__ j) noexcept
 
template<typename T >
double pcl::StableSum (const T *__restrict__ i, const T *__restrict__ j) noexcept
 
template<typename T >
double pcl::StableSumOfSquares (const T *__restrict__ i, const T *__restrict__ j) noexcept
 
template<typename T >
double pcl::StdDev (const T *__restrict__ i, const T *__restrict__ j) noexcept
 
template<typename T >
double pcl::StdDev (const T *__restrict__ i, const T *__restrict__ j, double center) noexcept
 
template<typename T >
double pcl::Sum (const T *__restrict__ i, const T *__restrict__ j) noexcept
 
template<typename T >
double pcl::SumOfSquares (const T *__restrict__ i, const T *__restrict__ j) noexcept
 
template<typename T >
double pcl::TrimmedMean (const T *__restrict__ i, const T *__restrict__ j, distance_type l=1, distance_type h=1)
 
template<typename T >
double pcl::TrimmedMeanDestructive (T *__restrict__ i, T *__restrict__ j, distance_type l=1, distance_type h=1) noexcept
 
template<typename T >
double pcl::TrimmedMeanOfSquares (const T *__restrict__ i, const T *__restrict__ j, distance_type l=1, distance_type h=1)
 
template<typename T >
double pcl::TrimmedMeanOfSquaresDestructive (T *__restrict__ i, T *__restrict__ j, distance_type l=1, distance_type h=1) noexcept
 
template<typename T >
TwoSidedEstimate pcl::TwoSidedAvgDev (const T *__restrict__ i, const T *__restrict__ j)
 
template<typename T >
TwoSidedEstimate pcl::TwoSidedAvgDev (const T *__restrict__ i, const T *__restrict__ j, double center) noexcept
 
template<typename T >
TwoSidedEstimate pcl::TwoSidedBiweightMidvariance (const T *__restrict__ x, const T *__restrict__ xn, double center, const TwoSidedEstimate &sigma, int k=9, bool reducedLength=false) noexcept
 
template<typename T >
TwoSidedEstimate pcl::TwoSidedMAD (const T *__restrict__ i, const T *__restrict__ j)
 
template<typename T >
TwoSidedEstimate pcl::TwoSidedMAD (const T *__restrict__ i, const T *__restrict__ j, double center)
 
template<typename T >
double pcl::Variance (const T *__restrict__ i, const T *__restrict__ j) noexcept
 
template<typename T >
double pcl::Variance (const T *__restrict__ i, const T *__restrict__ j, double center) noexcept
 

Detailed Description

Function Documentation

◆ AvgDev() [1/2]

template<typename T >
double pcl::AvgDev ( const T *__restrict__  i,
const T *__restrict__  j 
)
inline

Returns the average absolute deviation from the median of the values in a sequence [i,j).

The average absolute deviation from the median is a well-known estimator of dispersion.

For sequences of less than two elements, this function returns zero.

See the remarks made for the Sum() function, which are equally applicable in this case. See StableAvgDev() for a (slow) numerically stable version of this function.

Note
To make the average absolute deviation about the median consistent with the standard deviation of a normal distribution, it must be multiplied by the constant 1.2533.

Definition at line 3473 of file Math.h.

◆ AvgDev() [2/2]

template<typename T >
double pcl::AvgDev ( const T *__restrict__  i,
const T *__restrict__  j,
double  center 
)
inlinenoexcept

Returns the average absolute deviation of the values in a sequence [i,j) with respect to the specified center value.

When the median of the sequence is used as the center value, this function returns the average absolute deviation from the median, which is a well-known estimator of dispersion.

For sequences of less than two elements, this function returns zero.

See the remarks made for the Sum() function, which are equally applicable in this case. See StableAvgDev() for a (slow) numerically stable version of this function.

Note
To make the average absolute deviation about the median consistent with the standard deviation of a normal distribution, it must be multiplied by the constant 1.2533.

Definition at line 3404 of file Math.h.

Referenced by pcl::GenericMatrix< T >::AvgDev(), and pcl::GenericVector< T >::AvgDev().

◆ BendMidvariance()

template<typename T >
double pcl::BendMidvariance ( const T *__restrict__  x,
const T *__restrict__  xn,
double  center,
double  beta = 0.2 
)

Returns a percentage bend midvariance (PBMV) for the elements in a sequence [x,xn).

Parameters
x,xnDefine a sequence of sample data points for which the PBWV estimator will be calculated.
centerReference center value. Normally, the median of the sample should be used.
betaRejection parameter in the [0,0.5] range. Higher values improve robustness to outliers (i.e., increase the breakdown point of the estimator) at the expense of a lower efficiency. The default value is beta=0.2.

The square root of the percentage bend midvariance is a robust estimator of scale. With the default beta=0.2, its Gaussian efficiency is 67%. With beta=0.1, its efficiency is 85% but its breakdown is only 0.1.

For sequences of less than two elements, this function returns zero.

References

Rand R. Wilcox (2012), Introduction to Robust Estimation and Hypothesis Testing, 3rd Edition, Elsevier Inc., Section 3.12.3.

Definition at line 4480 of file Math.h.

Referenced by pcl::GenericMatrix< T >::BendMidvariance(), and pcl::GenericVector< T >::BendMidvariance().

◆ BiweightMidvariance()

template<typename T >
double pcl::BiweightMidvariance ( const T *__restrict__  x,
const T *__restrict__  xn,
double  center,
double  sigma,
int  k = 9,
bool  reducedLength = false 
)
noexcept

Returns a biweight midvariance (BWMV) for the elements in a sequence [x,xn).

Parameters
x,xnDefine a sequence of sample data points for which the BWMV estimator will be calculated.
centerReference center value. Normally, the median of the sample should be used.
sigmaA reference estimate of dispersion. Normally, the median absolute deviation from the median (MAD) of the sample should be used.
kRejection limit in sigma units. The default value is k=9.
reducedLengthIf true, reduce the sample size to exclude rejected elements. This tends to approximate the true dispersion of the data more accurately for relatively small samples, or samples with large amounts of outliers. Note that this departs from the standard definition of biweight midvariance, where the total number of data items is used to scale the variance estimate. If false, use the full sample size, including rejected elements, which gives a standard biweight midvariance estimate.

The square root of the biweight midvariance is a robust estimator of scale. It is an efficient estimator with respect to many statistical distributions (about 87% Gaussian efficiency), and appears to have a breakdown point close to 0.5 (the same as MAD).

For sequences of less than two elements, this function returns zero.

Note
To make the BWMV estimator consistent with the standard deviation of a normal distribution, its square root must be multiplied by the constant 0.991.

References

Rand R. Wilcox (2017), Introduction to Robust Estimation and Hypothesis Testing, 4th Edition, Elsevier Inc., Section 3.12.1.

Definition at line 4341 of file Math.h.

Referenced by pcl::GenericMatrix< T >::BiweightMidvariance(), and pcl::GenericVector< T >::BiweightMidvariance().

◆ MAD() [1/2]

template<typename T >
double pcl::MAD ( const T *__restrict__  i,
const T *__restrict__  j 
)
inline

Returns the median absolute deviation from the median (MAD) for the values in a sequence [i,j).

The MAD is a well-known robust estimator of scale.

For sequences of less than two elements, this function returns zero.

Note
To make the MAD estimator consistent with the standard deviation of a normal distribution, its result must be multiplied by the constant 1.4826.

Definition at line 3819 of file Math.h.

◆ MAD() [2/2]

template<typename T >
double pcl::MAD ( const T *__restrict__  i,
const T *__restrict__  j,
double  center 
)
inline

Returns the median absolute deviation (MAD) of the values in a sequence [i,j) with respect to the specified center value.

The MAD is a well-known robust estimator of scale.

For sequences of less than two elements, this function returns zero.

Note
To make the MAD estimator consistent with the standard deviation of a normal distribution, its result must be multiplied by the constant 1.4826.

Definition at line 3776 of file Math.h.

Referenced by pcl::ImageStatistics::Data::AssignStatisticalData(), pcl::GenericMatrix< T >::BiweightMidvariance(), pcl::GenericVector< T >::BiweightMidvariance(), pcl::GenericMatrix< T >::MAD(), and pcl::GenericVector< T >::MAD().

◆ Mean()

template<typename T >
double pcl::Mean ( const T *__restrict__  i,
const T *__restrict__  j 
)
inlinenoexcept

Returns the arithmetic mean of a sequence [i,j).

For empty sequences, this function returns zero.

See the remarks made for the Sum() function, which are equally applicable in this case. See StableMean() for a (slow) numerically stable version of this function.

Definition at line 2709 of file Math.h.

Referenced by pcl::GenericVector< T >::Mean(), and pcl::GenericMatrix< T >::Mean().

◆ Median()

template<class T >
double pcl::Median ( const T *__restrict__  i,
const T *__restrict__  j 
)
inline

Returns the median value of a sequence [i,j).

For scalar data types the following algorithms are used:

  • Hard-coded, fast selection networks for small sequences of 32 or less elements.
  • A quick selection algorithm for sequences of up to about 2M elements. The actual limit has been determined empirically and can vary across PCL versions. This single-threaded algorithm can use up to 16 MiB of additional memory allocated dynamically (for 8-byte types such as double).
  • A parallelized, fast histogram-based algorithm for sequences larger than the limit described above. This algorithm has negligible additional memory space requirements.

For non-scalar data types, this function requires the following type conversion operator publicly defined for the type T:

T::operator double() const;

This operator will be used to generate a temporary dynamic array of double values with the length of the input sequence, which will be used to compute the median with the algorithms enumerated above.

References (selection networks)

  • Knuth, D. E., The Art of Computer Programming, volume 3: Sorting and Searching, Addison Wesley, 1973.
  • Hillis, W. D., Co-evolving parasites improve simulated evolution as an optimization procedure. Langton, C. et al. (Eds.), Artificial Life II. Addison Wesley, 1992.
  • Hugues Juille, Evolution of Non-Deterministic Incremental Algorithms as a New Approach for Search in State Spaces, 1995

References (quick select algorithm)

  • William H. Press et al., Numerical Recipes 3rd Edition: The Art of Scientific Computing, Cambridge University Press, 2007, Section 8.5.
  • Robert Sedgewick, Kevin Wayne, Algorithms, 4th Edition, Addison-Wesley Professional, 2011, pp 345-347.

Definition at line 2878 of file Math.h.

Referenced by pcl::GenericMatrix< T >::BiweightMidvariance(), pcl::GenericVector< T >::BiweightMidvariance(), pcl::GenericMatrix< T >::Median(), pcl::GenericVector< T >::Median(), pcl::GenericMatrix< T >::TwoSidedBiweightMidvariance(), and pcl::GenericVector< T >::TwoSidedBiweightMidvariance().

◆ MedianDestructive() [1/2]

template<typename T >
double pcl::MedianDestructive ( T *__restrict__  i,
T *__restrict__  j 
)
inlinenoexcept

Returns the median value of a sequence [i,j), altering the existing order of elements in the input sequence.

This function is intended for sequences of non-scalar objects where the order of elements is irrelevant, and hence generation of a working duplicate is unnecessary. The following type conversion operator must be publicly defined for the type T:

T::operator double() const;

The following algorithms are used:

  • Hard-coded, fast selection networks for sequences of 9 or less elements.
  • A quick selection algorithm for sequences larger than 9 elements.
Note
This is a destructive median calculation algorithm: it alters the existing order of items in the input [i,j) sequence.

References (selection networks)

  • Knuth, D. E., The Art of Computer Programming, volume 3: Sorting and Searching, Addison Wesley, 1973.
  • Hillis, W. D., Co-evolving parasites improve simulated evolution as an optimization procedure. Langton, C. et al. (Eds.), Artificial Life II. Addison Wesley, 1992.
  • Hugues Juille, Evolution of Non-Deterministic Incremental Algorithms as a New Approach for Search in State Spaces, 1995

References (quick select algorithm)

  • William H. Press et al., Numerical Recipes 3rd Edition: The Art of Scientific Computing, Cambridge University Press, 2007, Section 8.5.
  • Robert Sedgewick, Kevin Wayne, Algorithms, 4th Edition, Addison-Wesley Professional, 2011, pp 345-347.

Definition at line 2960 of file Math.h.

◆ MedianDestructive() [2/2]

template<typename T , class BP >
double pcl::MedianDestructive ( T *__restrict__  i,
T *__restrict__  j,
BP  p 
)
inlinenoexcept

Returns the median value of a sequence [i,j), altering the existing order of elements in the input sequence.

Element comparison is given by a binary predicate p such that p( a, b ) is true for any pair a, b of elements such that a precedes b.

We use fast, hard-coded selection networks for sequences of 9 or less elements, and a quick selection algorithm for larger sets.

See the documentation of MedianDestructive( T*, T* ) for more information and references.

Definition at line 3041 of file Math.h.

◆ Modulus()

template<typename T >
double pcl::Modulus ( const T *__restrict__  i,
const T *__restrict__  j 
)
inlinenoexcept

Returns the sum of the absolute values of the elements in a sequence [i,j).

For empty sequences, this function returns zero.

See the remarks made for the Sum() function, which are equally applicable in this case. See StableModulus() for a (slow) numerically stable version of this function.

Definition at line 2617 of file Math.h.

Referenced by pcl::GenericMatrix< T >::Modulus(), pcl::GenericVector< T >::Modulus(), and pcl::KernelFilter::Normalize().

◆ OrderStatistic()

template<typename T >
double pcl::OrderStatistic ( const T *__restrict__  i,
const T *__restrict__  j,
distance_type  k 
)
inline

Returns the k-th order statistic of a sequence [i,j).

For scalar data types the following algorithms are used:

  • A quick selection algorithm for sequences of up to about 2M elements. The actual limit has been determined empirically and can vary across PCL versions. This single-threaded algorithm can use up to 16 MiB of additional memory allocated dynamically (for 8-byte types such as double).
  • A parallelized, fast histogram-based algorithm for sequences larger than the limit described above. This algorithm has negligible additional memory space requirements.

For non-scalar data types, this function requires the following type conversion operator publicly defined for the type T:

T::operator double() const;

This operator will be used to generate a temporary dynamic array of double values with the length of the input sequence, which will be used to compute the median with the quick selection algorithm.

References (quick select algorithm)

  • William H. Press et al., Numerical Recipes 3rd Edition: The Art of Scientific Computing, Cambridge University Press, 2007, Section 8.5.
  • Robert Sedgewick, Kevin Wayne, Algorithms, 4th Edition, Addison-Wesley Professional, 2011, pp 345-347.

Definition at line 3138 of file Math.h.

◆ OrderStatisticDestructive() [1/2]

template<typename T , class BP >
double pcl::OrderStatisticDestructive ( const T *__restrict__  i,
const T *__restrict__  j,
distance_type  k,
BP  p 
)
inlinenoexcept

Returns the k-th order statistic of a sequence [i,j), altering the existing order of elements in the input sequence.

Element comparison is given by a binary predicate p such that p( a, b ) is true for any pair a, b of elements such that a precedes b.

See the documentation of OrderStatisticDestructive( T*, T*, distance_type ) for more information and references.

Definition at line 3219 of file Math.h.

◆ OrderStatisticDestructive() [2/2]

template<typename T >
double pcl::OrderStatisticDestructive ( T *__restrict__  i,
T *__restrict__  j,
distance_type  k 
)
inlinenoexcept

Returns the k-th order statistic of a sequence [i,j), altering the existing order of elements in the input sequence.

This function is intended for sequences of non-scalar objects where the order of elements is irrelevant, and hence generation of a working duplicate is unnecessary. The following type conversion operator must be publicly defined for the type T:

<

> T::operator double() const;

The quick selection algorithm is used to find the k-th element in the ordered sequence.

Note
This is a destructive algorithm: it alters the existing order of items in the input [i,j) sequence.

References (quick select algorithm)

  • William H. Press et al., Numerical Recipes 3rd Edition: The Art of Scientific Computing, Cambridge University Press, 2007, Section 8.5.
  • Robert Sedgewick, Kevin Wayne, Algorithms, 4th Edition, Addison-Wesley Professional, 2011, pp 345-347.

Definition at line 3197 of file Math.h.

◆ Pow()

template<typename T >
TwoSidedEstimate pcl::Pow ( const TwoSidedEstimate e,
x 
)
inlinenoexcept

Returns the component wise exponent function of a two-sided estimate.

Definition at line 3691 of file Math.h.

◆ Qn()

template<typename T >
double pcl::Qn ( T *__restrict__  x,
T *__restrict__  xn 
)

Returns the Qn scale estimator of Rousseeuw and Croux for a sequence [x,xn):

Qn = c * first_quartile( |x_i - x_j| : i < j )

where first_quartile() is the order statistic of rank (n + 1)/4. n >= 2 is the number of elements in the sequence: n = xn - x.

This implementation is a C++ translation of the original FORTRAN code by the authors (see References). The algorithm has O(n*log_2(n)) time complexity and the implementation requires about O(9*n) additional storage.

The constant c = 2.2219 must be used to make the Qn estimator converge to the standard deviation of a pure normal distribution. However, this implementation does not apply it (it uses c=1 implicitly), for consistency with other implementations of scale estimators.

References

P.J. Rousseeuw and C. Croux (1993), Alternatives to the Median Absolute Deviation, Journal of the American Statistical Association, Vol. 88, pp. 1273-1283.

Note
This is a destructive algorithm: it may alter the initial order of items in the specified [x,xn) sequence.

Definition at line 4170 of file Math.h.

Referenced by pcl::ImageStatistics::Data::AssignStatisticalData(), and pcl::GenericVector< T >::Qn().

◆ Sn()

template<typename T >
double pcl::Sn ( T *__restrict__  x,
T *__restrict__  xn 
)

Returns the Sn scale estimator of Rousseeuw and Croux for a sequence [x,xn):

Sn = c * low_median( high_median( |x_i - x_j| ) )

where low_median() is the order statistic of rank (n + 1)/2, and high_median() is the order statistic of rank n/2 + 1. n >= 2 is the number of elements in the sequence: n = xn - x.

This implementation is a direct C++ translation of the original FORTRAN code by the authors (see References). The algorithm has O(n*log_2(n)) time complexity and uses O(n) additional storage.

The constant c = 1.1926 must be used to make the Sn estimator converge to the standard deviation of a pure normal distribution. However, this implementation does not apply it (it uses c=1 implicitly), for consistency with other implementations of scale estimators.

References

P.J. Rousseeuw and C. Croux (1993), Alternatives to the Median Absolute Deviation, Journal of the American Statistical Association, Vol. 88, pp. 1273-1283.

Note
This is a destructive algorithm: it may alter the initial order of items in the specified [x,xn) sequence.

Definition at line 3924 of file Math.h.

Referenced by pcl::ImageStatistics::Data::AssignStatisticalData(), and pcl::GenericVector< T >::Sn().

◆ Sqrt()

TwoSidedEstimate pcl::Sqrt ( const TwoSidedEstimate e)
inlinenoexcept

Returns the component wise square root of a two-sided estimate.

Definition at line 3682 of file Math.h.

References pcl::Sqrt().

◆ StableAvgDev() [1/2]

template<typename T >
double pcl::StableAvgDev ( const T *__restrict__  i,
const T *__restrict__  j 
)
inline

Computes the average absolute deviation from the median of the values in a sequence [i,j) using a numerically stable summation algorithm to minimize roundoff error.

The average absolute deviation from the median is a well-known estimator of dispersion.

For sequences of less than two elements, this function returns zero.

In the current PCL versions, this function implements the Kahan summation algorithm to reduce roundoff error to the machine's floating point error.

Note
To make the average absolute deviation about the median consistent with the standard deviation of a normal distribution, it must be multiplied by the constant 1.2533.

Definition at line 3505 of file Math.h.

◆ StableAvgDev() [2/2]

template<typename T >
double pcl::StableAvgDev ( const T *__restrict__  i,
const T *__restrict__  j,
double  center 
)
inlinenoexcept

Returns the average absolute deviation of the values in a sequence [i,j) with respect to the specified center value, using a numerically stable summation algorithm to minimize roundoff error.

When the median of the sequence is used as the center value, this function returns the average absolute deviation from the median, which is a well-known estimator of dispersion.

For sequences of less than two elements, this function returns zero.

In the current PCL versions, this function implements the Kahan summation algorithm to reduce roundoff error to the machine's floating point error.

Note
To make the average absolute deviation about the median consistent with the standard deviation of a normal distribution, it must be multiplied by the constant 1.2533.

Definition at line 3436 of file Math.h.

Referenced by pcl::GenericMatrix< T >::StableAvgDev(), and pcl::GenericVector< T >::StableAvgDev().

◆ StableMean()

template<typename T >
double pcl::StableMean ( const T *__restrict__  i,
const T *__restrict__  j 
)
inlinenoexcept

Computes the arithmetic mean of a sequence [i,j) using a numerically stable summation algorithm to minimize roundoff error.

For empty sequences, this function returns zero.

In the current PCL versions, this function implements the Kahan summation algorithm to reduce roundoff error to the machine's floating point error.

Definition at line 2728 of file Math.h.

Referenced by pcl::GenericMatrix< T >::StableMean(), and pcl::GenericVector< T >::StableMean().

◆ StableModulus()

template<typename T >
double pcl::StableModulus ( const T *__restrict__  i,
const T *__restrict__  j 
)
inlinenoexcept

Computes the sum of the absolute values of the elements in a sequence [i,j) using a numerically stable summation algorithm to minimize roundoff error.

For empty sequences, this function returns zero.

In the current PCL versions, this function implements the Kahan summation algorithm to reduce roundoff error to the machine's floating point error.

Definition at line 2636 of file Math.h.

Referenced by pcl::GenericMatrix< T >::StableModulus(), and pcl::GenericVector< T >::StableModulus().

◆ StableSum()

template<typename T >
double pcl::StableSum ( const T *__restrict__  i,
const T *__restrict__  j 
)
inlinenoexcept

Computes the sum of elements in a sequence [i,j) using a numerically stable summation algorithm to minimize roundoff error.

For empty sequences, this function returns zero.

In the current PCL versions, this function implements the Kahan summation algorithm to reduce roundoff error to the machine's floating point error.

Definition at line 2592 of file Math.h.

Referenced by pcl::GenericMatrix< T >::StableSum(), and pcl::GenericVector< T >::StableSum().

◆ StableSumOfSquares()

template<typename T >
double pcl::StableSumOfSquares ( const T *__restrict__  i,
const T *__restrict__  j 
)
inlinenoexcept

Computes the sum of the squares of the elements in a sequence [i,j) using a numerically stable summation algorithm to minimize roundoff error.

For empty sequences, this function returns zero.

In the current PCL versions, this function implements the Kahan summation algorithm to reduce roundoff error to the machine's floating point error.

Definition at line 2683 of file Math.h.

Referenced by pcl::GenericMatrix< T >::StableSumOfSquares(), and pcl::GenericVector< T >::StableSumOfSquares().

◆ StdDev() [1/2]

template<typename T >
double pcl::StdDev ( const T *__restrict__  i,
const T *__restrict__  j 
)
inlinenoexcept

Returns the standard deviation from the mean of a sequence [i,j).

For sequences of less than two elements, this function returns zero.

Definition at line 2825 of file Math.h.

◆ StdDev() [2/2]

template<typename T >
double pcl::StdDev ( const T *__restrict__  i,
const T *__restrict__  j,
double  center 
)
inlinenoexcept

Returns the standard deviation of a sequence [i,j) with respect to the specified center value.

For sequences of less than two elements, this function returns zero.

Definition at line 2813 of file Math.h.

Referenced by pcl::GenericMatrix< T >::StdDev(), and pcl::GenericVector< T >::StdDev().

◆ Sum()

template<typename T >
double pcl::Sum ( const T *__restrict__  i,
const T *__restrict__  j 
)
inlinenoexcept

Returns the sum of elements in a sequence [i,j).

For empty sequences, this function returns zero.

This is a straight implementation of a floating point sum, which is subject to severe roundoff errors if the number of summed elements is large. One way to improve on this problem is to sort the input set by decreasing order of absolute value before calling this function. A much better solution, but computationally expensive, is a compensated summation algorithm such as Kahan summation, which we have implemented in the StableSum() routine.

Definition at line 2573 of file Math.h.

Referenced by pcl::Histogram::Count(), pcl::GenericMatrix< T >::Sum(), and pcl::GenericVector< T >::Sum().

◆ SumOfSquares()

template<typename T >
double pcl::SumOfSquares ( const T *__restrict__  i,
const T *__restrict__  j 
)
inlinenoexcept

Returns the sum of the squares of the elements in a sequence [i,j).

For empty sequences, this function returns zero.

See the remarks made for the Sum() function, which are equally applicable in this case. See StableSumOfSquares() for a (slow) numerically stable version of this function.

Definition at line 2661 of file Math.h.

Referenced by pcl::GenericMatrix< T >::SumOfSquares(), and pcl::GenericVector< T >::SumOfSquares().

◆ TrimmedMean()

template<typename T >
double pcl::TrimmedMean ( const T *__restrict__  i,
const T *__restrict__  j,
distance_type  l = 1,
distance_type  h = 1 
)
inline

Computes the two-sided, asymmetric trimmed mean of a sequence [i,j).

The returned value is the arithmetic mean of a sequence [I+l,J-h-1], where [I,J) is the input sequence [i,j) sorted in ascending order.

Let n = j-i be the length of the input sequence. For empty sequences (n ≤ 0) or completely truncated sequences (l+h >= n), this function returns zero. Otherwise the returned value is the arithmetic mean of the nonrejected n-l-h elements in the sorted sequence, as described above.

Definition at line 3242 of file Math.h.

Referenced by pcl::GenericMatrix< T >::TrimmedMean(), and pcl::GenericVector< T >::TrimmedMean().

◆ TrimmedMeanDestructive()

template<typename T >
double pcl::TrimmedMeanDestructive ( T *__restrict__  i,
T *__restrict__  j,
distance_type  l = 1,
distance_type  h = 1 
)
inlinenoexcept

Computes the two-sided, asymmetric trimmed mean of a sequence [i,j), possibly altering the existing order of elements in the input sequence.

The returned value is the arithmetic mean of a sequence [I+l,J-h-1], where [I,J) represents the input sequence [i,j) sorted in ascending order.

Let n = j-i be the length of the input sequence. For empty sequences (n ≤ 0) or completely truncated sequences (l+h >= n), this function returns zero. Otherwise the returned value is the arithmetic mean of the nonrejected n-l-h elements in the sorted sequence, as described above.

Note
This is a destructive trimmed mean calculation algorithm: it may alter the existing order of items in the input [i,j) sequence.

Definition at line 3281 of file Math.h.

◆ TrimmedMeanOfSquares()

template<typename T >
double pcl::TrimmedMeanOfSquares ( const T *__restrict__  i,
const T *__restrict__  j,
distance_type  l = 1,
distance_type  h = 1 
)
inline

Computes the two-sided, asymmetric trimmed mean of squares of a sequence [i,j).

The returned value is the arithmetic mean of squares of a sequence [I+l,J-h-1], where [I,J) represents the input sequence [i,j) sorted in ascending order.

Let n = j-i be the length of the input sequence. For empty sequences (n ≤ 0) or completely truncated sequences (l+h >= n), this function returns zero. Otherwise the returned value is the arithmetic mean of the squared nonrejected n-l-h elements in the sorted sequence, as described above.

Definition at line 3319 of file Math.h.

Referenced by pcl::GenericMatrix< T >::TrimmedMeanOfSquares(), and pcl::GenericVector< T >::TrimmedMeanOfSquares().

◆ TrimmedMeanOfSquaresDestructive()

template<typename T >
double pcl::TrimmedMeanOfSquaresDestructive ( T *__restrict__  i,
T *__restrict__  j,
distance_type  l = 1,
distance_type  h = 1 
)
inlinenoexcept

Computes the two-sided, asymmetric trimmed mean of squares of a sequence [i,j), possibly altering the existing order of elements in the input sequence.

The returned value is the arithmetic mean of squares of a sequence [I+l,J-h-1], where [I,J) represents the input sequence [i,j) sorted in ascending order.

Let n = j-i be the length of the input sequence. For empty sequences (n ≤ 0) or completely truncated sequences (l+h >= n), this function returns zero. Otherwise the returned value is the arithmetic mean of the squared nonrejected n-l-h elements in the sorted sequence, as described above.

Note
This is a destructive trimmed mean of squares calculation algorithm: it may alter the existing order of items in the input [i,j) sequence.

Definition at line 3362 of file Math.h.

◆ TwoSidedAvgDev() [1/2]

template<typename T >
TwoSidedEstimate pcl::TwoSidedAvgDev ( const T *__restrict__  i,
const T *__restrict__  j 
)
inline

Returns the two-sided average absolute deviation from the median of the values in a sequence [i,j).

The average absolute deviation from the median is a well-known estimator of dispersion.

For sequences of less than two elements, this function returns zero.

See the remarks made for the Sum() function, which are equally applicable in this case. See StableAvgDev() for a (slow) numerically stable version of this function.

Note
To make the average absolute deviation about the median consistent with the standard deviation of a normal distribution, it must be multiplied by the constant 1.2533.

Definition at line 3758 of file Math.h.

◆ TwoSidedAvgDev() [2/2]

template<typename T >
TwoSidedEstimate pcl::TwoSidedAvgDev ( const T *__restrict__  i,
const T *__restrict__  j,
double  center 
)
inlinenoexcept

Returns the two-sided average absolute deviation of the values in a sequence [i,j) with respect to the specified center value.

When the median of the sequence is used as the center value, this function returns the average absolute deviation from the median, which is a well-known estimator of dispersion.

For sequences of less than two elements, this function returns zero.

See the remarks made for the Sum() function, which are equally applicable in this case. See StableAvgDev() for a (slow) numerically stable version of this function.

Note
To make the average absolute deviation about the median consistent with the standard deviation of a normal distribution, it must be multiplied by the constant 1.2533.

Definition at line 3717 of file Math.h.

Referenced by pcl::GenericMatrix< T >::TwoSidedAvgDev(), and pcl::GenericVector< T >::TwoSidedAvgDev().

◆ TwoSidedBiweightMidvariance()

template<typename T >
TwoSidedEstimate pcl::TwoSidedBiweightMidvariance ( const T *__restrict__  x,
const T *__restrict__  xn,
double  center,
const TwoSidedEstimate sigma,
int  k = 9,
bool  reducedLength = false 
)
noexcept

Returns a two-sided biweight midvariance (BWMV) for the elements in a sequence [x,xn).

Parameters
x,xnDefine a sequence of sample data points for which the two-sided BWMV estimator will be calculated.
centerReference center value. Normally, the median of the sample should be used.
sigmaA reference two-sided estimate of dispersion. Normally, the two-sided median absolute deviation from the median (MAD) of the sample should be used. See the TwoSidedMAD() function.
kRejection limit in sigma units. The default value is k=9.
reducedLengthIf true, reduce the sample size to exclude rejected elements. Size reduction is performed separately for the low and high halves of the data. This tends to approximate the true dispersion of the data more accurately for relatively small samples, or samples with large amounts of outliers. Note that this departs from the standard definition of biweight midvariance, where the total number of data items is used to scale the variance estimate. If false, use the full sample size, including rejected elements, which gives a standard biweight midvariance estimate.

See BiweightMidvariance() for more information and references.

Definition at line 4404 of file Math.h.

Referenced by pcl::GenericMatrix< T >::TwoSidedBiweightMidvariance(), and pcl::GenericVector< T >::TwoSidedBiweightMidvariance().

◆ TwoSidedMAD() [1/2]

template<typename T >
TwoSidedEstimate pcl::TwoSidedMAD ( const T *__restrict__  i,
const T *__restrict__  j 
)
inline

Returns the two-sided median absolute deviation from the median (MAD) for the values in a sequence [i,j).

The MAD is a well-known robust estimator of scale.

For sequences of less than two elements, this function returns zero.

Note
To make the MAD estimator consistent with the standard deviation of a normal distribution, its result must be multiplied by the constant 1.4826.

Definition at line 3888 of file Math.h.

◆ TwoSidedMAD() [2/2]

template<typename T >
TwoSidedEstimate pcl::TwoSidedMAD ( const T *__restrict__  i,
const T *__restrict__  j,
double  center 
)
inline

Returns the two-sided median absolute deviation (MAD) of the values in a sequence [i,j) with respect to the specified center value.

The MAD is a well-known robust estimator of scale.

For sequences of less than two elements, this function returns zero.

Note
To make the MAD estimator consistent with the standard deviation of a normal distribution, its result must be multiplied by the constant 1.4826.

Definition at line 3837 of file Math.h.

Referenced by pcl::GenericMatrix< T >::TwoSidedBiweightMidvariance(), pcl::GenericVector< T >::TwoSidedBiweightMidvariance(), pcl::GenericMatrix< T >::TwoSidedMAD(), and pcl::GenericVector< T >::TwoSidedMAD().

◆ Variance() [1/2]

template<typename T >
double pcl::Variance ( const T *__restrict__  i,
const T *__restrict__  j 
)
inlinenoexcept

Returns the variance from the mean of a sequence [i,j).

For sequences of less than two elements, this function returns zero.

This implementation uses a two-pass compensated summation algorithm to minimize roundoff errors (see References).

References

William H. Press et al., Numerical Recipes in C: The Art of Scientific Computing, Second Edition (1997 reprint) Cambridge University Press, page 613.

Definition at line 2785 of file Math.h.

◆ Variance() [2/2]

template<typename T >
double pcl::Variance ( const T *__restrict__  i,
const T *__restrict__  j,
double  center 
)
inlinenoexcept

Returns the variance of a sequence [i,j) with respect to the specified center value.

For sequences of less than two elements, this function returns zero.

This implementation uses a two-pass compensated summation algorithm to minimize roundoff errors (see the references).

References

William H. Press et al., Numerical Recipes in C: The Art of Scientific Computing, Second Edition (1997 reprint) Cambridge University Press, page 613.

Definition at line 2753 of file Math.h.

Referenced by pcl::ImageStatistics::Var(), pcl::GenericMatrix< T >::Variance(), and pcl::GenericVector< T >::Variance().