Experimenton a QVM or QPU backend. An
Experimentis composed of:
Programbody (or ansatz).
A collection of
ExperimentSettingobjects, each of which encodes a particular state preparation and measurement.
SymmetrizationLevelfor enacting different readout symmetrization strategies.
A number of shots to collect for each (unsymmetrized)
Because the main
Programis static from run to run of an
Experiment, we can leverage our platform’s Parametric Compilation feature. This means that the
Programcan be compiled only once, and the various alterations due to state preparation, measurement, and symmetrization can all be realized at runtime by providing a
memory_map. Thus, the steps in the
experimentmethod are as follows:
Check to see if this
Experimenthas already been loaded into this
QuantumComputerobject. If so, skip to step 2. Otherwise, do the following:
Generate a parameterized program corresponding to the
Experiment.generate_experiment_program()method for more details on how it changes the main body program to support state preparation, measurement, and symmetrization).
Compile the parameterized program into a parametric (binary) executable, which contains declared variables that can be assigned at runtime.
Experiment, we repeat the following:
Build a collection of memory maps that correspond to the various state preparation, measurement, and symmetrization specifications.
Run the parametric executable on the QVM or QPU backend, providing the memory map to assign variables at runtime.
Extract the desired statistics from the classified bitstrings that are produced by the QVM or QPU backend, and package them in an
Return the list of
This method is extremely useful shorthand for running near-term applications and algorithms, which often have this ansatz + settings structure.
Experiment) – The
float]]]]) – A dictionary mapping declared variables / parameters to their values. The values are a list of floats or integers. Each float or integer corresponds to a particular classical memory register. The memory map provided to the
experimentmethod corresponds to variables in the main body program that we would like to change at runtime (e.g. the variational parameters provided to the ansatz of the variational quantum eigensolver).
- Return type
A list of
ExperimentResultobjects containing the statistics gathered according to the specifications of the