You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from pytket.circuit import CircBox, Circuit, Bit, Qubit
from pytket.qasm import circuit_to_qasm_str
from pytket.passes import DecomposeBoxes
c_inner: Circuit = Circuit(4, 1)
cbox: CircBox = CircBox(Circuit(4).H(0).H(1).H(2).H(3).CX(0, 1).CX(1, 2).CX(2, 3))
c_inner.add_circbox(cbox, [Qubit(i) for i in range(4)], condition=Bit(0))
c_outer: Circuit = Circuit(4, 2)
c_outer.add_circbox(CircBox(c_inner), c_inner.qubits + c_inner.bits, condition=Bit(1))
DecomposeBoxes().apply(c_outer)
print(circuit_to_qasm_str(c_outer, header="hqslib1"))
This code gives an error as c_outer still has a CircBox internally. Printing the circuit commands will give IF ([c[1]] == 1) THEN IF ([c[0]] == 1) THEN CircBox q[0], q[1], q[2], q[3];.
The text was updated successfully, but these errors were encountered:
Alternatively, applying auto_rebase_pass({OpType.ZZPhase, OpType.PhasedX, OpType.Rz}).apply(c_outer) to the circuit throws a BadOpType error, complaining about a conditional operation.
I have a fix for the DecomposeBoxes issue (PR coming soon), but even after the fix it doesn't seem possible to convert to QASM. I've created a separate issue for this ( #1745 ).
EDIT: Turns out nested conditionals are just not supported by QASM at all.
I have a fix for the DecomposeBoxes issue (PR coming soon), but even after the fix it doesn't seem possible to convert to QASM. I've created a separate issue for this ( #1745 ).
EDIT: Turns out nested conditionals are just not supported by QASM at all.
If they aren't supported then it sounds like we can close this issue once #1746 is merged?
See:
This code gives an error as
c_outer
still has aCircBox
internally. Printing the circuit commands will giveIF ([c[1]] == 1) THEN IF ([c[0]] == 1) THEN CircBox q[0], q[1], q[2], q[3];
.The text was updated successfully, but these errors were encountered: