OperatorBase¶
 class OperatorBase[source]¶
Bases:
StarAlgebraMixin
,TensorMixin
,ABC
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.
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.Same as assign_parameters, but maintained for consistency with QuantumCircuit in Terra (which has both assign_parameters and bind_parameters).
Return Operator Composition between self and other (linear algebrastyle: A@B(x) = A(B(x))), overloaded by
@
.Return a deep copy of the Operator.
Evaluate Equality between Operators, overloaded by
==
.Evaluate the Operator's underlying function, either on a binary string or another Operator.
Return True if the operator is hermitian.
Returns the scalar multiplication of the Operator, overloaded by
*
, including support for Terra'sParameters
, which can be bound to values later (viabind_parameters
).Return the Operator's negation, effectively just multiplying by 1.0, overloaded by

.Permutes the qubits of the operator.
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.
Return tensor product between self and other, overloaded by
^
.Return tensor product with self multiple times, overloaded by
^
.Returns a
CircuitOp
equivalent to this Operator.Return NumPy representation of the Operator.
Returns a
MatrixOp
equivalent to this Operator.Return SciPy sparse matrix representation of the Operator.
Attributes
 INDENTATION = ' '¶
 instance_id¶
Return the unique instance id.
 Return type
int
 num_qubits¶
The number of qubits over which the Operator is defined. If
op.num_qubits == 5
, thenop.eval('1' * 5)
will be valid, butop.eval('11')
will not. Return type
int
 Returns
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. Return type
Dict
 Returns
Object settings in a dictionary.