mirror of https://github.com/Qiskit/qiskit.git
29 lines
1002 B
YAML
29 lines
1002 B
YAML
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])
|