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 State Fidelity cache key #93

Merged
merged 2 commits into from
Oct 30, 2023
Merged

Fix State Fidelity cache key #93

merged 2 commits into from
Oct 30, 2023

Conversation

woodsp-ibm
Copy link
Member

Summary

Fixes #90

Details and comments

Switches from id() to _circuit_key() where the latter is that which the reference primitives use. Using id() is problematic, as #90 notes, though _circuit_key is designated a private method, and while its the better choice functionally, it feels a bit off to be using what is designated a private method. Its been used/stable for a while though. A choice might be to copy the whole routine here - but perhaps better to see if this changes going forwards in the way some unique key/hash can be obtained for a circuit.

@coveralls
Copy link

coveralls commented Oct 17, 2023

Pull Request Test Coverage Report for Build 6691648625

  • 3 of 3 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.002%) to 90.556%

Totals Coverage Status
Change from base Build 6691594462: 0.002%
Covered Lines: 6453
Relevant Lines: 7126

💛 - Coveralls

Copy link
Collaborator

@ElePT ElePT left a comment

Choose a reason for hiding this comment

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

Sorry for my late review, but the change LGTM. I think that using _circuit_key() is the most reasonable fix at the moment. It's not ideal to be using a private method, but I expect interfaces to change over the past months and I think it makes more sense to merge the fix as-is now, and revisit the design in the future, after the primitives interface is stabilized (if anything, I feel like the public circuit_key() method would fit better in primitives.utils than here).

@mergify mergify bot merged commit 524f969 into qiskit-community:main Oct 30, 2023
15 checks passed
@woodsp-ibm woodsp-ibm deleted the fidelity_cache branch October 30, 2023 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

State Fidelity should not cache circuits based on Python id()
3 participants