Fix global phase tracking around DAGCircuit.substitute_node. (bp #5618)#5673
Merged
Conversation
* DAGCircuit.__eq__ to check .global_phase and .calibrations. * Fix BasisTranslator and Unroller global phase for substitute_node. * Update releasenotes/notes/dagcircuit-fix-substitute-node-global-phase-usage-ee05476a7d0b24c6.yaml Co-authored-by: Matthew Treinish <mtreinish@kortar.org> * Update releasenotes/notes/dagcircuit-fix-substitute-node-global-phase-usage-ee05476a7d0b24c6.yaml Co-authored-by: Matthew Treinish <mtreinish@kortar.org> Co-authored-by: Matthew Treinish <mtreinish@kortar.org> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> (cherry picked from commit 89cd41e)
20e50c7 to
44092e4
Compare
mtreinish
approved these changes
Jan 21, 2021
mtreinish
requested changes
Jan 23, 2021
Member
mtreinish
left a comment
There was a problem hiding this comment.
Actually, looking at this more closely with fresh eyes I think we should remove the __eq__ changes from a backport because it's potentially a disruptive upgrade for users
mtreinish
reviewed
Jan 25, 2021
|
|
||
| with self.subTest('circuits match'): | ||
| expected = QuantumCircuit(*grover_op.qregs) | ||
| expected = QuantumCircuit(*grover_op.qregs, global_phase=np.pi) |
Member
There was a problem hiding this comment.
I think this isn't correct on stable/0.16, the global phase of pi was added to the grover operator in #5517: https://github.com/Qiskit/qiskit-terra/pull/5517/files#diff-5cc16ff691e55c7c0e9d381f48c31157dcc945f3107f4e6ea246b2a2bcce986e we should check with @Cryoris if that needs to be backported too or not
Collaborator
There was a problem hiding this comment.
I think we can include that phase change from 5517, since then the Grover operator fits the definition from the papers 🙂
This commit adds a missing phase of pi to the grover operator circuit library entry. It is a backport from #5517.
In #5618 the dagcircuit __eq__ method was updated to also compare the global_phase and calibrations property. This was done to ensure we preserve both through a transpilation and other transforms since when we assert a circuit is equal to the expect result it will also check phase. However, this has backwards compatibility implications since comparing 2 QuantumCircuits would previously ignore global phase. This commit removes this piece from the backport and just leave the phase corrections as the backport.
kdk
approved these changes
Jan 25, 2021
mtreinish
approved these changes
Jan 25, 2021
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.
This is an automatic backport of pull request #5618 done by Mergify.
Cherry-pick of 89cd41e has failed:
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/
Mergify commands and options
More conditions and actions can be found in the documentation.
You can also trigger Mergify actions by commenting on this pull request:
@Mergifyio refreshwill re-evaluate the rules@Mergifyio rebasewill rebase this PR on its base branch@Mergifyio updatewill merge the base branch into this PR@Mergifyio backport <destination>will backport this PR on<destination>branchAdditionally, on Mergify dashboard you can:
Finally, you can contact us on https://mergify.io/