Describe the bug
After parsing a quantum circuit written in OpenQASM 3.0 using the BraketSimulator, the conditional instructions (specifically the if statement and the x gate) are not included in the created circuit. The output only reflects the Hadamard gate and the measurement, omitting the expected conditional operation.
To reproduce
Create a quantum circuit using OpenQASM 3.0 with the following code:
OPENQASM 3.0;
bit[2] b;
qubit[3] q;
h q[1];
b[0] = measure q[1];
if (b[0]) {
x q[0];
}
Parse the circuit using the BraketSimulator:
circuit3 = BraketSimulator.Circuit("""
OPENQASM 3.0;
bit[2] b;
qubit[3] q;
h q[1];
b[0] = measure q[1];
if (b[0]) {
x q[0];
}
""")
Inspect the created circuit.
Expected behavior
The expected behavior is that the created circuit should include all instructions, including the Hadamard gate, the measurement, and the conditional x gate based on the measurement result. The output should reflect all operations specified in the OpenQASM code.
Screenshots or logs
The output of the created circuit is as follows:
This output does not mention the x gate or the conditional instruction.
System information
Braket SDK Version: Main Branch
Additional context
This issue may affect the ability to implement conditional logic in quantum circuits using the BraketSimulator, which is crucial for many quantum algorithms. Further investigation is needed to determine if this is a limitation of the parser or the simulator's handling of conditional instructions.
Yes, unfortunately we don't (yet) have support for this kind of operation, only for purely classical values that are known at circuit-instantiation time. This should be coming with mid-circuit measurement support.
Describe the bug After parsing a quantum circuit written in OpenQASM 3.0 using the BraketSimulator, the conditional instructions (specifically the
if
statement and thex
gate) are not included in the created circuit. The output only reflects the Hadamard gate and the measurement, omitting the expected conditional operation.To reproduce
Expected behavior The expected behavior is that the created circuit should include all instructions, including the Hadamard gate, the measurement, and the conditional
x
gate based on the measurement result. The output should reflect all operations specified in the OpenQASM code.Screenshots or logs The output of the created circuit is as follows:
This output does not mention the
x
gate or the conditional instruction.System information
Additional context This issue may affect the ability to implement conditional logic in quantum circuits using the BraketSimulator, which is crucial for many quantum algorithms. Further investigation is needed to determine if this is a limitation of the parser or the simulator's handling of conditional instructions.