bempp_octree::tools

Function sort_to_bins

Source
pub fn sort_to_bins<T: Ord>(sorted_keys: &[T], bins: &[T]) -> Vec<usize>
Expand description

Distribute a sorted sequence into bins.

For an array with n elements to be distributed into p bins, the array bins has p elements. The bins are defined by half-open intervals of the form [b_j, b_{j+1})). The final bin is the half-open interval [b_{p-1}, \infty). It is assumed that the bins and the elements are both sorted sequences and that every element has an associated bin. The function returns a p element array with the counts of how many elements go to each bin. Since the sequence is sorted this fully defines what element goes into which bin.