Fix phase for controlled Rz#3569
Merged
Merged
Conversation
chriseclectic
suggested changes
Dec 8, 2019
Member
chriseclectic
left a comment
There was a problem hiding this comment.
I suggest removing the phase kwarg from UnitaryGate._compute_control_matrix). It isn't needed for this PR
chriseclectic
previously approved these changes
Dec 9, 2019
kdk
approved these changes
Dec 9, 2019
faisaldebouni
pushed a commit
to faisaldebouni/qiskit-terra
that referenced
this pull request
Aug 5, 2020
* fix crz * add implementation for controlled unitary * fix crz * add implementation for controlled unitary * remove phase arg from controlled unitary * linting
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
Since the controlled gate implementation uses the gate definition to generate controlled versions and the Rz gate's definition uses U1, which differs by a global phase to Rz, the controlled version was really a controlled U1. This PR instead bases off the definition of the CrzGate.
Also, the unitary gate overrides the standard control implementation to directly generate a controlled unitary. The returned gate is a UnitaryGate instead of ControlledGate currently.
Details and comments