MCPcopy Create free account
hub / github.com/apache/arrow / ArgSort

Function ArgSort

cpp/src/arrow/util/sort_internal.h:31–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29
30template <typename T, typename Cmp = std::less<T>>
31std::vector<int64_t> ArgSort(const std::vector<T>& values, Cmp&& cmp = {}) {
32 std::vector<int64_t> indices(values.size());
33 std::iota(indices.begin(), indices.end(), 0);
34 std::sort(indices.begin(), indices.end(),
35 [&](int64_t i, int64_t j) -> bool { return cmp(values[i], values[j]); });
36 return indices;
37}
38
39template <typename T>
40size_t Permute(const std::vector<int64_t>& indices, std::vector<T>* values) {

Callers 5

ConvertMethod · 0.85
ExpectSortPermutationFunction · 0.85
sorted_pairsMethod · 0.85
EqualsMethod · 0.85
FromTensorMethod · 0.85

Calls 3

sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by 1

ExpectSortPermutationFunction · 0.68