qrunch.quantum.estimators.excitation_gate_estimator
Module with implementations of excitation gate estimator.
Classes
Class for estimating observables of spin particle preserving "excitation-gate-circuits". |
- class ExcitationGateEstimator
Bases:
EstimatorClass for estimating observables of spin particle preserving “excitation-gate-circuits”.
An “excitation-gate-circuit” means a circuit consisting of only:
a number of X gates to begin with,
single or double excitation gates for the remaining part of the circuit.
This class, in particular, is for the case where the number of qubits is even, and the number of excitations in the first and second half of the circuit is conserved separately. In particular, for a circuit with 2N qubits, all the single and double excitation gates have to preserve the number of 1’s in first N (and last N) qubits.
- __init__(options: ExcitationGateSimulatorOptions, grouper: MeasurementGrouper | None = None, error_mitigator: EstimatorErrorMitigator | None = None) None
Initialize estimator.
- Parameters:
options (ExcitationGateSimulatorOptions) – Options for the estimator.
grouper (MeasurementGrouper | None) – Grouper to use when running with shots.
error_mitigator (EstimatorErrorMitigator | None) – Error mitigator to be used for encoding the observable or circuit more error resistantly.
- Return type:
None
- clear_cache() None
Clear the measurement cache.
- Return type:
None
- has_spin_particle_conservation() bool
Return True, if the estimator is set to use spin particle conservation.
- Return type:
bool
- has_total_particle_conservation() bool
Return True, if the estimator is set to use total particle conservation.
- Return type:
bool
- run(observables: Sequence[int | float | complex | Expression[PauliOperators]] | int | float | complex | Expression[PauliOperators] | Sequence[HermitianPauliSum] | HermitianPauliSum, circuits: Circuit | Sequence[Circuit], shots: int | None) ExpectationValue | list[ExpectationValue] | EstimatorResults
Estimate the value of the observables using the circuit state.
For each observable the following will be calculated: <circuit|observable|circuit>.
- Parameters:
observables (Sequence[int | float | complex | Expression[PauliOperators]] | int | float | complex | Expression[PauliOperators] | Sequence[HermitianPauliSum] | HermitianPauliSum) – Observable(s) to be estimated.
circuits (Circuit | Sequence[Circuit]) – States to make estimation from.
shots (int | None) – number of shots or None if using a full state vector calculation.
- Return type:
ExpectationValue | list[ExpectationValue] | EstimatorResults
- supports_shots_equals_none() bool
Return whether the estimator supports shots = None.
The ExcitationGateEstimator does support shots=None
- Return type:
bool