-
Notifications
You must be signed in to change notification settings - Fork 615
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow tuple-valued
control_values
with qml.ctrl
on a Controlled
…
… instance. (#5725) **Context:** By default, `control_values` of `Controlled` instances are lists. `qml.defer_measurements` passes a tuple as `control_values` to `ctrl`. `create_controlled_op`, called by `ctrl`, tries to merge `control_values` of the base operation and the provided `control_values`. The consequence is an attempted addition of `list` and `tuple`, if `qml.defer_measurements` hits a `qml.cond` of a `Controlled` instance, leading to #5717 **Description of the Change:** This PR fixes the above problem in two (redundant!) ways: - tuples are allowed to be passed as `control_values` to `ctrl`, which casts them to a `list`. - `defer_measurements` passes a `list` itself. Clearly those changes are redundant for the bug #5717, with the former also providing users with the option of using `tuple`s for `control_values`. We could skip the change to `defer_measurements`, thus. **Benefits:** **Possible Drawbacks:** **Related GitHub Issues:** Fixes #5717 [sc-63645]
- Loading branch information
Showing
5 changed files
with
36 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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