merge_disjoint_experiments

forest.benchmarking.observable_estimation.merge_disjoint_experiments(experiments: List[forest.benchmarking.observable_estimation.ObservablesExperiment], group_merged_settings: bool = True) → forest.benchmarking.observable_estimation.ObservablesExperiment

Merges the list of experiments into a single experiment that runs the sum of the individual experiment programs and contains all of the combined experiment settings.

A group of ObservablesExperiments whose programs operate on disjoint sets of qubits can be ‘parallelized’ so that the total number of runs can be reduced after grouping the settings. Settings which act on disjoint sets of qubits can be automatically estimated from the same run on the quantum computer.

If any experiment programs act on a shared qubit they cannot be thoughtlessly composed since the order of operations on the shared qubit may have a significant impact on the program behaviour; therefore we do not recommend using this method if this is the case.

Even when the individual experiments act on disjoint sets of qubits you must be careful not to associate ‘parallel’ with ‘simultaneous’ execution. Physically the gates specified in a pyquil Program occur as soon as resources are available; meanwhile, measurement happens only after all gates. There is no specification of the exact timing of gates beyond their causal relationships. Therefore, while grouping experiments into parallel operation can be quite beneficial for time savings, do not depend on any simultaneous execution of gates on different qubits, and be wary of the fact that measurement happens only after all gates have finished.

Note that to get the time saving benefits the settings must be grouped on the merged experiment–by default this is done before returning the experiment.

Parameters:
  • experiments – a group of experiments to combine into a single experiment
  • group_merged_settings – By default group the settings of the merged experiment.
Returns:

a single experiment that runs the summed program and all settings.