Skip to main content
IBM Quantum Platform
Esta página pertenece a una versión antigua de Qiskit SDK y no existe en la versión más reciente. Te recomendamos que actualices a la última versión. Consulta las notas de la versión para obtener más información.

MatrixExpectation

class qiskit.opflow.expectations.MatrixExpectation

GitHub

Bases: ExpectationBase

An Expectation converter which converts Operator measurements to be matrix-based so they can be evaluated by matrix multiplication.

Deprecated since version 0.24.0

The class qiskit.opflow.expectations.matrix_expectation.MatrixExpectation is deprecated as of qiskit-terra 0.24.0. It will be removed in the Qiskit 1.0 release. For code migration guidelines, visit https://qisk.it/opflow_migration.


Methods

compute_variance

compute_variance(exp_op)

Compute the variance of the expectation estimator. Because this expectation works by 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 Operator’s structure.

Parameters

exp_op (OperatorBase) – The full expectation value Operator.

Returns

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

Return type

list | float

convert

convert(operator)

Accept an Operator and return a new Operator with the Pauli measurements replaced by Matrix based measurements.

Parameters

operator (OperatorBase) – The operator to convert.

Returns

The converted operator.

Return type

OperatorBase

¿Le ha resultado útil esta página?
Informe de un error, de una errata o solicite contenido en GitHub.