# OperatorStateFn¶

class OperatorStateFn(primitive, coeff=1.0, is_measurement=False)[소스]

기반 클래스: qiskit.opflow.state_fns.state_fn.StateFn

A class for state functions and measurements which are defined by a density Operator, stored using an OperatorBase.

매개변수
• primitive (OperatorBase) – The OperatorBase which defines the behavior of the underlying State function.

• coeff (Union[complex, ParameterExpression]) – A coefficient by which to multiply the state function

• is_measurement (bool) – Whether the StateFn is a measurement operator

Methods Defined Here

 add Return Operator addition of self and other, overloaded by +. adjoint Return a new Operator equal to the Operator’s adjoint (conjugate transpose), overloaded by ~. eval Evaluate the Operator’s underlying function, either on a binary string or another Operator. permute Permute the qubits of the state function. primitive_strings Return a set of strings describing the primitives contained in the Operator. sample Sample the state function as a normalized probability distribution. tensor Return tensor product between self and other, overloaded by ^. to_circuit_op Return StateFnCircuit corresponding to this StateFn. to_density_matrix 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. to_matrix Note: this does not return a density matrix, it returns a classical matrix containing the quantum or classical vector representing the evaluation of the state function on each binary basis state. to_matrix_op Return a MatrixOp for this operator.

Attributes

INDENTATION = ' '
coeff

A coefficient by which the state function is multiplied.

반환 형식

Union[complex, ParameterExpression]

instance_id

Return the unique instance id.

반환 형식

int

is_measurement

Whether the StateFn object is a measurement Operator.

반환 형식

bool

num_qubits
반환 형식

int

parameters
primitive: qiskit.opflow.operator_base.OperatorBase

The primitive which defines the behavior of the underlying State function.

settings

Return settings.

반환 형식

Dict