This document introduces the core features and components of Qhoir. It assumes some basic knowledge of classical circuit construction, as well as the knowledge of quantum information basics from the reader. Other than that, the reader is not required to have a more profound understanding of quantum computing. Instead, Qhoir values the process of learning by doing.
The quantum circuit editor Qhoir consists of three main components:
- Breadboard
- Utensil bal
- Toolbox
The breadboard is the main component of the editor. It allows you to construct circuits using components taken from the toolbox.
The utensil bar at the top of the interface provides several utensils to interact with your constructed circuit.
Finally, the toolbox contains all components that can be used in Qhoir. You can minimize it by pressing the white rectangle on its right.
In the following, we will go into more detail on each of these components and their elements.
The breadboard is visualized as a grid, where each cell represents a unit size of 1. By dragging your mouse over the editor while holding the left button (while the scroll tool is selected), you may scroll through the breadboard. On the top right, you see the coordinates of the part of the breadboard you are currently viewing.
Components can be added to the circuit by selecting them from the toolbox. While holding a component, a transparent drawing of it will be shown at your current mouse position. If the component cannot be placed, because this part of the circuit is already occupied, it will be indicated by a red highlight.
Some components can be clicked on the breadboard to open up their details view. In this view, more specific changes can be made to the component, and it may also contain further analytical information. More information on details views can be found in the section on components.
Clicking and dragging a placed component allows users to relocate the components to different positions.
Clicking a component's socket will select the socket in the editor, highlighting it in an orange hue. After clicking a second socket on a different component, a wire will be created connecting them. Only compatible sockets can be connected (input <-->output | quantum <--> quantum | classical <--> classical).
Sockets are indicated in the breadboard by circles at the socket's location. Input sockets are further marked by a black dot in their centre. Quantum sockets can be differentiated from classical sockets by their blue hue.
Simulation is performed automatically after each step if the simulator is not paused. Measurement results gathered during the simulation are indicated by measurement components directly in the circuit view. You may also click measurement components to open their details view for more information on the results.
Many classical circuit editing tools provide the functionality of "splitting" wires along their path to send the information of the current bit to multiple components. Due to the no-cloning theorem, creating such copies of qubits is not possible. Therefore, Qhoir generally does not support the splitting of wires directly. For classical bits, however, Qhoir provides the Fork component that has the same functionality.
The utensil bar is located at the very top of the editor. It contains the following utensils in order:
The scroll tool allows the user to drag the circuit to scroll the view, or to drag existing components. While the scroll tool is selected, users may also click components to open their details views.
The scroll tool is the default tool which is automatically selected if no other tool is active, or by pressing the "Esc" key.
Picking a component from the toolbar deactivates the scroll tool.
The eraser can be used to remove existing components from the circuit. In doing so, all the component's details view modifications, as well as its connected wires, are lost as well.
While the eraser is active, moving the mouse over a component in the circuit will highlight it in a red tone.
Picking a component from the toolbar or selecting the scroll tool deactivates the eraser.
While the snap setting is active, any movement of the mouse in the breadboard is "snapped" to the grid lines. This can be used to place components in a more precise manner next to each other.
The snap tool is selected while the "Alt" button is held. Releasing the "Alt" button will also deactivate the snap tool.
The undo and redo utensils can be used to rewind the last modifications made by the user on the circuit.
Please note that undo and redo only affect modifications made to the grid directly, not any modifications made inside a component's details view.
Undo / redo can be called using the shortcuts ctrl + z
and ctrl + y
respectively.
The save utensil downloads a JSON encoding of the current circuit to your device.
The load component allows users to upload such circuit encodings to the editor and loads them into the workspace.
The play / pause button is located on the very right of the utensil bar. It can be used to activate / deactivate Qhoir's statevector simulator. While the simulator is active, a simulation is run after each change made to the circuit.
Pausing the simulator will prevent such simulation runs. Please keep in mind that measurement results will not update while the simulator is paused.
The toolbox on the left of the editor consists of a list of components that can be added to your circuit. In this section, we will go into more detail on each of these components.
For a more rigorous introduction to quantum computing, please visit qiskit's textbook.
Tools represent the most basic components that are required to construct (meaningful) circuits: Sources and Measurements. Each circuit requires at least one source component to be run.
Qhoir distinguishes classical and quantum components. Therefore, a distinction between classical and quantum sources and measurements also has to be made to construct such circuits.
Classical gates represent circuit components that only require classical bits for their computation. As they do not need to be included in the statevector simulator with exponential blow-up, even large numbers of classical gates and bits can be supported and calculated in real time.
In principle, most classical gates supported by Qhoir implement the default logical operations of boolean algebra.
Single-Qubit gates are unitaries that operate on just one qubit. All quantum gates can be defined as unitary matrices. In this document, we will define gates by the action they perform on an arbitrary qubit of the form
The most commonly used and basic single-qubit gates are the three Pauli gates: X, Y, and Z.
Another important single-qubit gate is the Hadamard gate:
Finally, Qhoir supports three phase-shift gates: S, T, and Rz(
Multi-Qubit Gates take multiple qubits as inputs. Unlike classical gates, quantum gates must be reversible. This means that the number of input and output qubits for a quantum gate must always be equal.
The most common types of two-qubit gates are controlled gates. These gates take two qubits as input, a control qubit and a target qubit. It then performs a given action on the target qubit if the control qubit is equal to
For instance, the CX or CNOT gate performs the X gate on a target qubit. The transformation rules for it are:
if the leftmost qubit is the control, or more general:
In Qhoir, controlled gates are indicated by a black bar at the top. The control qubit is given through the input socket at the very top and corresponds to the topmost output socket. The following controlled two-qubit gates are available:
Controlled gates are not limited to just one control qubit. Generally, in quantum computing, controlled gates may have any number of control qubits, and are expected to perform their action on the target qubit if and only if ALL controls are in the state
Qhoir supports the CCX or CCNOT gate, also known as the Toffoli gate, which applies the Pauli X gate if both inputs (passed through the two topmost input sockets) are equal to
One final common two-qubit gate is the SWAP gate. It swaps the values of two given qubits. Generally, this gate plays less of an important role in Qhoir, as the position of gates and the directions of layers can be chosen arbitrarily, while usually, quantum circuits are designed with fixed horizontal lines as their quantum wires.
UI Blocks are non-functional components provided by Qhoir to improve the legibility of constructed circuits. They do not affect the values of bits or qubits passing through them but can be used to structure wires and components in the breadbox.