-
Notifications
You must be signed in to change notification settings - Fork 634
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
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.59% 99.59%
=======================================
Files 479 479
Lines 45339 45372 +33
=======================================
+ Hits 45156 45189 +33
Misses 183 183 ☔ View full report in Codecov by Sentry. |
…bitUnitary`-in-favour-of-`wires`
…bitUnitary`-in-favour-of-`wires`
…bitUnitary`-in-favour-of-`wires`
There has been some necessary changes (order change of |
…#6840) **Context:** Providing a `QubitUnitary` as the base operator defeats the purpose entirely and is just a messier way of using `qml.ctrl(qml.QubitUnitary(...), ...)` For richer context, check #6839 for better illustration; this PR should in principle be an add-on to it. Note: this deprecation is related with a previous bug. Trace via attached story link to see full discussions. **Description of the Change:** `__init__` and `_unflatten`: If get a `QubitUnitary` base, raise PLDW and then get matrix by `base.matrix()`. Added an overloading method `_flatten`. This is a fix to #6839. Deleted two tests that restrictively replied on the support of `QubitUnitary` base. **Benefits:** **Possible Drawbacks:** **Related GitHub Issues:** [sc-80843] --------- Co-authored-by: Astral Cai <[email protected]> Co-authored-by: Christina Lee <[email protected]>
…bitUnitary`-in-favour-of-`wires`
…bitUnitary`-in-favour-of-`wires`
OK all good with current full CI tests + GPU tests. I'll remove the labels for faster CI later |
CodeCov is not working properly |
…bitUnitary`-in-favour-of-`wires`
**Context:** PennyLaneAI/pennylane#6839 In the PR above PL deprecated the interface of `ControlledQubitUnitary(base, control_wires, wires=target_wires)` and use the new interface `ControlledQubitUnitary(base, wires)`. Here we need to adjust the corresponding usage in Catalyst. **Description of the Change:** frontend/test/pytest/device/test_decomposition.py ln52 **Benefits:** **Possible Drawbacks:** **Related GitHub Issues:** [sc-80842] --------- Co-authored-by: Alex Preciado <[email protected]>
**Context:** Due to the deprecations of `ControlledQubitUnitary` input args PennyLaneAI/pennylane#6839 PennyLaneAI/pennylane#6840, we need to update several tests of lightning that use deprecated interfaces. **Description of the Change:** **Benefits:** **Possible Drawbacks:** **Related GitHub Issues:** [sc-80842] --------- Co-authored-by: ringo-but-quantum <[email protected]> Co-authored-by: Alex Preciado <[email protected]>
**Context:** PennyLaneAI/pennylane#6839 In the PR above PL deprecated the interface of `ControlledQubitUnitary(base, control_wires, wires=target_wires)` and use the new interface `ControlledQubitUnitary(base, wires)`. Here we need to adjust the corresponding usage in Catalyst. **Description of the Change:** frontend/test/pytest/device/test_decomposition.py ln52 **Benefits:** **Possible Drawbacks:** **Related GitHub Issues:** [sc-80842] --------- Co-authored-by: Alex Preciado <[email protected]>
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
This is an inevitable breaking change, so we need to immediately inform the affected repos that depend on latest PennyLane but only apply corresponding changes after this PR gets merged.
labs
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]