- SparsePauliOp.compose(other, qargs=None, front=False)[source]¶
Return the operator composition with another SparsePauliOp.
other (SparsePauliOp) – a SparsePauliOp object.
qargs (list or None) – Optional, a list of subsystem positions to apply other on. If None apply on all subsystems (default: None).
front (bool) – If True compose using right operator multiplication, instead of left multiplication [default: False].
The composed SparsePauliOp.
- Return type
QiskitError – if other cannot be converted to an operator, or has incompatible dimensions for specified subsystems.
&) by default is defined as left matrix multiplication for matrix operators, while
dot()) is defined as right matrix multiplication. That is that
A & B == A.compose(B)is equivalent to
B @ A == B.dot(A)when
Bare of the same type.
front=Truekwarg changes this to right matrix multiplication and is equivalent to the
A.dot(B) == A.compose(B, front=True).