| 273 | } |
| 274 | |
| 275 | void QMappingConfig::initialize(const dmatrix_t& arch_matrix) |
| 276 | { |
| 277 | const uint32_t qubits = arch_matrix.rows(); |
| 278 | |
| 279 | auto graph = ArchGraph::Create(qubits); |
| 280 | |
| 281 | std::string name = "quantum_chip"; |
| 282 | graph->putReg(name, std::to_string(qubits)); |
| 283 | |
| 284 | for (int i = 0; i < arch_matrix.cols(); ++i) |
| 285 | { |
| 286 | for (int j = 0; j < arch_matrix.rows(); ++j) |
| 287 | { |
| 288 | double weight = arch_matrix(i, j); |
| 289 | |
| 290 | if (weight > (0.0 + 1e-6) && weight <= (1.0 + 1e-6)) |
| 291 | graph->putEdge(i, j, weight); |
| 292 | } |
| 293 | } |
| 294 | |
| 295 | m_arch_ptr = std::move(graph); |
| 296 | } |
| 297 | |
| 298 | QMappingConfig::QMappingConfig(const dmatrix_t& arch_matrix) |
| 299 | { |