diff --git a/CHANGELOG.md b/CHANGELOG.md index f4da67b91..a5c9b5468 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,8 @@ _If you are upgrading: please see [`UPGRADING.md`](UPGRADING.md#unreleased)._ ### Fixed +- 🐛 Preserve the input circuit name during mapping ([#1154]) + ([**@burgholzer**]) - 🐛 Handle Qiskit targets without calibration properties ([#1152]) ([**@burgholzer**]) @@ -304,6 +306,7 @@ _📚 Refer to the [GitHub Release Notes] for previous changelogs._ +[#1154]: https://github.com/munich-quantum-toolkit/qmap/pull/1154 [#1152]: https://github.com/munich-quantum-toolkit/qmap/pull/1152 [#1126]: https://github.com/munich-quantum-toolkit/qmap/pull/1126 [#1116]: https://github.com/munich-quantum-toolkit/qmap/pull/1116 diff --git a/src/sc/Mapper.cpp b/src/sc/Mapper.cpp index 34e2e131f..23f46c8e9 100644 --- a/src/sc/Mapper.cpp +++ b/src/sc/Mapper.cpp @@ -55,6 +55,7 @@ void Mapper::initResults() { results.output.name = qc.getName() + "_mapped"; results.output.qubits = architecture->getNqubits(); results.output.gates = std::numeric_limits::max(); + qcMapped.setName(qc.getName()); qcMapped.addQubitRegister(architecture->getNqubits()); } diff --git a/test/python/sc/test_compile.py b/test/python/sc/test_compile.py index e7b998f00..05d98cb23 100644 --- a/test/python/sc/test_compile.py +++ b/test/python/sc/test_compile.py @@ -50,6 +50,15 @@ def test_either_arch_or_calibration(example_circuit: QuantumCircuit) -> None: compile_(example_circuit, arch=None, calibration=None) +def test_circuit_name_is_preserved(example_circuit: QuantumCircuit) -> None: + """Test that mapping preserves the input circuit name.""" + example_circuit.name = "my_bell_chain" + + mapped, _ = compile_(example_circuit, arch=Arch.IBM_QX4, method=Method.exact) + + assert mapped.name == example_circuit.name + + # test that all available architecture enumerations can be properly used @pytest.mark.parametrize( "arch",