-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
QuantumCircuit.get_parameter
to retrieve by name (#11431)
* Add `QuantumCircuit.get_parameter` to retrieve by name This allows `Parameter` instances to be retrieved from a circuit by string name. The interface is a mirror of the same functionality already added for run-time variables (`get_var`), but for the compile-time `Parameter` class. Similarly, a `has_parameter` method mirrors `has_var`. * Update qiskit/circuit/parametertable.py Co-authored-by: Julien Gacon <gaconju@gmail.com> * Fix typos Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com> Co-authored-by: Julien Gacon <gaconju@gmail.com> * Fix blank space --------- Co-authored-by: Julien Gacon <gaconju@gmail.com> Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
- Loading branch information
1 parent
733e2a3
commit 3263355
Showing
4 changed files
with
167 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
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
7 changes: 7 additions & 0 deletions
7
releasenotes/notes/circuit-get-parameter-d33c08925b5c7d72.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,7 @@ | ||
--- | ||
features: | ||
- | | ||
:class:`.QuantumCircuit` has two new methods, :meth:`~.QuantumCircuit.get_parameter` and | ||
:meth:`~.QuantumCircuit.has_parameter`, which respectively retrieve a :class:`.Parameter` | ||
instance used in the circuit by name, and return a Boolean of whether a parameter with a | ||
matching name (or the exact instance given) are used in the circuit. |
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