forked from Qiskit/qiskit
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add reno * Add assign_parameters and parameter in init * add SPO.parameters and remove utils * fix ParameterValueType typehint * Update qiskit/quantum_info/operators/symplectic/sparse_pauli_op.py Co-authored-by: Ikko Hamamura <ikkoham@users.noreply.github.com> * remove trailing print * Elena's comments Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com> * fix line length --------- Co-authored-by: Ikko Hamamura <ikkoham@users.noreply.github.com> Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>
- Loading branch information
1 parent
7bb4af9
commit 9c8eb06
Showing
7 changed files
with
145 additions
and
84 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 was deleted.
Oops, something went wrong.
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
28 changes: 28 additions & 0 deletions
28
releasenotes/notes/sparsepauliop-improved-parameter-support-413f7598bac72166.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,28 @@ | ||
features: | ||
- | | ||
Natively support the construction of :class:`.SparsePauliOp` objects with | ||
:class:`.ParameterExpression` coefficients, without requiring the explicit construction | ||
of an object-array. Now the following is supported:: | ||
from qiskit.circuit import Parameter | ||
from qiskit.quantum_info import SparsePauliOp | ||
x = Parameter("x") | ||
op = SparsePauliOp(["Z", "X"], coeffs=[1, x]) | ||
- | | ||
Added the :meth:`.SparsePauliOp.assign_parameters` method and | ||
:attr:`.SparsePauliOp.parameters` attribute to assign and query unbound parameters | ||
inside a :class:`.SparsePauliOp`. This function can for example be used as:: | ||
from qiskit.circuit import Parameter | ||
from qiskit.quantum_info import SparsePauliOp | ||
x = Parameter("x") | ||
op = SparsePauliOp(["Z", "X"], coeffs=[1, x]) | ||
# free_params will be: ParameterView([x]) | ||
free_params = op.parameters | ||
# assign the value 2 to the parameter x | ||
bound = op.assign_parameters([2]) |
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