Operator.compose

Operator.compose(other, qargs=None, front=False)[source]

Return the composed operator.

Parameters
  • other (Operator) – an operator object.

  • qargs (list or None) – 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].

Returns

The operator self @ other.

Return type

Operator

Raises

QiskitError – if operators have incompatible dimensions for composition.

Additional Information:

Composition (@) is defined as left matrix multiplication for matrix operators. That is that A @ B is equal to B * A. Setting front=True returns right matrix multiplication A * B and is equivalent to the dot() method.