-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix parameter handling for
NLocal(..., flatten=True)
and standard g…
…ates (#13482) * Use _append_standard_gate directly * update params on cache * Revert "Use _append_standard_gate directly" This reverts commit 9769785. * Add test and reno
- Loading branch information
Showing
4 changed files
with
54 additions
and
7 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
17 changes: 17 additions & 0 deletions
17
releasenotes/notes/fix-cached-params-update-4d2814b698fa76b4.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,17 @@ | ||
--- | ||
fixes: | ||
- | | ||
Fixed a bug in :meth:`.QuantumCircuit.assign_parameters`, occurring when assigning parameters | ||
to standard gates whose definition has already been triggered. In this case, the new values | ||
were not properly propagated to the gate instances. While the circuit itself was still | ||
compiled as expected, inspecting the individual operations would still show the old parameter. | ||
For example:: | ||
from qiskit.circuit.library import EfficientSU2 | ||
circuit = EfficientSU2(2, flatten=True) | ||
circuit.assign_parameters([1.25] * circuit.num_parameters, inplace=True) | ||
print(circuit.data[0].operation.params) # would print θ[0] instead of 1.25 | ||
Fixed `#13478 <https://github.com/Qiskit/qiskit/issues/13478>`__. |
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