PCL
Selection Algorithms

Functions

template<class RI >
RI pcl::Select (RI i, RI j, distance_type k)
 
template<class RI , class BP >
RI pcl::Select (RI i, RI j, distance_type k, BP p)
 

Detailed Description

Function Documentation

◆ Select() [1/2]

template<class RI >
RI pcl::Select ( RI  i,
RI  j,
distance_type  k 
)
inline

Generic quick selection algorithm.

Given a range defined by two random access iterators [i,j) and a distance k, such that j-i > k, returns an iterator t whose associated value is the k-th element in the sorted sequence [i,j) in ascending order.

For example, the following call:

t = Select( i, j, (j - i) >> 1 );

will return the median of the distribution of elements in the [i,j) sequence: the central value for which the probabilities that a greater and a lesser element exist are equal.

References

  • 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.
Warning
This function performs a destructive selection search: There is no guarantee that the existing order of elements in the [i,j) sequence is preserved after calling this function.

Definition at line 165 of file Selection.h.

References pcl::ItemType().

Referenced by pcl::GenericVector< sample *>::OrderStatistic(), and pcl::TreeBox::Node::Unselect().

◆ Select() [2/2]

template<class RI , class BP >
RI pcl::Select ( RI  i,
RI  j,
distance_type  k,
BP  p 
)
inline

Generic quick selection algorithm.

Given a range defined by two random access iterators [i,j) and a distance k, such that j-i > k, returns an iterator t whose associated value is the k-th element in the sorted sequence [i,j) in ascending order. 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 Select( RI, RI, distance_type ) for more information.

Definition at line 238 of file Selection.h.

References pcl::ItemType().