Reimplement angle interpolation#55
Merged
eggerdj merged 8 commits intoqiskit-community:mainfrom Jan 27, 2026
Merged
Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
eggerdj
requested changes
Jan 22, 2026
Collaborator
eggerdj
left a comment
There was a problem hiding this comment.
Looks good! Thanks a lot. Can you add version number in param_result and the README? Also their is a conflict with the NB in main.
Contributor
Author
|
oops, sorry about the nb getting messed up, I guess I started this branch from the fixed-angles-notebook branch before it was approved and a few things changed afterwards. I also bumped the version and updated the readme and params. |
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.
Summary
Refactor
qaoa_training_pipeline.training.parameter_extenders.interpolateto make it more readable(no change in logic).
Details and comments
The method, as described in Zhou et al. in PRX 10, 021067 (2020), takes each of the vectors for beta and gamma
(of length
reps) and assumes its values are at integer position in the range1..reps.The method then constructs a new vector
of length
reps + 1whose entries are evenly spaced over the same interval[1, reps].Each new entry is obtained by linear interpolation between adjacent parameters of the original vector.
The original implementation is correct, but the logic of the loop is difficult to understand.
Explicitly defining a new grid and using
np.interpolatemakes the logic explicit and clear,while also making the implementation shorted and cleaner.
To ensure that the implementation provides the exact same results I ran the following code
where
my_interpolateis the new version in this pull request andinterpolateis the original one.This code completed successfully, indicating that both function return the exact same output.
No additional tests are added since this is not new functionality and older tests should cover this code.
Version updated
Version is not updated since this does not change any functionality