| 70 | |
| 71 | |
| 72 | std::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 | |
| 92 | void QuantumStateTomography::set_qprog_results(size_t opt_num, const std::vector<std::map<std::string, double>>& results) |