warp.utils.segmented_sort_pairs#
- warp.utils.segmented_sort_pairs(
- keys,
- values,
- count,
- segment_start_indices,
- segment_end_indices=None,
Sort key-value pairs within segments.
This function performs a segmented sort of key-value pairs, where the sorting is done independently within each segment. The segments are defined by their start and optionally end indices. The keys and values arrays must be large enough to accommodate 2*`count` elements.
- Parameters:
keys – Array of keys to sort. Must be of type int32 or float32.
values – Array of values to sort along with keys. Must be of type int32.
count (int) – Number of elements to sort.
segment_start_indices (array(ndim=1, dtype=int32)) – Array containing start index of each segment. Must be of type int32. If segment_end_indices is None, this array must have length at least num_segments + 1, and segment_end_indices will be inferred as segment_start_indices[1:]. If segment_end_indices is provided, this array must have length at least num_segments.
segment_end_indices (array(ndim=1, dtype=int32)) – Optional array containing end index of each segment. Must be of type int32 if provided. If None, segment_end_indices will be inferred from segment_start_indices[1:]. If provided, must have length at least num_segments.
- Raises:
RuntimeError – If array storage devices don’t match, if storage size is insufficient, if segment_start_indices is not of type int32, or if data types are unsupported.