Working with the editor

Within 'My QI', you enter the editor for a specific project by clicking on the project title. When a new project is created, you enter the editor automatically as well. Within editor mode, you can click 'close editor' to exit the editor and return to the 'My QI' projects page.

Layout

The following description assumes you are working on a computer or laptop. On mobile devices the various panes may be shown beneath each other instead of next to each other in order to fit the screen.

When you work on a quantum algorithm the main editor is shown. The left pane is the code window where your cQASM code is displayed. The right pane shows a list of available qubit operations, and the bottom pane shows the circuit visualizer.

At the top left of the editor you find links to go to the results tab or back to the editor tab. In the center, the filename of your current project is shown and on the right side a RUN button is shown to execute the algorithm. Other sections of this guide provide more information on executing your algorithms and displaying and downloading your results.

Editor

note: when you click on the "open in editor" link, the code below is copied into your editor.

A typical cQASM program could look like this:

        
          version 1.0
qubits 2

{prep_z q[0] | prep_z q[1]}

# Create a superposition state for qubit 0
H q[0]

# Entangle both qubits using a CNOT gate
CNOT q[0], q[1]
        
      

You can type your cQASM program directly in the editor. The editor checks your code for obvious problems such as syntax errors, multiple operations on the same qubit at the same time, out-of-range errors, etc. Syntax highlighting is used to easily discriminate between instructions, operands, comments etc.

Note that syntax errors are signaled in the editor by a clear warning, but this does not prevent the code from being saved.

Although the editor may catch the most obvious syntax errors, your code could still contain other problems which result in execution errors.

Saving your project

All code is automatically saved to file. The paragraph managing your projects provides more information on working with different projects and returning to previous versions.

Operations and backend tab

Next to the editor you see two tabs:

  • The operations tab gives an overview of all cQASM commands and qubit operations, with their definition and a link to more detailed information. You can also copy a command to your clipboard and paste it anywhere in your code.
  • The backend tab provides information about the currently selected backend, the most current calibration data of this backend (when online) and the status of that backend. You can switch to another backend by pressing 'Select Backend'.

Visualization of the algorithm

The circuit diagram corresponding to the cQASM code is shown beneath the editor pane. The circuit is automatically rendered from the code in real time. Both the code display and the circuit visualization use differing colors to distinguish initialization and measurement operations from qubit operations and comments.

If your algorithm contains many lines of code, the rendering of the circuit could take some time. For very long algorithms our Software Development Kit (SDK) may be more appropriate.

q[0]
 
 
 
 
 
 
 
 
q[1]
 
 
 
 
 
 
 
 

In the editor you can type your own code or copy and paste existing algorithms. From the operations list on the right you can copy cQASM instructions to your clipboard and paste them anywhere in your code.