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

Lack of Guidance on Implementing Classical Controlled Instructions in Braket Using OpenQASM 3 #101

Open
contra-bit opened this issue Aug 24, 2024 · 4 comments
Labels
documentation Improvements or additions to documentation

Comments

@contra-bit
Copy link

contra-bit commented Aug 24, 2024

What did you find confusing? Please describe.
I tried to implement classical controlled instructions in Braket. However, I didn't understand how to properly create and utilize classical control structures within the Braket framework, as the documentation does not provide clear examples or guidance on this topic.

Describe how documentation can be improved
The documentation could be improved by including specific examples of classical controlled instructions in Braket, particularly focusing on how to implement if-else statements similar to the OpenQASM 3 example provided. It would be helpful to have a dedicated section that explains the syntax and semantics of classical control structures, along with practical examples that demonstrate their usage in quantum circuits.

Additional context
I am trying to achieve the following code in OpenQASM 3.0:

OPENQASM 3.0;
bit[2] b;
qubit[3] q;
h q[1];
b[0] = measure q[1];
if (b[0]) {
  x q[0];
}

However, I am unsure how to translate this logic into the Braket environment. Any guidance or examples would be greatly appreciated.

This is related to this issue

Relevant Qiskit Tutorial on Classical feedforward and control flow

@contra-bit contra-bit added the documentation Improvements or additions to documentation label Aug 24, 2024
@speller26
Copy link
Member

speller26 commented Oct 28, 2024

At the moment, we don't support classical controlled instructions; we do support them in autoqasm, which provides a Python-native syntax for expressing programs, but note that this is currently an experimental library.

@rmshaffer
Copy link
Contributor

rmshaffer commented Oct 30, 2024

To add to @speller26's response, here's an example notebook showing how this would be done in AutoQASM. (But as @speller26 says, the Braket service itself does not support such instructions yet.)

@Lung-Yi
Copy link

Lung-Yi commented Oct 30, 2024

@rmshaffer Hi sir, I want to add a question, does the real quantum device (any backend) on AWS support the classical control flow by AutoQASM? Thanks!

@rmshaffer
Copy link
Contributor

@Lung-Yi No, the devices currently available through Braket do not support classical control flow based on measurement results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

4 participants