MatrixOp¶
-
class
MatrixOp
(primitive, coeff=1.0)[source]¶ Bases:
qiskit.aqua.operators.primitive_ops.primitive_op.PrimitiveOp
Class for Operators represented by matrices, backed by Terra’s
Operator
module.- Parameters
primitive (
Union
[list
,ndarray
,spmatrix
,Operator
]) – The matrix-like object which defines the behavior of the underlying function.coeff (
Union
[int
,float
,complex
,ParameterExpression
]) – A coefficient multiplying the primitive
- Raises
TypeError – invalid parameters.
ValueError – invalid parameters.
Methods
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 algebra-style: A@B(x) = A(B(x))), overloaded by
@
.Evaluate Equality between Operators, overloaded by
==
.Evaluate the Operator’s underlying function, either on a binary string or another Operator.
Return a
CircuitOp
equivalent to e^-iH for this operator HReturn a
MatrixOp
equivalent to log(H)/-i for this operator H.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
-
.Creates a new MatrixOp that acts on the permuted qubits.
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.
Return tensor product between self and other, overloaded by
^
.Return tensor product with self multiple times, overloaded by
^
.Returns a
QuantumCircuit
equivalent to this Operator.Returns a
CircuitOp
equivalent to this Operator.Returns an
Instruction
equivalent to this Operator.Attempt to return the Legacy Operator representation of the Operator.
Return NumPy representation of the Operator.
Returns a
MatrixOp
equivalent to this Operator.Returns a sum of
PauliOp
s equivalent to this Operator.Attributes
-
ENABLE_DEPRECATION
= True¶
-
INDENTATION
= ' '¶
-
coeff
¶ The scalar coefficient multiplying the Operator.
- Return type
Union
[int
,float
,complex
,ParameterExpression
]- Returns
The coefficient.
-
num_qubits
¶ - Return type
int
-
parameters
¶
-
primitive
¶ The primitive defining the underlying function of the Operator.
- Return type
Union
[Instruction
,QuantumCircuit
,List
,ndarray
,spmatrix
,Operator
,Pauli
]- Returns
The primitive object.