amazon-braket / amazon-braket/BraketSimulator.jl
Missing Conditional Instructions After Parsing with Quasar
- Lingua principale
- Julia
- Stelle
- 16
- Fork
- 7
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
**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**
1. Create a quantum circuit using OpenQASM 3.0 with the following code:
```qasm
OPENQASM 3.0;
bit[2] b;
qubit[3] q;
h q[1];
b[0] = measure q[1];
if (b[0]) {
x q[0];
}
```
2. Parse the circuit using the BraketSimulator:
```python
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];
}
""")
```
3. 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.
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.