MCPcopy Create free account
hub / github.com/NVIDIA/cuda-quantum / probability

Method probability

runtime/common/SampleResult.cpp:326–333  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

324}
325
326double 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
335std::size_t sample_result::count(std::string_view bitStr,
336 const std::string_view registerName) const {

Calls 2

dataMethod · 0.45
endMethod · 0.45