forked from Qiskit/qiskit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add base-gate callback to
CUGate.params
return
This causes item-setting in `CUGate.params` to forward those sets on to the `UGate` in its `base_gate` unless they are setting the `gamma` parameter, which is not shared. `CUGate` breaks several assumptions and components of the `ControlledGate` interface, including by having more parameters than its `base_gate`; `ControlledGate` assumes that its subclasses will not have a separate `_params` field, but instead will always just view onto their `base_gate._params`. This commit changes the behaviour of the `params` getter to create a temporary list that backreferences to the base gate, satisfying the requirement. Co-authored-by: Richard Rodenbusch <[email protected]>
- Loading branch information
1 parent
6246783
commit 1ccf4ba
Showing
5 changed files
with
87 additions
and
30 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
8 changes: 8 additions & 0 deletions
8
releasenotes/notes/fix-cu-assign-parameters-fbf6f21d3e0c8c0b.yaml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
fixes: | ||
- | | ||
:class:`.CUGate` will now behave correctly during calls to :meth:`.QuantumCircuit.assign_parameters`. | ||
Previously, it would cause various odd errors, often some time after the initial circuit assignment. | ||
See `#7326 <https://github.com/Qiskit/qiskit/issues/7326>`__, `#7410 <https://github.com/Qiskit/qiskit/issues/7410>`__, | ||
`#9627 <https://github.com/Qiskit/qiskit/issues/9627>`__, `#10002 <https://github.com/Qiskit/qiskit/issues/10002>`__, | ||
and `#10131 <https://github.com/Qiskit/qiskit/issues/10131>`__. |
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