33radixSortKeysAndValues(KeyType* keys, KeyType* keysAux, ValueType* values, ValueType* valuesAux, IndexType n, IndexType upperBound) {
39 IndexType maskPos = 0;
41 IndexType sortBits = 0;
46 for (IndexType s = 0; s < (sortBits + 3) / 4; s++) {
48 IndexType count[16] = {0};
49 IndexType offset[17] = {0};
51 for (IndexType i = 0; i < n; i++) {
52 count[(keys[i] & mask) >> maskPos]++;
55 for (IndexType i = 0; i < n; i++) {
56 count[(keysAux[i] & mask) >> maskPos]++;
60 for (IndexType i = 0; i < 16; i++) {
61 offset[i + 1] = offset[i] + count[i];
67 for (IndexType i = 0; i < n; i++) {
68 IndexType bucket = (keys[i] & mask) >> maskPos;
69 keysAux[offset[bucket + 1] - count[bucket]] = keys[i];
70 valuesAux[offset[bucket + 1] - count[bucket]] = values[i];
75 for (IndexType i = 0; i < n; i++) {
76 IndexType bucket = (keysAux[i] & mask) >> maskPos;
77 keys[offset[bucket + 1] - count[bucket]] = keysAux[i];
78 values[offset[bucket + 1] - count[bucket]] = valuesAux[i];
88 for (IndexType i = 0; i < n; i++) {
90 values[i] = valuesAux[i];
KOKKOS_INLINE_FUNCTION void radixSortKeysAndValues(KeyType *keys, KeyType *keysAux, ValueType *values, ValueType *valuesAux, IndexType n, IndexType upperBound)
Radix sort the input array keys, and permute values identically to the keys.