Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
const hash_set::iterator begin = B.begin(), end = B.end();
for (auto &a: A) {
for (hash_set::iterator it = begin; it != end; ++it) {
temp.first = a.first + it->first;
size_t bucket = C._bucket(temp);
auto it = C._find(temp, bucket);
if (it == C.end()) {
// Check it the load factor of C is too large.
if ((double(C.size()) + 1) / C.bucket_count() > C.max_load_factor()) {
// Increase the size of the table.
container._increase_size();
// Recompute the bucker.
bucket = C._bucket(temp);
}
temp.second = a.second * it->second;
C._unique_insert(temp, bucket);
C._update_size(C.size() + 1u);
} else {
piranha::math::multiply_accumulate(it->second,a.second,it->second);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.