PauliExpectation#

class qiskit.opflow.expectations.PauliExpectation(group_paulis=True)[source]#

Bases: ExpectationBase

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.

0.24.0 ভার্সন থেকে ডেপ্রিকেটেড: The class qiskit.opflow.expectations.pauli_expectation.PauliExpectation is deprecated as of qiskit-terra 0.24.0. It will be removed no earlier than 3 months after the release date. For code migration guidelines, visit https://qisk.it/opflow_migration.

প্যারামিটার:

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

Methods

compute_variance(exp_op)[source]#

Compute the variance of the expectation estimator.

প্যারামিটার:

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

রিটার্নস:

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

রিটার্ন টাইপ:

list | float | ndarray

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.

প্যারামিটার:

operator (OperatorBase) -- The operator to convert.

রিটার্নস:

The converted operator.

রিটার্ন টাইপ:

OperatorBase