sample_rand_circuits_for_heavy_out

forest.benchmarking.quantum_volume.sample_rand_circuits_for_heavy_out(qc: pyquil.api._quantum_computer.QuantumComputer, qubits: Sequence[int], depth: int, program_generator: Callable[[pyquil.api._quantum_computer.QuantumComputer, Sequence[int], Sequence[numpy.ndarray], numpy.ndarray], pyquil.quil.Program], num_circuits: int = 100, num_shots: int = 1000, show_progress_bar: bool = False) → int

This method performs the bulk of the work in the quantum volume measurement.

For the given depth, num_circuits many random model circuits are generated, the heavy outputs are determined from the ideal output distribution of each circuit, and a native quil implementation of the model circuit output by the program generator is run on the qc. The total number of sampled heavy outputs is returned.

Parameters:
  • qc – the quantum resource that will implement the PyQuil program for each model circuit
  • qubits – the qubits available in the qc for the program_generator to use.
  • depth – the depth (and width in num of qubits) of the model circuits
  • program_generator – a method which takes an abstract description of a model circuit and returns a native quil program that implements that circuit. See measure_quantum_volume docstring for specifics.
  • num_circuits – the number of random model circuits to sample at this depth; should be >100
  • num_shots – the number of shots to sample from each model circuit
  • show_progress_bar – displays a progress bar via tqdm if true.
Returns:

the number of heavy outputs sampled among all circuits generated for this depth