qrunch.quantum.estimators.tensor_network_estimator
Tensor network estimator.
Classes
Estimator using a tensor network simulator. |
|
Configuration options for the TensorNetworkEstimator. |
- class TensorNetworkEstimator
Bases:
EstimatorEstimator using a tensor network simulator.
- __init__(simulator: TensorNetworkSimulator, error_mitigator: EstimatorErrorMitigator | None = None, options: TensorNetworkEstimatorOptions | None = None) None
Initialize the tensor network estimator.
- Parameters:
simulator (TensorNetworkSimulator) – The tensor network simulator to use.
error_mitigator (EstimatorErrorMitigator | None) – Error mitigator to be used for encoding the observable or circuit more error resistantly.
options (TensorNetworkEstimatorOptions | None) – Configuration options for preprocessing. If None, defaults to no preprocessing.
- 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.
Shots = None means that a full state vector simulation is done.
- Return type:
bool
- class TensorNetworkEstimatorOptions
Bases:
objectConfiguration options for the TensorNetworkEstimator.
- Parameters:
use_lightcone_preprocessing – If True, apply light cone cancellation preprocessing to remove gate/conjugate pairs that cancel (G·G† = I). Default is False.
use_rank_simplification_preprocessing – If True, apply rank-2 simplification preprocessing to contract all low-rank (≤2) tensors. Default is False.
- __init__(use_lightcone_preprocessing: bool = False, use_rank_simplification_preprocessing: bool = False) None
- Parameters:
use_lightcone_preprocessing (bool)
use_rank_simplification_preprocessing (bool)
- Return type:
None
- use_lightcone_preprocessing: bool = False
- use_rank_simplification_preprocessing: bool = False