-
Notifications
You must be signed in to change notification settings - Fork 672
Simple OpenQASM 3.0 expressions and casts #7593
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
Merged
Merged
Changes from all commits
Commits
Show all changes
342 commits
Select commit
Hold shift + click to select a range
8cbb4e8
Clearer NameError message for undeclared vars
comp-phys-marc 492e1b2
pylint
comp-phys-marc 314185d
pylint
comp-phys-marc 267ac8f
Assert instead of raise on bad modifiers
comp-phys-marc b3a7dc1
Use an update rather than setting each val in context init
comp-phys-marc 545ff3a
Remove spy from tests
comp-phys-marc 4f44322
Merge remote-tracking branch 'origin/feature/rebased-simple-gates-can…
comp-phys-marc 64fd014
Merge branch 'master' into feature/rebased-simple-gates-can-be-executed
comp-phys-marc 3bd7808
Import ops
comp-phys-marc e280871
Repr qubits using names not ints
comp-phys-marc e459523
Run formatter
comp-phys-marc 2ef8a2c
Use getattr to dispatch handlers
comp-phys-marc 85ef639
Run formatter
comp-phys-marc bfac0fa
PR feedback
comp-phys-marc c7d9a93
Support end statements
comp-phys-marc e7baeeb
Trigger CI
comp-phys-marc 61436fd
Variables
comp-phys-marc 031eb57
Variable declarations, assignments, retrievals
comp-phys-marc aa7236c
[WIP] remove pre-compute
comp-phys-marc cdfde44
Update docs, tests
comp-phys-marc b6b374b
Run formatter
comp-phys-marc 4dad404
Use functools.singledispatchmethod instead of getattr to dispatch han…
comp-phys-marc cd1e498
Run formatter
comp-phys-marc 2b4ed11
Remove unecessary condition
comp-phys-marc 09e2497
Revert change
comp-phys-marc 23809b8
Adopt suggestion to compute number of control wires
comp-phys-marc 3c72546
Add support for qubit mappings provided by user
comp-phys-marc a4e755e
Add integer qubit mapping test
comp-phys-marc 5599e8d
Support end statements
comp-phys-marc 7c5f143
Merge remote-tracking branch 'origin/feature/end-statements' into fea…
comp-phys-marc fccaf9c
Remove try / catch on import per feedback
comp-phys-marc 243083b
Support nested modifiers
comp-phys-marc bf6d549
Multiple examples of nested mods working
comp-phys-marc 365a13e
More examples in test of nested mods
comp-phys-marc a0e45bd
Qubit label consistency in docs
comp-phys-marc d3fb7e0
Remove branch from from_qasm3
comp-phys-marc ea82c08
Run formatter
comp-phys-marc 7144a5d
No longer inherrit from QASMVisitor
comp-phys-marc a82c789
Merge branch 'master' into feature/no-pre-compute
comp-phys-marc b400a98
pylint
comp-phys-marc 46ce06e
pylint
comp-phys-marc 6922c4c
Debug pylint
comp-phys-marc de6b9fc
Add support for negctrl
comp-phys-marc 6c69441
Run formatter
comp-phys-marc e6ec23f
Update docstring
comp-phys-marc 3ae407d
Simplify condition with substr membership check
comp-phys-marc 38db04c
Simplify condition with substr membership check
comp-phys-marc 91975ee
Merge branch 'master' into feature/no-pre-compute
comp-phys-marc e184762
Merge remote-tracking branch 'origin/feature/no-pre-compute' into fea…
comp-phys-marc bd2c94b
Update docstring
comp-phys-marc aceda7b
Format
comp-phys-marc 2875e2f
Make type hint more specific
comp-phys-marc 024a302
Make type hint more specific
comp-phys-marc d569a6b
Make type hint more specific
comp-phys-marc e98d3f8
Make type hint more specific
comp-phys-marc 7accb46
Rename qubit_mapping -> wire_map
comp-phys-marc c68d233
Update all refs to qubit_mappings
comp-phys-marc 2741c93
Raise when an unsupported expression is found
comp-phys-marc 5a1da57
Update docstring
comp-phys-marc b52988f
Break up large expression
comp-phys-marc dc31195
Check for specific missing wires
comp-phys-marc eca761f
Add usage of wire_map to docs
comp-phys-marc 3dd22dc
Simplify loop
comp-phys-marc 47ee8af
Merge branch 'master' into feature/no-pre-compute
comp-phys-marc 8dc7e85
Merge remote-tracking branch 'origin/feature/no-pre-compute' into fea…
comp-phys-marc b578c3c
Repurpose retrieve_variable -> evaluate_argument
comp-phys-marc f35e12e
pylint
comp-phys-marc 83a9403
pylint
comp-phys-marc 6b7e452
Merge branch 'feature/no-pre-compute' into feature/end-statements
comp-phys-marc 1d9fac8
Run formatter
comp-phys-marc eeee2ad
Split up gate handler
comp-phys-marc 5c28e3a
Split up gate handler
comp-phys-marc 2084a72
Merge branch 'master' into feature/no-pre-compute
comp-phys-marc 6a18692
Merge branch 'feature/no-pre-compute' into feature/end-statements
comp-phys-marc 7c39931
Variables
comp-phys-marc 5e655b2
Variable declarations, assignments, retrievals
comp-phys-marc f1cb5f2
Merge remote-tracking branch 'origin/feature/variables' into feature/…
comp-phys-marc 12debf7
Improve test coverage
comp-phys-marc 304c39f
PR feedback: docs
comp-phys-marc 01452e9
Merge branch 'master' into feature/no-pre-compute
comp-phys-marc faf577a
Update docstring
comp-phys-marc 74e14b1
pylint
comp-phys-marc 814e174
Merge branch 'master' into feature/no-pre-compute
comp-phys-marc de262fe
Remove dirty state
comp-phys-marc 607660e
Compute variables on first (and only) pass
comp-phys-marc 1101c53
Remove second (execution) pass
comp-phys-marc 051e2c7
Merge branch 'feature/no-pre-compute' into feature/variables
comp-phys-marc 6f88838
Trigger CI
comp-phys-marc 3a55fb9
Trigger CI
comp-phys-marc 0cee688
Harden implementation
comp-phys-marc 3171c55
Correct import statement for from_qasm3
comp-phys-marc a532497
Address feedback on docs
comp-phys-marc d0c69f9
Address feedback on docs
comp-phys-marc f278d41
Merge remote-tracking branch 'origin/feature/no-pre-compute' into fea…
comp-phys-marc 738d88a
Adopt one more suggested rewording
comp-phys-marc 8a26746
Suport for expressions as parameters
comp-phys-marc 90624e9
Type hint
comp-phys-marc 9f7ea0d
Simplify logic around modifiers
comp-phys-marc 7b7c3dc
Add explicit else branch for clarity
comp-phys-marc d3e04d1
Add new imports
comp-phys-marc 227b92e
Merge remote-tracking branch 'origin/feature/no-pre-compute' into fea…
comp-phys-marc 42b4101
Add pragma: no cover to unreachable branch
comp-phys-marc 66626a1
Minor cleanup around reviewer changes
comp-phys-marc ed86157
Stylistic change from loop -> comprehension
comp-phys-marc 4200cc9
Merge branch 'master' into feature/no-pre-compute
comp-phys-marc fdf3f2e
Merge remote-tracking branch 'origin/feature/no-pre-compute' into fea…
comp-phys-marc 8da0c44
Type hint
comp-phys-marc 060695d
Use evaluate_argument in apply_modifier
comp-phys-marc 0f12c0d
Clean up evaluate_argument
comp-phys-marc f63357b
Run formatter
comp-phys-marc 43aac0d
Add AttriburteError handling for antlr4 runtime
comp-phys-marc ebf99f4
Skip coverage of lines dependent on environment
comp-phys-marc 0a6e16b
pylint
comp-phys-marc 78bd2e8
Merge branch 'master' into feature/no-pre-compute
comp-phys-marc 810e49e
Merge branch 'master' into feature/no-pre-compute
comp-phys-marc c21cd0e
Merge branch 'feature/no-pre-compute' into feature/end-statements
comp-phys-marc 65e5a34
Merge branch 'feature/no-pre-compute' into feature/variables
comp-phys-marc 4dc3ef6
Make example device init into a dev comment
comp-phys-marc 8d79e52
Make example device init a dev comment
comp-phys-marc b8cd2c1
Trigger CI
comp-phys-marc e6bcaeb
pylint
comp-phys-marc e56247f
Merge branch 'feature/no-pre-compute' into feature/end-statements
comp-phys-marc d719646
Merge branch 'feature/no-pre-compute' into feature/variables
comp-phys-marc d500ebf
Run formatter
comp-phys-marc 48528e8
Remove permissive flag
comp-phys-marc b07957e
Run formatter
comp-phys-marc 17bcaa5
Link to pypi install instructions in docs
comp-phys-marc 0c158bd
Add needed quotes to pypi package option
comp-phys-marc 893f382
OpenQASM3 -> OpenQASM 3.0
comp-phys-marc 0180fa7
Link to pypi install instructions in docs
comp-phys-marc 4e9d700
Add needed quotes to parser option
comp-phys-marc 0bfd973
Rename qubits -> wires
comp-phys-marc c8ad00c
Rename QASM -> QASM 3.0
comp-phys-marc 93ece37
Remove whitespace
comp-phys-marc 915a771
Typo
comp-phys-marc a2c6b7c
Parse expressions
comp-phys-marc 4bb9491
Make from_qasm3 available on qml
comp-phys-marc 9024ab3
Make from_qasm3 available on qml
comp-phys-marc 9c93b87
Remove unecessary `.io`
comp-phys-marc 3c721bf
Import from qml in docs
comp-phys-marc 834bc92
Merge branch 'feature/no-pre-compute' into feature/end-statements
comp-phys-marc 7c14166
Merge branch 'feature/no-pre-compute' into feature/variables
comp-phys-marc 61dbbeb
run formatter
comp-phys-marc ba72812
Merge remote-tracking branch 'origin/feature/no-pre-compute' into fea…
comp-phys-marc 5f585df
Debug sphinx build
comp-phys-marc ead176e
pylint
comp-phys-marc 924752a
format
comp-phys-marc 8a0aa2c
Combine eval_expr with visit
comp-phys-marc 18c4e61
Cannot register Callable
comp-phys-marc 269da10
Merge branch 'master' into feature/no-pre-compute
comp-phys-marc 0d26031
Describe what features are not yet supported
comp-phys-marc 7e33347
Test alias
comp-phys-marc 2795e76
Merge branch 'feature/no-pre-compute' into feature/end-statements
comp-phys-marc ad87f48
Docstring
comp-phys-marc 6bcf4c4
Refactor index expr and id visit to share helpers
comp-phys-marc 4adf9ea
Correct func signature
comp-phys-marc d3aaeb4
Merge branch 'master' into feature/variables
comp-phys-marc f548a19
Merge branch 'master' into feature/end-statements
comp-phys-marc 12908c5
Add test for exprs
comp-phys-marc faea18f
Use break instead of exception
comp-phys-marc 5d002ec
Use EndError
comp-phys-marc 7f3c659
Just return after EndStatements
comp-phys-marc 7e4d8da
Rename EndError -> EndProgram
comp-phys-marc ac17c5b
Run formatter
comp-phys-marc 054f1cf
Debug pylint, coverage
comp-phys-marc 684f519
Update changelog
comp-phys-marc 7422d86
Move static helpers out of class
comp-phys-marc 6ec0a16
Run formatter
comp-phys-marc c03323e
Trigger CI
comp-phys-marc f337a01
Combine classical declaration cases
comp-phys-marc 85cd9ad
Merge branch 'master' into feature/end-statements
comp-phys-marc d95017e
Pylint
comp-phys-marc af8c89d
Pylint tests
comp-phys-marc 92c15d3
Run formatter
comp-phys-marc 85a819b
Move context management into ContextManager class
comp-phys-marc 06aa886
Format, pylint
comp-phys-marc f713b0d
Backticks around `end`
comp-phys-marc 2dfcfa5
Debug tests in CI
comp-phys-marc 81572c8
Rename Context class per feedback
comp-phys-marc 3f053bb
Merge branch 'feature/end-statements' into feature/variables
comp-phys-marc 776d6c4
Run formatter
comp-phys-marc afb2969
Pass Context instead of dict
comp-phys-marc 6546d4c
Use dataclass for Variables
comp-phys-marc b771aa5
Feedback
comp-phys-marc db29b72
PR Feedback
comp-phys-marc e7c5c75
Move retrieve_variable into Context
comp-phys-marc 219fe4d
Format
comp-phys-marc aa0883a
Update docs
comp-phys-marc 2be2c10
Merge branch 'feature/end-statements' into feature/variables
comp-phys-marc d274a8e
Improve test coverage
comp-phys-marc 6e57e3f
More test coverage
comp-phys-marc 5d5c632
Use set op instead of loop to build wire list
comp-phys-marc 199f46e
PR Feedback
comp-phys-marc 5ece1da
Merge remote-tracking branch 'origin/feature/variables' into feature/…
comp-phys-marc ac9a5dd
Debug failing regex
comp-phys-marc 0c30fa2
Casting
comp-phys-marc 36e1c11
Improve coverage
comp-phys-marc b7b98c4
Merge branch 'master' into feature/variables
comp-phys-marc 8c34b18
Move exprs and casts to separate PR
comp-phys-marc 650fdf9
Simple expressions and casts
comp-phys-marc d8ce679
pylint
comp-phys-marc c5d1355
pylint
comp-phys-marc b886aea
Refactor pylint directives
comp-phys-marc c8c24be
Change TypeError -> NotImplementedError
comp-phys-marc 30a3227
Change TypeError -> NotImplementedError in tests
comp-phys-marc 2ed517a
Merge remote-tracking branch 'origin/feature/variables' into feature/…
comp-phys-marc 6ede81d
PR Feedbback
comp-phys-marc 897bce9
Full file paths for CI
comp-phys-marc 5d2a43e
Format
comp-phys-marc 33c9e04
Trigger CI
comp-phys-marc a484ea8
Simplify indexing
comp-phys-marc a6c1cc8
File paths for CI
comp-phys-marc e804d6b
Handle more general indices
comp-phys-marc d3b6f76
Merge branch 'feature/variables' into feature/expressions
comp-phys-marc 988c5d1
Implement binary and unary exprs without eval
comp-phys-marc 0b66c1d
pylint
comp-phys-marc 927766f
Improve coverage
comp-phys-marc e1ee664
Assignment expressions
comp-phys-marc 08d61e0
pylint
comp-phys-marc 33e0aea
pylint
comp-phys-marc 70fa8aa
Test Expressions
comp-phys-marc 30d3180
format
comp-phys-marc 3afd579
Remove redundant logic in retrieve_variable
comp-phys-marc 22d1ba5
Test unary exprs
comp-phys-marc 4d74068
Merge branch 'feature/variables' into feature/expressions
comp-phys-marc 467820b
Roughly equal
comp-phys-marc 59a1248
Switch case
comp-phys-marc a7353d7
Merge branch 'master' into feature/expressions
comp-phys-marc 0e16fdc
Merge branch 'master', fix switch
comp-phys-marc 4a02d0b
Clean up merge
comp-phys-marc 98a3042
Cleanup tests
comp-phys-marc fc33e3b
pylint
comp-phys-marc f5bfd74
Typo in comment
comp-phys-marc 98458c4
PR feedback
comp-phys-marc ce3b163
Merge remote-tracking branch 'origin' into feature/expressions
comp-phys-marc 10bf4d2
Merge remote-tracking branch 'origin/feature/expressions' into featur…
comp-phys-marc 0fe1c7d
Format
comp-phys-marc 2849bd4
pylint
comp-phys-marc 28ccbf5
File paths for CI
comp-phys-marc 0692899
Improve coverage
comp-phys-marc 51a9975
Format, pylint
comp-phys-marc 1f7fd14
isnumeric doesn't match "."
comp-phys-marc 3733f58
Test organization
comp-phys-marc 391c74d
Format
comp-phys-marc 56d8f5f
typo in comment
comp-phys-marc 481b1f4
Minor cosmetic refactor
comp-phys-marc d208757
Merge remote-tracking branch 'origin/feature/expressions' into featur…
comp-phys-marc 237c776
Update changelog
comp-phys-marc 63e2bdc
Merge branch 'master' into feature/expressions
comp-phys-marc 1b58489
PR feedback
comp-phys-marc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
int a = 0; | ||
int b = 1; | ||
int c = 2; | ||
int d = 3; | ||
int e = 4; | ||
bool f = true; | ||
bool g = true; | ||
bit i = "10"; | ||
bit j = "10"; | ||
bit k = "11"; | ||
int l = 5; | ||
int m = 6; | ||
a = 1; | ||
b += 2; | ||
c -= 3; | ||
d *= 4; | ||
e /= 5; | ||
f &= true; | ||
g |= false; | ||
i ^= 9; | ||
j <<= 10; | ||
k >>= 1; | ||
l %= 2; | ||
m **= 13; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const int lhs = 0; | ||
const int rhs = 1; | ||
bool a = lhs == rhs; | ||
bool b = lhs != rhs; | ||
bool c = lhs > rhs; | ||
bool d = lhs < rhs; | ||
bool e = lhs >= rhs; | ||
bool f = lhs <= rhs; | ||
|
||
bit lh = "10"; | ||
bit rh = "01"; | ||
bit g = lh >> rh; | ||
bit h = lh << rh; | ||
bit i = lh | rh; | ||
bit j = lh ^ rh; | ||
bit k = lh & rh; | ||
|
||
int l = 3; | ||
int r = 2; | ||
int m = l + r; | ||
int n = l / r; | ||
int o = l - r; | ||
int p = l * r; | ||
int q = l ** r; | ||
int s = l % r; | ||
|
||
bool left = true; | ||
bool right = false; | ||
int t = left || right; | ||
int u = left && right; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
int i = 4; | ||
const int j = i; | ||
const int neg = -j; | ||
bit[3] c = "000"; | ||
let alias = c; | ||
const bit k = j + alias; | ||
const float[3] arr = {0.0, 1.0, 2.0}; | ||
let arr_alias = arr[0:2]; | ||
let literal_alias = arr[0]; | ||
complex[float[64]] comp = 3.5im; | ||
complex[float[64]] comp; | ||
comp = 2.5 + 3.5im; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.