When you execute a quantum algorithm and examine the results (which are shown in a histogram) it is important to understand a few basic things:
- Superposition and entanglement influence the possible outcomes of a quantum measurement
- Qubits can be measured in different bases and the measurement basis influences the outcome of a measurement
- Quantum Inspire makes a difference between deterministic and non-deterministica algorithms which determines the way your algorithm will be executed
- A binary register is used to store the outcome of the measurement results. The resulting histogram shows the state of the binary register.
Selecting a result
You can click on any of the rows that shows 'Done' (as opposed to 'Scheduled' or 'Running') to view the results. s Note: The status of the execution is not automatically pushed to the web browser when the algorithm is ready. On most browsers clicking F5 will refresh your browser
Understanding the histogram
In addition to showing your algorithm code and visualisation, the result page shows a histogram.
In essence, what the histogram shows is the probability of the outcome of a state measurement at the end of the algorithm. To interpret this histogram you should be aware of two things:
- The labels on the x-axis show the value of the binary register, and the bits are ordered such that the most-significant bit is the leftmost bit and the least significant bit is the rightmost bit; so the measurement for qubit 0 is the rightmost bit, the measurement for qubit 3 is the 3th bit from the right;
- There are three different modes in which simulations can run; each mode implements a different way of obtaining the data that generates the histogram.
The different modes are explained in detail below.
Deterministic algorithms using a single shot (N=1)
If the algorithm is deterministic, it can be executed with simulation optimization.
When this mode is running with a single shot (number of shots is 1), the histogram data will contain the probability amplitude values of the final state in the computational z-basis. The histogram will be determined directly from the final state probability amplitudes. In this case the raw data file will only contain one entry, which is the same as the histogram data.
Deterministic algorithms with multiple shots (N>1)
When executing with simulation optimization and more than one shot, the histogram will be determined using a Monte Carlo simulation, based on the probability amplitudes of the final state. More information on the exact steps is given in the page on simulation optimization.
When running a non-deterministic algorithm on the simulator, or when running an algorithm on actual hardware, the result is obtained by executing the algorithm multiple times (the number of shots) and reading out the binary measurement register. The histogram reflects the observed frequency of distinct measurement register values. Note that the binary register is always initialized to zeroes, so when a qubit is not measured at all, the corresponding bit in the binary register (and thus in the histogram) will be zero, but that value has no relationship with the actual qubit state.
Downloading results files
The result page offers links that download the histogram data and other data as a csv (comma-separated values) file for importing the data into a spreadsheet or as a json file for structured processing by other software.
The download links available are for:
- histogram data; a list of the bins in the histogram and their probabilities;
- raw data; a list of all observed measurement outcomes or states (empty when simulation optimization with 1 shot is executed);
- observed state; currently empty, in future versions will contain quantum state output from all
displaystatements in the algorithm for debugging purposes;
- measurement register; only valid when running without simulation optimization; contains the measurement register values for all
Histogram data syntac
The histogram data is given as a table of decimal values for the measurement register and the normalized frequency of observing that value over all shots (non-observed values are omitted from the table). Example:
Raw data syntax
The raw data is a list of integers, each integer being the decimal representation of the value of the measurement register at the end of each shot. Example:
[6,6,6,6,6,1,6,3,6,6,6,6,6,4,6,6,6,6,6,6,6,6,6,6,6,6, ... ]