qiskit-documentation/docs/api/qiskit/0.31/qiskit.aqua.operators.expec...

59 lines
2.1 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: AerPauliExpectation (v0.31)
description: API reference for qiskit.aqua.operators.expectations.AerPauliExpectation in qiskit v0.31
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit.aqua.operators.expectations.AerPauliExpectation
---
# AerPauliExpectation
<Class id="qiskit.aqua.operators.expectations.AerPauliExpectation" isDedicatedPage={true} github="https://github.com/qiskit-community/qiskit-aqua/tree/stable/0.9/qiskit/aqua/operators/expectations/aer_pauli_expectation.py" signature="AerPauliExpectation" modifiers="class">
Bases: `qiskit.aqua.operators.expectations.expectation_base.ExpectationBase`
An Expectation converter for using Aers operator snapshot to take expectations of quantum state circuits over Pauli observables.
## Methods
<span id="qiskit-aqua-operators-expectations-aerpauliexpectation-compute-variance" />
### compute\_variance
<Function id="qiskit.aqua.operators.expectations.AerPauliExpectation.compute_variance" signature="AerPauliExpectation.compute_variance(exp_op)">
Compute the variance of the expectation estimator. Because Aer takes this expectation with matrix multiplication, the estimation is exact and the variance is always 0, but we need to return those values in a way which matches the Operators structure.
**Parameters**
**exp\_op** (`OperatorBase`) The full expectation value Operator after sampling.
**Return type**
`Union`\[`list`, `float`]
**Returns**
The variances or lists thereof (if exp\_op contains ListOps) of the expectation value estimation, equal to 0.
</Function>
<span id="qiskit-aqua-operators-expectations-aerpauliexpectation-convert" />
### convert
<Function id="qiskit.aqua.operators.expectations.AerPauliExpectation.convert" signature="AerPauliExpectation.convert(operator)">
Accept an Operator and return a new Operator with the Pauli measurements replaced by AerSnapshot-based expectation circuits.
**Parameters**
**operator** (`OperatorBase`) The operator to convert.
**Return type**
`OperatorBase`
**Returns**
The converted operator.
</Function>
</Class>