quri_parts.core.estimator.sampling.pauli module#

general_pauli_expectation_estimator(counts, pauli, reconstructor_factory)#

An implementation of PauliExpectationEstimator for a given PauliReconstructorFactory.

Parameters:
  • counts (core.sampling.MeasurementCounts) –

  • pauli (PauliLabel) –

  • reconstructor_factory (core.measurement.interface.PauliReconstructorFactory) –

Return type:

float

general_pauli_sum_expectation_estimator(counts, pauli_set, coefs, reconstructor_factory)#

Estimate expectation value of a weighted sum of commutable Pauli operators from measurement counts and Pauli reconstructor.

Note that this function calculates the sum for only Pauli operators contained in both of pauli_set and coefs.

Parameters:
  • counts (core.sampling.MeasurementCounts) –

  • pauli_set (core.operator.pauli.CommutablePauliSet) –

  • coefs (Mapping[PauliLabel, complex]) –

  • reconstructor_factory (core.measurement.interface.PauliReconstructorFactory) –

Return type:

complex

general_pauli_covariance_estimator(counts, pauli1, pauli2, reconstructor_factory)#

An implementation of PauliCovarianceEstimator for a given PauliReconstructorFactory.

Parameters:
  • counts (core.sampling.MeasurementCounts) –

  • pauli1 (PauliLabel) –

  • pauli2 (PauliLabel) –

  • reconstructor_factory (core.measurement.interface.PauliReconstructorFactory) –

Return type:

float

general_pauli_sum_sample_variance(counts, pauli_set, coefs, reconstructor_factory)#

Calculate sample variance of a weighted sum of commutable Pauli operators from measurement counts and Pauli reconstructor.

Note that this function calculates the variance of sum for only Pauli operators contained in both of pauli_set and coefs.

Parameters:
  • counts (core.sampling.MeasurementCounts) –

  • pauli_set (core.operator.pauli.CommutablePauliSet) –

  • coefs (Mapping[PauliLabel, complex]) –

  • reconstructor_factory (core.measurement.interface.PauliReconstructorFactory) –

Return type:

float

trivial_pauli_expectation_estimator(counts, pauli)#

An implementation of PauliExpectationEstimator, which assumes a “trivial” measurement of the Pauli string.

The “trivial” measurement of a Pauli string refers to a measurement in computational basis preceded by single qubit rotations to map each Pauli matrix on each qubit to \(Z\). For example, if the Pauli string contains \(X\) (\(Y\)) at a qubit index \(i\), then (an \(S^\dagger\) gate and) an Hadamard gate is applied on the qubit \(i\) before performing the \(Z\) measurements on all qubits.

Parameters:
  • counts (core.sampling.MeasurementCounts) –

  • pauli (PauliLabel) –

Return type:

float

trivial_pauli_covariance_estimator(counts, pauli1, pauli2)#

An implementation of PauliCovarianceEstimator, which assumes a “trivial” measurement of the Pauli string.

The “trivial” measurement of a Pauli string refers to a measurement in computational basis preceded by single qubit rotations to map each Pauli matrix on each qubit to \(Z\). For example, if the Pauli string contains \(X\) (\(Y\)) at a qubit index \(i\), then (an \(S^\dagger\) gate and) an Hadamard gate is applied on the qubit \(i\) before performing the \(Z\) measurements on all qubits.

Parameters:
Return type:

float