| 324 | } |
| 325 | |
| 326 | double sample_result::probability(std::string_view bitStr, |
| 327 | const std::string_view registerName) const { |
| 328 | const auto &result = retrieve_result(registerName.data()); |
| 329 | const auto countIter = result.counts.find(bitStr.data()); |
| 330 | return (countIter == result.counts.end()) |
| 331 | ? 0.0 |
| 332 | : (double)countIter->second / totalShots; |
| 333 | } |
| 334 | |
| 335 | std::size_t sample_result::count(std::string_view bitStr, |
| 336 | const std::string_view registerName) const { |