MCPcopy Create free account
hub / github.com/Derious/cuMPC / selectPivots

Function selectPivots

test/test_CORE/test_topk.cpp:13–19  ·  view source on GitHub ↗

随机选择 pivots

Source from the content-addressed store, hash-verified

11
12// 随机选择 pivots
13std::vector<int> selectPivots(const std::vector<int>& arr, int numPivots) {
14 std::vector<int> pivots;
15 // std::sample(arr.begin(), arr.end(), std::back_inserter(pivots), numPivots, rng);
16 pivots.insert(pivots.end(), arr.end()-numPivots, arr.end());
17 std::sort(pivots.begin(), pivots.end()); // 按顺序排列 pivots
18 return pivots;
19}
20
21// 分区函数:根据 pivots 将数组分成多个区块
22std::vector<std::vector<int>> partition(const std::vector<int>& arr, const std::vector<int>& pivots) {

Callers 2

topKSelectionFunction · 0.85
TopKselectionFunction · 0.85

Calls 3

insertMethod · 0.45
endMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected