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

Method try_retrieve_result

runtime/common/SampleResult.cpp:256–270  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

254}
255
256std::pair<bool, const ExecutionResult &>
257sample_result::try_retrieve_result(const std::string &registerName) const {
258 auto iter = sampleResults.find(registerName);
259 if (iter == sampleResults.end()) {
260 auto invalid_char = registerName.find_first_not_of("XYZI");
261 if (invalid_char == std::string::npos) {
262 auto spin = spin_op::from_word(registerName);
263 iter = sampleResults.find(spin.canonicalize().get_term_id());
264 if (iter != sampleResults.end())
265 return {true, iter->second};
266 }
267 return {false, ExecutionResult()};
268 }
269 return {true, iter->second};
270}
271
272const cudaq::ExecutionResult &
273sample_result::retrieve_result(const std::string &registerName) const {

Callers

nothing calls this directly

Calls 4

ExecutionResultClass · 0.85
get_term_idMethod · 0.80
endMethod · 0.45
canonicalizeMethod · 0.45

Tested by

no test coverage detected