cQASM: Display commands

Note: The following text describes features of the Quantum Inspire platform that are currently under development. In future releases of this platform, any display_binary or display statements in the cQASM file will be captured and will be made available for inspection. In the current release, the output of any display or display_binary command you place in your code is simply ignored.

Introduction

cQASM provides two instructions to obtain the contents of the qubit register or the binary register:

  • display obtains the full quantum state of the system, expressed in the z-basis
  • display_binary obtains the contents of the binary register

These instructions can be used to debug your algorithm or to get intermediate states of the qubit register or binary register. The display instruction can only be used in simulations.

Display

The display instruction writes the current state of the qubit register, i.e. a description of the full quantum state to the emulator output file.

The display instruction will only output the probability amplitude values for non-zero basis states, but since the full quantum state can take up a huge amount of memory, displaying the full quantum state should be used with care.

Display_binary

The display_binary instruction writes all or part of the current state of the measurement register to the emulator output file.

Quantum Inspire will implicitly output the classical register at the end of all circuits as if you have a display_binary instruction at the end of your program. The output is used to generate the histogram in the result detail page.