【发布时间】:2019-05-14 08:03:25
【问题描述】:
我有一个包含 0 到 X 个数字和高整数值的 hashSet。
0:1000000001
1:1000000002
...
和位置向量 (22,14,29,59,10)。
我需要生成这个向量的所有组合。
为此,我使用来自https://github.com/mraggi/discreture 的库进行生成。我得到了矢量大小和 need_comb_size 的所有组合
如 (10,3)
0,1,2
0,1,3
...
现在我将生成的组合与我的向量位置和 hashSet 链接起来 hashSet[vect[comb[0]]+...
我可以在一行中使用这个reduce吗?
目标是生成一个高整数(散列)并使用此散列作为键,并将我在梳状示例中的位置:(12,59,11) 作为值。
3423422821 : 向量 ((12,59,11)
void combination(int size, vector<unsigned short> chunk, vector<unsigned long long> hashSet, unordered_map<unsigned long long, pair<vector<unsigned short>, vector<unsigned short>>> collision_map, unsigned long long low, unsigned long long high, int dimension) {
for (auto&& comb : discreture::combinations_stack(size,KCOMB))
{
unsigned long long signature = 0;
vector<unsigned short> newChunk;
//signature = reduce(std::execution::par, comb.begin(), comb.end())
for (auto v : comb) {
signature += hashSet.at(chunk.at(v));
newChunk.push_back(chunk.at(v));
}
checkSignature(low, high, signature, collision_map, newChunk, dimension);
}
}
【问题讨论】: