Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unroller duplicates gates when measuring in specific basis #1318

Closed
andrea-pasquale opened this issue May 1, 2024 · 2 comments · Fixed by #1369
Closed

Unroller duplicates gates when measuring in specific basis #1318

andrea-pasquale opened this issue May 1, 2024 · 2 comments · Fixed by #1369
Assignees
Labels
bug Something isn't working transpiler
Milestone

Comments

@andrea-pasquale
Copy link
Contributor

andrea-pasquale commented May 1, 2024

When applying a measurement there is the possibility to specify in which basis we want to perform the measurement using the basis argument.

However, when such circuit is transpiled the "rotation gate" appears twice and only once it is correctly transpiled.
Here is an example:

from qibo import Circuit, gates
from qibo.transpiler.unroller import NativeGates, Unroller

unroller = Unroller(native_gates=NativeGates.default())

nqubits = 2
circuit = Circuit(nqubits)
circuit.add(gates.M(i, basis=gates.X) for i in range(nqubits))

print(circuit.draw())
# which gives
# q0: ─H─M─
# q1: ─H─M─
transpiled_circuit = unroller(circuit)
print(transpiled_circuit.draw())
# which gives
# q0: ─Z─GPI2─H─M─
# q1: ─Z─GPI2─H─M─

In the transpiled circuit H appears twice, once it is compiled into natives as Z and GPI2 while the second times appears as H which will trigger an error since it is not a native gate.
@Edoardo-Pedicillo I believe that this is not related to PRs that you recently open since I am using master.

@andrea-pasquale andrea-pasquale added bug Something isn't working transpiler labels May 1, 2024
@Edoardo-Pedicillo
Copy link
Contributor

@Edoardo-Pedicillo I believe that this is not related to PRs that you recently open since I am using master.

I confirm it is not related

@Simone-Bordoni Simone-Bordoni self-assigned this May 6, 2024
@Simone-Bordoni
Copy link
Contributor

I will have a closer look in the next days, i think it should be an easy fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working transpiler
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants