-
Notifications
You must be signed in to change notification settings - Fork 616
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
Deprecate control_wires
in ControlledQubitUnitary
#6839
base: master
Are you sure you want to change the base?
Deprecate control_wires
in ControlledQubitUnitary
#6839
Conversation
Hello. You may have forgotten to update the changelog!
|
control_wires
in ControlledQubitUnitary
in favour of `w…control_wires
in ControlledQubitUnitary
This reverts commit eacecd1.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #6839 +/- ##
==========================================
- Coverage 99.54% 99.49% -0.06%
==========================================
Files 477 477
Lines 45246 45331 +85
==========================================
+ Hits 45041 45102 +61
- Misses 205 229 +24 ☔ View full report in Codecov by Sentry. |
…bitUnitary`-in-favour-of-`wires`
…bitUnitary`-in-favour-of-`wires`
|
||
if hasattr(base, "wires") and len(wires) != 0: | ||
warnings.warn( | ||
"base operator already has wires; values specified through wires kwarg will be ignored." | ||
) | ||
wires = Wires(()) | ||
# base should have the target_wires. Then control_wires should be the ones in wires that are not in base.wires |
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.
I feel that specifying wires with base
being an operator is going to be ambiguous regardless of what we do. I believe we're deprecating that soon as well?
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.
Indeed. Since this PR is altering way more than the other I did this first. Anything comes here is temprory and handwaving just to pass existing usage.
My plan for deprecating Operator input is to take the matrix and wires out from the op along with raising warning, and then fall back to normal process.
Co-authored-by: Christina Lee <christina@xanadu.ai>
…bitUnitary`-in-favour-of-`wires`
…bitUnitary`-in-favour-of-`wires`
…wires`-in-`ControlledQubitUnitary`-in-favour-of-`wires`' into Deprecate-`control_wires`-in-`ControlledQubitUnitary`-in-favour-of-`wires`
…bitUnitary`-in-favour-of-`wires`
…bitUnitary`-in-favour-of-`wires`
Co-authored-by: Astral Cai <astral.cai@xanadu.ai>
…bitUnitary`-in-favour-of-`wires`
Context:
We are in favor of
wires
, just like what we did withMultiControlledX
.!Note: this involves a big user-interface change. With PL version <=0.40, for ControlledQubitUnitary, we have arg wires to be the target_wires, and the arg control_wires is a positional arg. To be consistent with all the other interfaces, we would like to alter this into wires to be positional and to represent control_wires+target_wires
Before:
After:
where the new
wires
should be the concatenate of oldcontrol_wires
andwires
Description of the Change:
Besides the modified test files across the whole codebase involving
ControlledQubitUnitary
, we made the following necessary adjustments beyond the__init__
method:_unflatten
,_primitive_bind_call
and method_controlled
were adjusted accordingly following the new interfaceTypeError
regarding empty argwires
to the beginning.ControlledQubitUnitary
inbind_new_parameters.py
following the pattern ofCRX
ControlledQubitUnitary
inside src filesmetric_tensor.py
,controlled.py
andmatrix_ops.py
.Eco-System
Catalyst: frontend/test/pytest/device/test_decomposition.py Adjust the usage of ControlledQubitUnitary catalyst#1483
Lightning: PR to fix it update usages of ControlledQubitUnitary in tests pennylane-lightning#1047
QML Demos: tutorial_classically_boosted_vqe.py; PR to fix it Fix controlled qubit unitary usage qml#1310
Plugins
Benefits:
Unified interfaces with other controlled ops.
Possible Drawbacks:
This is a hard change to deprecate this arg. Would have to introduce errors for testing matrices.
Related GitHub Issues:
[sc-80842]