OperatorBase¶
- class OperatorBase[source]¶
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 in Aqua.
Attributes
The number of qubits over which the Operator is defined.
Methods
OperatorBase.__mul__
(other)Overload
*
for Operator scalar multiplication.OperatorBase.add
(other)Return Operator addition of self and other, overloaded by
+
.Return a new Operator equal to the Operator’s adjoint (conjugate transpose), overloaded by
~
.OperatorBase.assign_parameters
(param_dict)Binds scalar values to any Terra
Parameters
in the coefficients or primitives of the Operator, or substitutes oneParameter
for another.OperatorBase.bind_parameters
(param_dict)Same as assign_parameters, but maintained for consistency with QuantumCircuit in Terra (which has both assign_parameters and bind_parameters).
OperatorBase.compose
(other)Return Operator Composition between self and other (linear algebra-style: A@B(x) = A(B(x))), overloaded by
@
.OperatorBase.equals
(other)Evaluate Equality between Operators, overloaded by
==
.OperatorBase.eval
([front])Evaluate the Operator’s underlying function, either on a binary string or another Operator.
OperatorBase.mul
(scalar)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
-
.OperatorBase.power
(exponent)Return Operator composed with self multiple times, overloaded by
**
.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.
OperatorBase.tensor
(other)Return tensor product between self and other, overloaded by
^
.OperatorBase.tensorpower
(other)Return tensor product with self multiple times, overloaded by
^
.OperatorBase.to_legacy_op
([massive])Attempt to return the Legacy Operator representation of the Operator.
OperatorBase.to_matrix
([massive])Return NumPy representation of the Operator.