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

circuit_to_qasm_str proposed enhancement #1545

Open
IlanIwumbwe opened this issue Aug 20, 2024 · 0 comments
Open

circuit_to_qasm_str proposed enhancement #1545

IlanIwumbwe opened this issue Aug 20, 2024 · 0 comments

Comments

@IlanIwumbwe
Copy link

Benny and I found this by running a randomly generated circuit through the pytket circuit_to_qasm_str function.

When we run this circuit:

Z_op = Op.create(OpType.Z)
H_op = Op.create(OpType.H)
U2_op = Op.create(OpType.U2, [-0.64, 0.86])
H_op = Op.create(OpType.H)
op_map = {(0,0,):Z_op,(0,1,):H_op,(1,0,):U2_op,(1,1,):H_op}
multiplexor = MultiplexorBox(op_map)

main_circ = Circuit(0, 2, "main_circ")

qreg_0 = main_circ.add_q_register("qreg_0",3)
qbit_3 = Qubit("qbit_3", 0)
main_circ.add_qubit(qbit_3)

creg_0 = main_circ.add_c_register("creg_0",4)

main_circ.add_gate(multiplexor,[qreg_0[0], qreg_0[1], qbit_3])

We get:

raise QASMUnsupportedError(
pytket.qasm.qasm.QASMUnsupportedError: Cannot print command of type: CnZ

A user might be confused by this if they didn't explicitly add CnZ gates into their circuit. After tracking down the root cause we saw that CnZ and CnY gates aren't supported here. These gates come from using Z or Y gates inside a multiplexor with more than 2 states. We feel that an Error message to that effect, perhaps here, would allow the user to debug this much faster.

@IlanIwumbwe IlanIwumbwe changed the title 'circuit_to_qasm_str' proposed enhancement circuit_to_qasm_str proposed enhancement Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant