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

fix: setting type of array length to const int in OQ3 example #644

Merged
merged 1 commit into from
Dec 2, 2024

Conversation

peterkomar-aws
Copy link
Contributor

Issue
In https://github.com/amazon-braket/amazon-braket-examples/blob/main/examples/braket_features/Getting_Started_with_OpenQASM_on_Braket.ipynb -- first of "Advanced OpenQASM features", the

int[32] n = 5;
bit[n + 1] c;
qubit[n + 1] q;

is invalid OpenQASM. n should be a const

Ref: https://openqasm.com/language/types.html#arrays citation for this (look for the Note: "Note that bit, bit[n] and stretch are not valid array base types, nor are any quantum types.")

Description of changes:

Following the example here: https://openqasm.com/language/types.html#qubits, I made the change

int[32] n = 5; -> const int[32] n = 5; in code cell 39 of https://github.com/amazon-braket/amazon-braket-examples/blob/main/examples/braket_features/Getting_Started_with_OpenQASM_on_Braket.ipynb

I also verified that the cell, and the next run correctly.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@peterkomar-aws peterkomar-aws requested a review from a team as a code owner November 29, 2024 17:36
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@peterkomar-aws peterkomar-aws merged commit a81bf1a into main Dec 2, 2024
9 checks passed
@peterkomar-aws peterkomar-aws deleted the fix-OQ3-advanced-example branch December 2, 2024 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants