CQCL/pytket-docs

Incorrect output in manual compilation section

cqc-alec opened this issue · 1 comments

In this section:
https://cqcl.github.io/pytket/manual/manual_compiler.html#predefined-sequences

The code snippet ends with:

    SynthesiseIBM().apply(circ)             # Some added gates were redundant
    print(circ.n_gates_of_type(OpType.CX))

And the output is shown as 7. In fact the output is 9, so the SynthesiseIBM pass didn't remove any CX gates.

Presumably in some older version of pytket it did, so it would be worth investigating when this changed and why.

Turns out this was caused by a "refactoring" that took place between versions 0.9 and 0.10 of pytket which meant that some SWAP gates introduced by routing had the qubits in the other order, and so the decomposition into CX gates was different. Unfortunately this prevented a CX cancellation from taking place.

We should try to make the passes detect this case.