Go to file
Luciano Bello 2a07ac6a26 archive openpulse, remove grammar 2021-09-28 13:32:13 +02:00
.github Create Python package for reference parser 2021-08-20 13:31:08 +01:00
examples Remove fixed point from vqe example 2021-08-30 11:49:44 -04:00
plugins/vim Merge branch 'master' into remove-fixed-type 2021-09-15 22:51:40 +02:00
source Update delays.rst 2021-09-24 11:44:24 +05:30
.gitignore Create Python package for reference parser 2021-08-20 13:31:08 +01:00
.pylintrc Conformance tests and contributing section (#18) 2017-09-19 22:24:15 -04:00
CODE_OF_CONDUCT.md Reference Qiskit CODE OF CONDUCT 2020-12-11 17:36:14 -05:00
LICENSE Update license file with correct details 2021-08-20 16:36:20 +01:00
Makefile Add infrastructure and first text for OpenQASM live spec (#58) 2020-11-03 15:58:34 -05:00
README.md Add plugin information to README 2021-07-19 14:35:53 +01:00
WG.md archive openpulse, remove grammar 2021-09-28 13:32:13 +02:00
contributing.md Fixed typos in contributing.md 2020-05-13 10:14:51 -07:00
convert2pdf.py Add utils for converting from tex to pdf then svg for postprocessing tikz images 2020-12-11 16:58:56 -05:00
convert2svg.py Add utils for converting from tex to pdf then svg for postprocessing tikz images 2020-12-11 16:58:56 -05:00
governance.md Update governance model 2021-08-13 14:43:23 -04:00
make.bat Add infrastructure and first text for OpenQASM live spec (#58) 2020-11-03 15:58:34 -05:00
requirements.txt Remove Travis configuration 2021-08-16 11:09:41 +01:00

README.md

OpenQASM

OpenQASM is an imperative programming language for describing quantum circuits. It is capable to describe universal quantum computing using the circuit model, measurement-based model, and near-term quantum computing experiments.

Specs, examples and tools for the OpenQASM intermediate representation.

Current version: 3.0

Live doc: version 3.0

For previous version see: 2.0

About this project

On this repository, you'll find all the documentation related to OpenQASM, some useful OpenQASM examples, and plugins for some text editors.

Language specs

The live language documentation specification.

Examples

The examples can be found under the examples folder.

They are OpenQASM files, i.e.:

/*
 * Repeat-until-success circuit for Rz(theta),
 * cos(theta-pi)=3/5, from Nielsen and Chuang, Chapter 4.
 */
OPENQASM 3;
include "stdgates.inc";

/*
 * Applies identity if out is 01, 10, or 11 and a Z-rotation by
 * theta + pi where cos(theta)=3/5 if out is 00.
 * The 00 outcome occurs with probability 5/8.
 */
def segment qubit[2] anc, qubit psi -> bit[2] {
  bit[2] b;
  reset anc;
  h anc;
  ccx anc[0], anc[1], psi;
  s psi;
  ccx anc[0], anc[1], psi;
  z psi;
  h anc;
  measure anc -> b;
  return b;
}

qubit input;
qubit[2] ancilla;
bit[2] flags = "11";
bit output;

reset input;
h input;

// braces are optional in this case
while(int(flags) != 0) {
  flags = segment ancilla, input;
}
rz(pi - arccos(3 / 5)) input;
h input;
output = measure input;  // should get zero

Plugins

This repository also contains a plugin for working with OpenQASM 2.0 and 3.0 files in vim. You can find its full documentation in the plugins/vim directory.

Citation format

For research papers, we encourage authors to reference.

  • [Version 3.0] Andrew W. Cross, Ali Javadi-Abhari, Thomas Alexander, Niel de Beaudrap, Lev S. Bishop, Steven Heidel, Colm A. Ryan, John Smolin, Jay M. Gambetta, Blake R. Johnson "OpenQASM 3: A broader and deeper quantum assembly language" [arxiv:2104.14722].
  • [Previous Version: 2.0] Andrew W. Cross, Lev S. Bishop, John A. Smolin, Jay M. Gambetta "Open Quantum Assembly Language" [arXiv:1707.03429].

Governance

The OpenQASM project has a process for accepting changes to the language and making decisions codified in its governance model.

License

This project is licensed under the Apache License 2.0 - see the [LICENSE] file for details.

Contributing

If you'd like to help please take a look to our contribution guidelines.