MCPcopy Create free account
hub / github.com/OriginQ/QPanda-2 / exec

Method exec

Core/Utilities/Tools/QuantumStateTomography.cpp:72–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70
71
72std::vector<QStat> QuantumStateTomography::exec(QuantumMachine *qm, size_t shots)
73{
74 m_prog_results.clear();
75 m_prog_results.reserve(m_combine_progs.size());
76
77 for (auto &prog : m_combine_progs)
78 {
79 auto result_count = qm->runWithConfiguration(prog, m_clist, shots);
80 map<std::string, double> result_prob;
81 for (auto &item : result_count)
82 {
83 result_prob.insert({ item.first, static_cast<double>(item.second) / shots });
84 }
85
86 m_prog_results.push_back(result_prob);
87 }
88 return caculate_tomography_density();
89}
90
91
92void QuantumStateTomography::set_qprog_results(size_t opt_num, const std::vector<std::map<std::string, double>>& results)

Callers

nothing calls this directly

Calls 6

clearMethod · 0.45
reserveMethod · 0.45
sizeMethod · 0.45
runWithConfigurationMethod · 0.45
insertMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected