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

Method initialize

Extensions/QMapping/QMapping/QubitMapping.cpp:275–296  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

273}
274
275void 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
298QMappingConfig::QMappingConfig(const dmatrix_t& arch_matrix)
299{

Callers

nothing calls this directly

Calls 5

moveFunction · 0.85
putRegMethod · 0.80
rowsMethod · 0.45
colsMethod · 0.45
putEdgeMethod · 0.45

Tested by

no test coverage detected