Visualizations

The visualizations in Circuit Composer show you different views of how quantum circuits affect the state of a collection of qubits. Each type of visualization is explained in detail below.

Randomness in the simulator

The visualizations come from a single-shot statevector simulator, which is different from the backend specified in the Run settings and the Run button. The simulator creates randomness by generating results based on a seed. The seed is the initial value introduced into the algorithm that generates pseudorandom numbers. Because the seed is fixed during your circuit session, your results will be repeatable. However, when you close your circuit and re-open it, the seed will have a new value, so you may see a different result. You can set the seed yourself by changing the value in the box (up to four digits) after the words Simulator seed above the Composer, and observe how the visualizations for your circuit change.

View visualizations

The visualizations are shown in windows at the bottom of the Composer workspace (except the phase disk, which appears at the end of each qubit wire). You can choose any combination of statevector, measurement probabilities, and q-sphere visualizations to appear at the bottom of the workspace. Select or unselect visualizations in the View menu.

Download visualizations

Download one of the visualizations at the bottom of the Composer workspace by clicking the More options menu in the visualization window. You can download visualizations as an SVG, a PNG, or a CSV of the underlying data. You can also download the visualization images of the measurement probabilities and statevector histograms as a PDF.

Measurement probabilities view

8-qubit limit

This view visualizes the measurement probabilities as a histogram. The vertical axis labels the computational basis states. The data labels to the right of the horizontal bars label the measurement probabilities of each computational basis state in terms of percentages. The probabilities P_i are related to the amplitudes \alpha_i of the computational basis states |i\rangle according to P_i = |\alpha_i|^2 .

Consider the following quantum circuit and its measurement probabilities view:

a quantum circuit measurement probabilities view

A quantum circuit and its measurement probabilities view.

The circuit puts a qubit in the state |\psi\rangle = (|0\rangle + i |1\rangle) / \sqrt{2} . The measurement probabilities are

P_0 = |\langle 0 | \psi \rangle|^2 = |1/\sqrt{2}|^2 = 1/2 = 50\% ,

P_1 = |\langle 1 | \psi \rangle|^2 = |i/\sqrt{2}|^2 = 1/2 = 50\% .

Phase disk

15-qubit limit

The phase disk at the terminus of each qubit in Circuit Composer gives the local state of each qubit at the end of the computation. The three components of the phase disk are described below.

Phase

The phase of the qubit state vector in the complex plane is given by the line that extends from the center of the diagram to the edge of the gray disk (which rotates counterclockwise around the center point).

phase of the local qubit state

Probability the qubit is in the |1\rangle state

The probability that the qubit is in the |1\rangle state is represented by the blue disk fill.

probability the qubit is in the 1 state

Reduced purity of the qubit state

The radius of the black ring represents the reduced purity of the qubit state, which for qubit j in an N -qubit state |\psi\rangle is given by \mathrm{Tr}\left[\mathrm{Tr}_{i\in [0, N-1], i\neq j}\left|\psi\rangle\langle\psi\right|\right]^{2} . The reduced purity for a single qubit is in the range [0.5, 1] ; a value of one indicates that the qubit is not entangled with any other party. In contrast, a reduced purity of 0.5 shows that the qubit is left in the completely mixed state, and has some level of entanglement over the remaining N-1 qubits, and possibly even the environment.

purity of the qubit state

Example: phase disks for two different qubits

phase disk examples

Two examples of the phase disk visualization.

Q-sphere view

5-qubit limit

The q-sphere represents the state of a system of one or more qubits by associating each computational basis state with a point on the surface of a sphere. A node is visible at each point. Each node’s radius is proportional to the magnitude of its basis state’s complex amplitude, whereas the node color indicates the phase of the complex amplitude.

The nodes are laid out on the q-sphere so that the basis state with all zeros (e.g., |000\rangle) is at its north pole, and the basis state with all ones (e.g., |111\rangle ) is at its south pole. Basis states with the same number of zeros (or ones) lie on a shared latitude of the q-sphere (e.g., |001\rangle, |010\rangle, |100\rangle ). Beginning at the north pole of the q-sphere and progressing southward, each successive latitude has basis states with a greater number of ones; the latitude of a basis state is determined by its Hamming distance from the zero state. The q-sphere contains the exact same information content as the statevector, but offers a more compact representation.

Consider the following quantum circuit and its q-sphere:

a quantum circuit

q-sphere view

A quantum circuit and the q-sphere representing the state the circuit creates.

You can select, hold, and drag to rotate the q-sphere. To return the q-sphere to its default orientation, select the rewind-arrow button to the top right of the q-sphere.

Note

It is important to highlight that the q-sphere is not the same as the Bloch sphere, even for a single qubit. Indeed, like the phase disk, the Bloch sphere gives a local view of the statevector, where each qubit is viewed on its own. This is important for, among other things, understanding how noise affects qubits, and what the bipartite entanglement is between the qubit of interest and the remaining N-1 . This is why the reduced purity, being a measure of entanglement, is included in the phase disk visualization. However, when trying to understand how registers of qubits (multi-qubit states) behave upon the application of quantum circuits, it is more insightful to take a global view and look at the statevector in its entirety. The q-sphere provides a visual representation of the statevector, and thus this global viewpoint. Therefore, when exploring quantum applications and algorithms on small numbers of qubits, the q-sphere should be the primary visualization method.

Statevector view

6-qubit limit

This view visualizes the statevector as a histogram. The horizontal axis labels the computational basis states. The vertical axis measures the magnitude of the amplitudes associated with each computational basis state. The color of each bar represents the phase angle of each amplitude.

Consider the following quantum circuit and its statevector view:

a quantum circuit statevector view

A quantum circuit and its statevector view.

phase colormap

The color wheel maps phase angle to color. The output state is expressed as a list of complex numbers.

The circuit puts a qubit in the state |\psi\rangle = (|0\rangle + i |1\rangle) / \sqrt{2} . The computational basis states are |0\rangle and |1\rangle . The magnitudes of the amplitudes are both 1/\sqrt{2} . The phases of the amplitudes are 0 and \pi/2 for |0\rangle and |1\rangle , respectively.