French
Languages
English
Bengali
French
German
Japanese
Korean
Portuguese
Spanish
Tamil

OperatorBase

class OperatorBase[source]

Bases : StarAlgebraMixin, TensorMixin, ABC

Deprecated: A base class for all Operators: PrimitiveOps, StateFns, ListOps, etc. Operators are defined as functions which take one complex binary function to another. These complex binary functions are represented by StateFns, which are themselves a special class of Operators taking only the Zero StateFn to the complex binary function they represent.

Operators can be used to construct complicated functions and computation, and serve as the building blocks for algorithms.

Obsolète depuis la version 0.24.0: The class qiskit.opflow.operator_base.OperatorBase 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.

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 ~.

assign_parameters

Binds scalar values to any Terra Parameters in the coefficients or primitives of the Operator, or substitutes one Parameter for another.

bind_parameters

Same as assign_parameters, but maintained for consistency with QuantumCircuit in Terra (which has both assign_parameters and bind_parameters).

compose

Return Operator Composition between self and other (linear algebra-style: A@B(x) = A(B(x))), overloaded by @.

copy

Return a deep copy of the Operator.

equals

Evaluate Equality between Operators, overloaded by ==.

eval

Evaluate the Operator's underlying function, either on a binary string or another Operator.

is_hermitian

Return True if the operator is hermitian.

mul

Returns the scalar multiplication of the Operator, overloaded by *, including support for Terra's Parameters, which can be bound to values later (via bind_parameters).

neg

Return the Operator's negation, effectively just multiplying by -1.0, overloaded by -.

permute

Permutes the qubits of the operator.

primitive_strings

Return a set of strings describing the primitives contained in the Operator.

reduce

Try collapsing the Operator structure, usually after some type of conversion, e.g.

tensor

Return tensor product between self and other, overloaded by ^.

tensorpower

Return tensor product with self multiple times, overloaded by ^.

to_circuit_op

Returns a CircuitOp equivalent to this Operator.

to_matrix

Return NumPy representation of the Operator.

to_matrix_op

Returns a MatrixOp equivalent to this Operator.

to_spmatrix

Return SciPy sparse matrix representation of the Operator.

Attributes

INDENTATION = '  '
instance_id

Return the unique instance id.

num_qubits

The number of qubits over which the Operator is defined. If op.num_qubits == 5, then op.eval('1' * 5) will be valid, but op.eval('11') will not.

Renvoie

The number of qubits accepted by the Operator’s underlying function.

parameters

Return a set of Parameter objects contained in the Operator.

settings

Return settings of this object in a dictionary.

You can, for example, use this settings dictionary to serialize the object in JSON format, if the JSON encoder you use supports all types in the dictionary.

Renvoie

Object settings in a dictionary.