# qiskit.opflow.expectations.PauliExpectation¶

class PauliExpectation(group_paulis=True)[source]

An Expectation converter for Pauli-basis observables by changing Pauli measurements to a diagonal ({Z, I}^n) basis and appending circuit post-rotations to the measured state function. Optionally groups the Paulis with the same post-rotations (those that commute with one another, or form Abelian groups) into single measurements to reduce circuit execution overhead.

Paramètres

group_paulis (bool) – Whether to group the Pauli measurements into commuting sums, which all have the same diagonalizing circuit.

__init__(group_paulis=True)[source]
Paramètres

group_paulis (bool) – Whether to group the Pauli measurements into commuting sums, which all have the same diagonalizing circuit.

Methods

 __init__([group_paulis]) type group_paulis bool compute_variance(exp_op) Compute the variance of the expectation estimator. convert(operator) Accepts an Operator and returns a new Operator with the Pauli measurements replaced by diagonal Pauli post-rotation based measurements so they can be evaluated by sampling and averaging.
compute_variance(exp_op)[source]

Compute the variance of the expectation estimator.

Paramètres

exp_op (OperatorBase) – The full expectation value Operator after sampling.

Type renvoyé

Union[list, float, ndarray]

Renvoie

The variances or lists thereof (if exp_op contains ListOps) of the expectation value estimation.

convert(operator)[source]

Accepts an Operator and returns a new Operator with the Pauli measurements replaced by diagonal Pauli post-rotation based measurements so they can be evaluated by sampling and averaging.

Paramètres

operator (OperatorBase) – The operator to convert.

Type renvoyé

OperatorBase

Renvoie

The converted operator.