CircuitStateFn¶
- class CircuitStateFn(*args, **kwargs)[source]¶
Bases:
StateFn
Deprecated: A class for state functions and measurements which are defined by the action of a QuantumCircuit starting from |0⟩, and stored using Terra’s
QuantumCircuit
class.Deprecated since version 0.24.0: The class
qiskit.opflow.state_fns.circuit_state_fn.CircuitStateFn
is deprecated as of qiskit-terra 0.24.0. It will be removed no earlier than 3 months after the release date. For code migration guidelines, visit https://qisk.it/opflow_migration.- Parameters
primitive – The
QuantumCircuit
(orInstruction
, which will be converted) which defines the behavior of the underlying function.coeff – A coefficient multiplying the state function.
is_measurement – Whether the StateFn is a measurement operator.
from_operator – if True the StateFn is derived from OperatorStateFn. (Default: False)
- Raises
TypeError – Unsupported primitive, or primitive has ClassicalRegisters.
Methods Defined Here
Return Operator addition of self and other, overloaded by
+
.Return a new Operator equal to the Operator's adjoint (conjugate transpose), overloaded by
~
.Binds scalar values to any Terra
Parameters
in the coefficients or primitives of the Operator, or substitutes oneParameter
for another.Composition (Linear algebra-style: A@B(x) = A(B(x))) is not well defined for states in the binary function model, but is well defined for measurements.
Evaluate the Operator's underlying function, either on a binary string or another Operator.
Construct the CircuitStateFn from a dict mapping strings to probability densities.
Construct the CircuitStateFn from a vector representing the statevector.
Permute the qubits of the circuit.
Return a set of strings describing the primitives contained in the Operator.
Try collapsing the Operator structure, usually after some type of conversion, e.g.
Sample the state function as a normalized probability distribution.
Return tensor product between self and other, overloaded by
^
.Return QuantumCircuit representing StateFn
Return
StateFnCircuit
corresponding to this StateFn.Return numpy matrix of density operator, warn if more than 16 qubits to force the user to set massive=True if they want such a large matrix.
Return Instruction corresponding to primitive.
Return NumPy representation of the Operator.
Attributes
- INDENTATION = ' '¶
- coeff¶
A coefficient by which the state function is multiplied.
- instance_id¶
Return the unique instance id.
- is_measurement¶
Whether the StateFn object is a measurement Operator.
- num_qubits¶
- parameters¶
- primitive: QuantumCircuit¶
The primitive which defines the behavior of the underlying State function.
- settings¶
Return settings.