View on GitHub
Open this notebook in GitHub to run it yourself
- For a number of qubits , a circuit is made of the quantum layer.
- Each layer consists of a unitary operation between pairs of qubits.
- The unitary operation between each pair is the Haar random matrix; i.e., an SU(4) operation containing a random complex number in such a manner that the probability of measuring a quantum state is kept with uniform distribution.
- A single circuit of qubits is measured and the heavy output probability (i.e., the probability of measuring the states above the median value) is calculated.
- For an assessment of the quantum volume, the demand subsides to the following inequality: (1)
- For a given output, to get the quantum volume, repeat Items 1-4 for an increasing number of qubits until the inequality described in Item 4 does not hold. To ensure it, the circuits are created many times and the average and standard deviation are taken into account.
- The quantum volume is two to the power of the number of qubits, such that they pass inequality (1) as per the procedure described in Items 1-
- The heavy output probability is a good measurement of the quality of the circuit, as noise reduces the probabilities of uniform distribution.
Step 1: Create a Haar Random Unitary Matrix
Create a function, generating a (n,n) sized Haar random unitary matrix [2]. This matrix contains a random complex number that is distributed evenly in the space of quantum states. The Haar distribution indicates how to weight the elements of such that uniform distribution occurs in the parameter space.Step 2: Create a Quantum Volume Circuit
Theqv_model function creates the quantum volume model for a given number of qubits.
For qubits, the circuit must include quantum volume layers.
The layers are built using the qv_layer function, which creates random pairing between the qubits. (For an odd number, a randomly chosen qubit is not operational.) Between each pair, a unitary gate operates, consisting of a Haar random unitary matrix of size
Step 3: Execute and Analyze
The execution and analysis part consists of these functions:execute_qvsends a quantum program for execution on a given quantum hardware with a specified number of shots.
heavy_outputs_probanalyzes the results from execution and returns the heavy output probability; i.e., the probability for a single state in the space to be greater than the median value (median = “middle” of a sorted list of numbers).
round_significant function rounds a number for one significant figure.
Step 4: Find the Quantum Volume Algorithm
Using the previously defined functions,find_qv finds the quantum volume value for defined parameters including hardware definitions.
The find_qv function sends the value of heavy output probability for each number of qubits defined (between min_qubit and max_qubits).
This repeats num_trials times. Then, the heavy output probability is averaged, and the standard deviation is calculated. If the number of qubits chosen for the circuit is less than the number of qubits in the chosen hardware, the qubits are randomly picked to run according to the rules of the hardware provider.
The quantum volume qubits number is defined as the larger number of qubits for which the heavy output probability, decreased by two sigma (twice the standard deviation), is greater than or equal to 2/
- The quantum volume is two to the power of the number of quantum volume qubits.
max_qubits, there is a possibility that the quantum volume is greater than found by the function. In this case, run the program for a greater span.
Examples
Run the code to find the quantum volume of several quantum simulators and hardware backends.Running with the Classiq Simulator
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Output:
Running with Rigetti Aspen M-3
Running with IBM Cloud targets
Run on a few IBM machines:- ibm_fez with a reported quantum volume of 8
- ibm_marrakesh with a reported quantum volume of 16
- ibm_sherbrooke with a reported quantum volume of 32