AbelianGrouper.group_subops

AbelianGrouper.group_subops(list_op)[source]

Given a ListOp, attempt to group into Abelian ListOps of the same type.

Parameters

list_op (ListOp) – The Operator to group into Abelian groups

Return type

ListOp

Returns

The grouped Operator.

Raises

AquaError – Any of list_op’s sub-ops do not have a commutes method.