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

change: get dimensions for aq.ArrayVar automatically #22

Merged
merged 5 commits into from
Jun 3, 2024

Conversation

Yash-10
Copy link
Contributor

@Yash-10 Yash-10 commented May 30, 2024

Issue #13:

Description of changes:

  • In the definition of ArrayVar in types.py, the dimensions keyword argument is no longer required but inferred from the initial expression. The initial expression, however, becomes a necessary argument following the comments made on the issue.
  • args[0] is used because _ClassicalVar in oqpy's ArrayVar suggests init_expression is the first argument.

Testing done: Yes.

Merge Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.

General

  • I have read the CONTRIBUTING doc
  • I used the commit message format described in CONTRIBUTING
  • I have updated any necessary documentation, including READMEs and API docs (if appropriate)
    • Perhaps not required since the high-level interface only contains args and kwargs, which remain unchanged?

Tests

  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have checked that my tests are not configured for a specific region or account (if appropriate)
    • Not applicable.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@Yash-10 Yash-10 requested a review from a team as a code owner May 30, 2024 12:10
Copy link

codecov bot commented May 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (ecce2bc) to head (1b85446).
Report is 15 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #22   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           44        43    -1     
  Lines         1936      1903   -33     
  Branches       319       320    +1     
=========================================
- Hits          1936      1903   -33     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@rmshaffer rmshaffer left a comment

Choose a reason for hiding this comment

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

This is looking good - thank you for taking this on! Just a few small comments and suggestions.

src/autoqasm/types/types.py Outdated Show resolved Hide resolved
src/autoqasm/types/types.py Outdated Show resolved Hide resolved
test/unit_tests/autoqasm/test_types.py Outdated Show resolved Hide resolved
test/unit_tests/autoqasm/test_types.py Outdated Show resolved Hide resolved
@Yash-10 Yash-10 force-pushed the ArrayVar-dimensions branch from d273c6f to 1c42c17 Compare May 31, 2024 02:53
Copy link
Contributor

@rmshaffer rmshaffer left a comment

Choose a reason for hiding this comment

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

This is looking good! Couple of minor suggestions but after that I think this will be ready to go.

src/autoqasm/types/types.py Outdated Show resolved Hide resolved
src/autoqasm/types/types.py Outdated Show resolved Hide resolved
@rmshaffer rmshaffer linked an issue Jun 3, 2024 that may be closed by this pull request
@rmshaffer rmshaffer merged commit 32b2524 into amazon-braket:main Jun 3, 2024
15 checks passed
atharva-satpute pushed a commit to atharva-satpute/autoqasm that referenced this pull request Jun 4, 2024
* change: get dimensions for aq.ArrayVar automatically

reformat

* change: add init_expression to ArrayVar explicitly

* Add test for multidimensional array support

remove print

* Add type hint for init_expression

* Add type hint test for init_expression
@Yash-10 Yash-10 deleted the ArrayVar-dimensions branch June 18, 2024 03:01
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.

Automatically determine dimensions for aq.ArrayVar declaration
2 participants