Module indxvec::merge[][src]

Functions

binsearch

Returns the index of the first item that is greater than val, using binary search of an already ascending sorted list. When all are smaller, returns self.len(). When the last item is equal, returns self.len()-1. Example use: looking up cummulative probability density functions.

merge

Merges two ascending sorted generic vectors, by classical selection and copying of their head items into the result. Consider using merge_indexed instead, especially for non-primitive end types T.

merge_indexed

Merges two ascending sort indices. Data is not shuffled at all, v2 is just concatenated onto v1 in one go and both remain in their original order. Returns the concatenated vector and a new valid sort index into it.

rank

Ranking by inverting the sort index.
Sort index is in sorted order, giving indices to the original data positions. Ranking is in original data order, giving positions in the sorted order (sort index). Thus they are in an inverse relationship, easily converted by .invindex() Fast ranking of many T items, with only n*(log(n)+1) complexity.

revs

New reversed generic vector

sortidx

A simple wrapper for mergesort, when we want just the sort index of the entire input vector.

sortm

Immutable sort. Returns new sorted vector (ascending or descending) Simple wrapper for mergesort. Passes the boolean flag ‘ascending’ onto ‘unindex’.