qiboteam / qibo

A framework for quantum computing
https://qibo.science
Apache License 2.0
287 stars 58 forks source link

Transpiler moving measurements on wrong qubit #1363

Closed BrunoLiegiBastonLiegi closed 3 months ago

BrunoLiegiBastonLiegi commented 3 months ago

I am testing GST #1106 with the transpiler and I see that sometimes the measurements get messed up. For instance, given this input circuit:

q0: ─I─H─M─

and trying to transpile it with the following pipeline:

    # define transpiler
    connectivity = nx.Graph()
    # star connectivity
    connectivity.add_edges_from([(0, 2), (1, 2), (2, 3), (2, 4)])
    transpiler = Passes(
        connectivity=connectivity,
        passes=[
            Preprocessing(connectivity),
            Random(connectivity),
            Sabre(connectivity),
            Unroller(NativeGates.default()),
        ],
        int_qubit_names=True,
    )

results in this transpiled circuit:

q0: ──────────
q2: ─M────────
q1: ─I─Z─GPI2─
q3: ──────────
q4: ──────────