Skip to main contentIBM Quantum Documentation
This page is from an old version of Qiskit SDK and does not exist in the latest version. We recommend you migrate to the latest version. See the release notes for more information.

qiskit.aqua.operators.converters.AbelianGrouper

class AbelianGrouper(traverse=True)

GitHub

The AbelianGrouper converts SummedOps into a sum of Abelian sums.

Meaning, it will traverse the Operator, and when it finds a SummedOp, it will evaluate which of the summed sub-Operators commute with one another. It will then convert each of the groups of commuting Operators into their own SummedOps, and return the sum-of-commuting-SummedOps. This is particularly useful for cases where mutually commuting groups can be handled similarly, as in the case of Pauli Expectations, where commuting Paulis have the same diagonalizing circuit rotation, or Pauli Evolutions, where commuting Paulis can be diagonalized together.

Parameters

traverse (bool) – Whether to convert only the Operator passed to convert, or traverse down that Operator.

__init__

__init__(traverse=True)

Parameters

traverse (bool) – Whether to convert only the Operator passed to convert, or traverse down that Operator.


Methods

__init__([traverse])type traversebool
convert(operator)Check if operator is a SummedOp, in which case covert it into a sum of mutually commuting sums, or if the Operator contains sub-Operators and traverse is True, attempt to convert any sub-Operators.
group_subops(list_op[, fast, use_nx])Given a ListOp, attempt to group into Abelian ListOps of the same type.

convert

convert(operator)

Check if operator is a SummedOp, in which case covert it into a sum of mutually commuting sums, or if the Operator contains sub-Operators and traverse is True, attempt to convert any sub-Operators.

Parameters

operator (OperatorBase) – The Operator to attempt to convert.

Return type

OperatorBase

Returns

The converted Operator.

group_subops

classmethod group_subops(list_op, fast=None, use_nx=None)

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

Parameters

  • list_op (ListOp) – The Operator to group into Abelian groups
  • fast (Optional[bool]) – Ignored - parameter will be removed in future release
  • use_nx (Optional[bool]) – Ignored - parameter will be removed in future release

Return type

ListOp

Returns

The grouped Operator.

Raises

AquaError – If any of list_op’s sub-ops is not PauliOp.

Was this page helpful?
Report a bug or request content on GitHub.