ObservablesExperiment

class forest.benchmarking.observable_estimation.ObservablesExperiment(settings: Union[List[forest.benchmarking.observable_estimation.ExperimentSetting], List[List[forest.benchmarking.observable_estimation.ExperimentSetting]]], program: pyquil.quil.Program)

A data structure for experiments involving estimation of the expectation of various observables measured on a core program, possibly with a collection of different preparations.

Many near-term quantum algorithms involve:

  • some limited state preparation, e.g. prepare a Pauli eigenstate
  • enacting a quantum process (like in tomography) or preparing a variational ansatz state (like in VQE) with some circuit.
  • Measure the output of the circuit w.r.t. expectations of Pauli observables

Where we typically use a large number of (state_prep, measure_observable) pairs but keep the quantum circuit program consistent. This class stores the circuit program as a Program and maintains a list of ExperimentSetting objects which each represent a (state_prep, measure_observable) pair. Settings diagonalized by a shared tensor product basis (TPB) can (optionally) be estimated simultaneously. Therefore, this class is backed by a list of list of ExperimentSettings. Settings sharing an inner list will be estimated simultaneously. If you don’t want this, provide a list of length-1-lists. As a convenience, if you pass a 1D list to the constructor will expand it to a list of length-1-lists.

This class will not group settings for you. Please see group_settings() for a function that will automatically process a ObservablesExperiment to group Experiments sharing a TPB.