-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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 C3SXGate
to_matrix
method
#12742
Conversation
One or more of the following people are relevant to this code:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the catch. Looking (very briefly) at #10296, it seems like the array was always missing, even before the decorator.
@@ -591,7 +593,7 @@ def __init__( | |||
unit="dt", | |||
_base_label=None, | |||
): | |||
"""Create a new 3-qubit controlled sqrt-X gate. | |||
"""Create a new 3-qubit contƒCrolled sqrt-X gate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wtf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when I switch keyboards option and command are reversed and stuff happens XD
--- | ||
fixes: | ||
- | | ||
Fixed a missing decorator in :class:`.C3SXGate` that made it fail if `gate.to_matrix()` was called. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can link :meth:`.Gate.to_matrix`
to get the proper cross-ref.
Pull Request Test Coverage Report for Build 9854198448Details
💛 - Coveralls |
@Mergifyio backport stable/0.46 stable/1.1 |
✅ Backports have been created
|
* Fix `C3SXGate` `to_matrix` method (#12742) * Fix c3sx matrix * Apply Jake's suggestion (cherry picked from commit d86f995) # Conflicts: # test/python/circuit/test_rust_equivalence.py * Remove rust test --------- Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com> Co-authored-by: Elena Peña Tapia <epenatap@gmail.com>
* Fix `C3SXGate` `to_matrix` method (#12742) * Fix c3sx matrix * Apply Jake's suggestion (cherry picked from commit d86f995) # Conflicts: # test/python/circuit/test_rust_equivalence.py * Remove rust test --------- Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com> Co-authored-by: Elena Peña Tapia <epenatap@gmail.com>
Summary
This PR adds the
with_controlled_gate_array
decorator missing inC3SXGate
that enables theto_matrix
method. This bug was found while portingC3SXGate
to Rust (#12659).Details and comments
I have also noticed that the path of
C3SXGate
is incorrect. It's currently inqiskit/circuit/library/standard_gates/x.py
while it should be inqiskit/circuit/library/standard_gates/sx.py
. I did not address this issue in the current PR because I believe the move to the correct location is a breaking change and should probably be left for 2.0 (although most users won't import gates directly from the file).