Skip to content

Commit 8077ff5

Browse files
authored
Bugfix/greedy pauli simp ignores the qubit permutation of the original circuit (#2072)
* Fix GreedyPauliSimp ignoring implicit qubit permutation * Update changelog * Bump tket version --------- Co-authored-by: yao-cqc <yao.tang@quantinuum.com>
1 parent 3af04af commit 8077ff5

4 files changed

Lines changed: 12 additions & 1 deletion

File tree

‎TKET_VERSION‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.1.63
1+
2.1.64

‎pytket/docs/changelog.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Unreleased
44

55
- Fix segfault from `Circuit::get_resources()` with 0-qubit gates.
6+
- Fix `GreedyPauliSimp` ignoring implicit qubit permutation.
67

78
## 2.10.3 (October 2025)
89

‎tket/src/Transformations/GreedyPauliOptimisation.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,7 @@ Circuit greedy_pauli_graph_synthesis_flag(
751751
throw GreedyPauliSimpError("max_tqe_candidates must be greater than 0.");
752752
}
753753
Circuit circ_flat(circ);
754+
circ_flat.replace_all_implicit_wire_swaps();
754755
unsigned n_qubits = circ_flat.n_qubits();
755756
unsigned n_bits = circ_flat.n_bits();
756757
// empty circuit

‎tket/test/src/test_GreedyPauli.cpp‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,15 @@ SCENARIO("Clifford synthesis") {
142142
}
143143
}
144144
SCENARIO("Complete synthesis") {
145+
GIVEN("Qubit permutation circuit") {
146+
Circuit circ(3);
147+
circ.add_op<unsigned>(OpType::SWAP, {0, 1});
148+
circ.add_op<unsigned>(OpType::SWAP, {1, 2});
149+
circ.replace_SWAPs();
150+
Circuit d(circ);
151+
REQUIRE(Transforms::greedy_pauli_optimisation().apply(d));
152+
REQUIRE(test_unitary_comparison(circ, d, true));
153+
}
145154
GIVEN("1Q Simple Circuit") {
146155
Circuit circ(1);
147156
circ.add_op<unsigned>(OpType::Sdg, {0});

0 commit comments

Comments
 (0)