Last active
August 29, 2015 14:23
-
-
Save bluescarni/1230a547cbabc31147ec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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