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 default values to for_loop #6068

Merged
merged 8 commits into from
Aug 8, 2024
Merged

Add default values to for_loop #6068

merged 8 commits into from
Aug 8, 2024

Conversation

obliviateandsurrender
Copy link
Contributor

Context: This adds the default step=1 and a range-like syntax support for single-parameter.

Description of the Change: One can now do the following instead of specifying complete (0, 3, 1):

@for_loop(0, 3)
def f(i):
    qml.X(i)

@for_loop(3)
def f(i):
    qml.X(i)

Benefits:

Possible Drawbacks: None

Related GitHub Issues: [sc-70477] [sc-70478]

Copy link
Contributor

github-actions bot commented Aug 5, 2024

Hello. You may have forgotten to update the changelog!
Please edit doc/releases/changelog-dev.md with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

Copy link

codecov bot commented Aug 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.66%. Comparing base (4934593) to head (50041c3).
Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff            @@
##           master    #6068    +/-   ##
========================================
  Coverage   99.66%   99.66%            
========================================
  Files         430      430            
  Lines       41786    41519   -267     
========================================
- Hits        41644    41379   -265     
+ Misses        142      140     -2     

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

Copy link
Contributor

@albi3ro albi3ro left a comment

Choose a reason for hiding this comment

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

I'd be happy to approve once we get some more robust testing.

Copy link
Contributor

@albi3ro albi3ro left a comment

Choose a reason for hiding this comment

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

Thanks for the improved tests. Looks good to me 👍

Copy link
Member

@josh146 josh146 left a comment

Choose a reason for hiding this comment

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

Looks good from my end @obliviateandsurrender!

@obliviateandsurrender obliviateandsurrender enabled auto-merge (squash) August 8, 2024 16:03
@obliviateandsurrender obliviateandsurrender merged commit 147975c into master Aug 8, 2024
40 checks passed
@obliviateandsurrender obliviateandsurrender deleted the for_loop_step branch August 8, 2024 16:13
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