Divide-and-conquer implementation for Dicke states - #767
Draft
JiriGuthJarkovsky wants to merge 12 commits into
Draft
Divide-and-conquer implementation for Dicke states#767JiriGuthJarkovsky wants to merge 12 commits into
JiriGuthJarkovsky wants to merge 12 commits into
Conversation
|
|
||
| # If k > n/2, it is easier to create D(n, n-k) instead of D(n, k), and then apply the X gate to all qubits. | ||
| large_k = k > n // 2 | ||
| if large_k: |
Contributor
There was a problem hiding this comment.
you cannot use this because in jasp mode it is a dynamic value. See if #598 is helpful, it is still incomplete FYI.
| x(qv[n - k : k]) # Partially undo the initial state, reducing its Hamming weight from k to n-k. | ||
| k = n - k | ||
|
|
||
| if method == "deterministic": |
Contributor
There was a problem hiding this comment.
Strings are always static, so this conditional is fine :)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This adds a new implementation to the function
dicke_statefromdicke_state_prep.py. This is based on a newer (allegedly more efficient) algorithm.Related Issues
Closes #755
Type of Change
Breaking Change?
What was changed?
dicke_statewas given a new input parametermethodwhich decided which method to use.dicke_statewas separated into a helper function_apply_dicke_unitaryand re-used in both implementation methods._dividewas added.How was it tested?
At the moment, no new tests were added. The default value for
methodwas set to "divide-and-conquer", so that the new method is tested using the tests previously used.More tests to be added later and old tests to be expanded to cover both methods.
Checklist
changelog-dev.rstReviewer Notes
I have noticed that the older code doesn't follow strict coding standards, namely the helper function
split_cycle_shiftis not prepended with an underscore_and its internal variableshighIndexandlowIndexuse camelCase, which they shouldn't. I have not changed this as that's out of scope for this PR, but now the code style is somewhat inconsistent (I have prepended the new helper functions with underscores).Currently, two of the jasp-related tests fail. I don't know what jasp is and how to work with it. I would appreciate any advice: