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

Add support for arrays #28

Merged
merged 12 commits into from
Mar 21, 2023
Merged

Conversation

anuragm
Copy link
Contributor

@anuragm anuragm commented Mar 17, 2023

This PR adds support for native Opqy arrays. Arrays can be defined with an initial expression and can be indexed using any expression that can be converted to an AST expression.

See added tests for example usage.

oqpy/classical_types.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@PhilReinhold PhilReinhold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! Thanks for putting this together, just a few ideas.

oqpy/classical_types.py Outdated Show resolved Hide resolved
oqpy/classical_types.py Outdated Show resolved Hide resolved
tests/test_directives.py Show resolved Hide resolved
@anuragm anuragm requested a review from PhilReinhold March 20, 2023 22:28
Copy link
Collaborator

@jcjaskula-aws jcjaskula-aws left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I added few comments, which might not need changes.

oqpy/classical_types.py Show resolved Hide resolved
oqpy/classical_types.py Outdated Show resolved Hide resolved
oqpy/classical_types.py Show resolved Hide resolved
oqpy/classical_types.py Show resolved Hide resolved
@anuragm anuragm requested review from jcjaskula-aws and PhilReinhold and removed request for PhilReinhold and jcjaskula-aws March 21, 2023 19:07
@PhilReinhold PhilReinhold merged commit db9ec10 into openqasm:main Mar 21, 2023
yitchen-tim added a commit to ajberdy/oqpy that referenced this pull request May 2, 2023
* Fix code of conduct link (openqasm#27)

Co-authored-by: Jean-Christophe Jaskula <[email protected]>

* Add support for arrays (openqasm#28)

* Add array variable

* Enable indexing

* Add a test

* More tests

* Allow specifying type and dimensions in declaration

* Explicitly test setting with variable

* Typing: allow assignment to indexed expressions

* Union type typealias

* Fix comment, provide OQIndexExpression from the module

* Pydocstyle

Why complain now?

* Add base type to ComplexVar and propagate it to arrays

* Bump setuptools from 65.4.1 to 65.5.1 (openqasm#30)

Bumps [setuptools](https://github.com/pypa/setuptools) from 65.4.1 to 65.5.1.
- [Release notes](https://github.com/pypa/setuptools/releases)
- [Changelog](https://github.com/pypa/setuptools/blob/main/CHANGES.rst)
- [Commits](pypa/setuptools@v65.4.1...v65.5.1)

---
updated-dependencies:
- dependency-name: setuptools
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump cryptography from 37.0.4 to 39.0.1 (openqasm#29)

Bumps [cryptography](https://github.com/pyca/cryptography) from 37.0.4 to 39.0.1.
- [Release notes](https://github.com/pyca/cryptography/releases)
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](pyca/cryptography@37.0.4...39.0.1)

---
updated-dependencies:
- dependency-name: cryptography
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Add shift and bitwise operations (openqasm#31)

* Add shift and logical operations

* Add logical OR and AND

---------

Co-authored-by: Mitch D'Ewart <[email protected]>

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Anurag Mishra <[email protected]>
Co-authored-by: Jean-Christophe Jaskula <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: jmdewart <[email protected]>
Co-authored-by: Mitch D'Ewart <[email protected]>
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.

3 participants