warp.utils.radix_sort_pairs#

warp.utils.radix_sort_pairs(keys, values, count, begin_bit=0, end_bit=None)[source]#

Sort key-value pairs using radix sort.

This function sorts pairs of arrays based on the keys array, maintaining the key-value relationship. The sort is stable and operates in linear time. The keys and values arrays must be large enough to accommodate 2*`count` elements.

Parameters:
  • keys (array) – Array of keys to sort. Must be of type int32, uint32, float32, int64, uint64, or float64.

  • values (array) – Array of values to sort along with keys. Elements must be 4 or 8 bytes wide.

  • count (int) – Number of elements to sort.

  • begin_bit (int) – The least-significant key bit to start sorting from.

  • end_bit (int | None) – The key bit to stop sorting at. If None, sorts through the full key width.

Raises:

RuntimeError – If array storage devices don’t match, if storage size is insufficient, or if data types are unsupported.

Return type:

None