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 output dimensions bug in hamiltonian_expand #5494

Merged
merged 18 commits into from
Apr 17, 2024
Merged

Conversation

astralcai
Copy link
Contributor

@astralcai astralcai commented Apr 10, 2024

Context:
hamiltonian_expand reverses the order of dimensions for shot vectors and parameter broadcasting

Description of the Change:
Change a transpose operation to only transpose the last two dimensions if applicable.

Related GitHub Issues:
Fixes #5493
[sc-61037]

Copy link

codecov bot commented Apr 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.66%. Comparing base (a47d9bc) to head (314a2c9).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5494      +/-   ##
==========================================
- Coverage   99.67%   99.66%   -0.01%     
==========================================
  Files         406      406              
  Lines       37881    37622     -259     
==========================================
- Hits        37758    37497     -261     
- Misses        123      125       +2     

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

@astralcai astralcai marked this pull request as ready for review April 11, 2024 15:15
@lillian542 lillian542 self-requested a review April 11, 2024 15:56
Copy link
Contributor

@lillian542 lillian542 left a comment

Choose a reason for hiding this comment

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

My only real comment is that I'd like it if the tests checked the result, not only the result shape, since that doesn't really seem to be covered anywhere for the broadcasting branch of the code.

doc/releases/changelog-dev.md Outdated Show resolved Hide resolved
tests/transforms/test_hamiltonian_expand.py Outdated Show resolved Hide resolved
Copy link
Contributor

@lillian542 lillian542 left a comment

Choose a reason for hiding this comment

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

Thanks, looks good to me @astralcai!

@astralcai astralcai enabled auto-merge (squash) April 17, 2024 18:56
@astralcai astralcai merged commit e2529d8 into master Apr 17, 2024
38 checks passed
@astralcai astralcai deleted the ham-expand-dim branch April 17, 2024 20:50
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.

[BUG] hamiltonian_expand produces incorrect dimensions with shot vectors
3 participants