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

Missing Conditional Instructions After Parsing with Quasar #47

Open
contra-bit opened this issue Aug 24, 2024 · 0 comments
Open

Missing Conditional Instructions After Parsing with Quasar #47

contra-bit opened this issue Aug 24, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@contra-bit
Copy link

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:
    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:
    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:
Firefox_Screenshot_2024-08-24T15-56-03 230Z

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.

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

No branches or pull requests

1 participant