reduce_op

reduce_op(global_op)[source]

Create a lean representation of a global Pauli operator.

This function returns a lean representation of the input operator such that all of the qubits associated solely with Pauli-I terms have been removed. A list of indices is also returned indicating on which qubits the lean operator acts.

For example:
>>> global_op = SparsePauliOp(["IXI", "IIZ"])
>>> reduced_op, qargs = reduce_op(global_op)
>>> reduced_op
SparsePauliOp(['XI', 'IZ'],
              coeffs=[1.+0.j, 1.+0.j])
>>> qargs
[0, 1]
Parameters:

global_op (SparsePauliOp) – The global operator for which to generate a lean representation

Returns:

  • A lean representation of the input operator with qubits associated solely with identity terms removed.

  • A list of indices specifying the qubits on which the lean operator acts.

Raises:

ValueError – Input operator may not be the identity operator.

Return type:

tuple[SparsePauliOp, list[int]]