71 lines
4.0 KiB
Plaintext
71 lines
4.0 KiB
Plaintext
---
|
||
title: PauliExpectation
|
||
description: API reference for qiskit.opflow.expectations.PauliExpectation
|
||
in_page_toc_min_heading_level: 1
|
||
python_api_type: class
|
||
python_api_name: qiskit.opflow.expectations.PauliExpectation
|
||
---
|
||
|
||
# qiskit.opflow\.expectations.PauliExpectation
|
||
|
||
<Class id="qiskit.opflow.expectations.PauliExpectation" isDedicatedPage={true} github="https://github.com/qiskit/qiskit/tree/stable/0.17/qiskit/opflow/expectations/pauli_expectation.py" signature="PauliExpectation(group_paulis=True)" modifiers="class">
|
||
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.
|
||
|
||
**Parameters**
|
||
|
||
**group\_paulis** (`bool`) – Whether to group the Pauli measurements into commuting sums, which all have the same diagonalizing circuit.
|
||
|
||
### \_\_init\_\_
|
||
|
||
<Function id="qiskit.opflow.expectations.PauliExpectation.__init__" signature="__init__(group_paulis=True)">
|
||
**Parameters**
|
||
|
||
**group\_paulis** (`bool`) – Whether to group the Pauli measurements into commuting sums, which all have the same diagonalizing circuit.
|
||
</Function>
|
||
|
||
## Methods
|
||
|
||
| | |
|
||
| ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||
| [`__init__`](#qiskit.opflow.expectations.PauliExpectation.__init__ "qiskit.opflow.expectations.PauliExpectation.__init__")(\[group\_paulis]) | **type group\_paulis**`bool` |
|
||
| [`compute_variance`](#qiskit.opflow.expectations.PauliExpectation.compute_variance "qiskit.opflow.expectations.PauliExpectation.compute_variance")(exp\_op) | Compute the variance of the expectation estimator. |
|
||
| [`convert`](#qiskit.opflow.expectations.PauliExpectation.convert "qiskit.opflow.expectations.PauliExpectation.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
|
||
|
||
<Function id="qiskit.opflow.expectations.PauliExpectation.compute_variance" signature="compute_variance(exp_op)">
|
||
Compute the variance of the expectation estimator.
|
||
|
||
**Parameters**
|
||
|
||
**exp\_op** (`OperatorBase`) – The full expectation value Operator after sampling.
|
||
|
||
**Return type**
|
||
|
||
`Union`\[`list`, `float`, `ndarray`]
|
||
|
||
**Returns**
|
||
|
||
The variances or lists thereof (if exp\_op contains ListOps) of the expectation value estimation.
|
||
</Function>
|
||
|
||
### convert
|
||
|
||
<Function id="qiskit.opflow.expectations.PauliExpectation.convert" signature="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.
|
||
|
||
**Parameters**
|
||
|
||
**operator** (`OperatorBase`) – The operator to convert.
|
||
|
||
**Return type**
|
||
|
||
`OperatorBase`
|
||
|
||
**Returns**
|
||
|
||
The converted operator.
|
||
</Function>
|
||
</Class>
|
||
|