| 63 | } |
| 64 | |
| 65 | void CountNodes(const vec_int_t& nodes, const vec_pair_t& distribution, |
| 66 | index_map_t* node_count_map) { |
| 67 | node_count_map->clear(); |
| 68 | node_count_map->reserve(distribution.size()); |
| 69 | for (const auto& pair : distribution) { |
| 70 | node_count_map->emplace(pair.first, 0); |
| 71 | } |
| 72 | |
| 73 | for (auto node : nodes) { |
| 74 | auto it = node_count_map->find(node); |
| 75 | if (it != node_count_map->end()) { |
| 76 | it->second += 1; |
| 77 | } |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | // Let Phi(Z_a) be the CDF of the variable x. Find the smallest Z_{a/2}, such |
| 82 | // that Phi(Z_{a/2}) >= 1 - a/2. |