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.
Allow string keys in
QuantumCircuit.assign_parameters
These are looked up using the new `get_parameter` method to convert them into an actual `Parameter` instance. This is not available in the fast path (which is allowed to assume that the caller has taken care of providing the most efficient inputs).
- Loading branch information
1 parent
ce43b4d
commit a87af88
Showing
3 changed files
with
44 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
features: | ||
- | | ||
:meth:`.QuantumCircuit.assign_parameters` now accepts string keys in the mapping form of input. | ||
These names are used to look up the corresponding :class:`.Parameter` instance using | ||
:meth:`~.QuantumCircuit.get_parameter`. This lets you do:: | ||
from qiskit.circuit import QuantumCircuit, Parameter | ||
a = Parameter("a") | ||
qc = QuantumCircuit(1) | ||
qc.rx(a, 0) | ||
qc.assign_parameters({"a": 1}) == qc.assign_parameters({a: 1}) |
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