Go to file
Jake Lishman 1fbee12a12
Monkeypatch docutils to fix bibliography output
This applies the patch discussed in gh-455 dynamically on import of
`docutils`, in order to fix the broken HTML output from the
`..  bibliography` directive. We constrain `docutils` during our build
process to fix it to a version that is known-good with this change
applied.  The constraint may be dropped when docutils updates, as the
relevant patch is merged to trunk.
2023-03-15 17:32:43 +00:00
.github Monkeypatch docutils to fix bibliography output 2023-03-15 17:32:43 +00:00
examples Merge branch 'lsmain' 2022-12-02 10:34:51 -05:00
releasenotes Drop dollar sign from pulse wildcard identifier 2022-06-20 18:16:49 +01:00
source Monkeypatch docutils to fix bibliography output 2023-03-15 17:32:43 +00:00
.gitignore Update the README, rename some classes 2021-10-06 23:28:43 -07:00
.pylintrc Conformance tests and contributing section (#18) 2017-09-19 22:24:15 -04:00
CODE_OF_CONDUCT.md change references to master for references to main 2022-03-14 12:14:02 +01:00
CONTRIBUTING.md Added `releasenotes` directory structure with `config.yaml` 2022-04-07 21:03:41 -06:00
LICENSE Update license file with correct details 2021-08-20 16:36:20 +01:00
Makefile Monkeypatch docutils to fix bibliography output 2023-03-15 17:32:43 +00:00
README.md Update README.md (#444) 2023-02-15 18:41:49 +00:00
WG.md Update profiles and releases WG chair and members 2023-02-14 11:12:15 -05:00
constraints.txt Monkeypatch docutils to fix bibliography output 2023-03-15 17:32:43 +00: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 Remove open question on staggered terms 2023-01-26 12:28:19 +00:00
make.bat Add infrastructure and first text for OpenQASM live spec (#58) 2020-11-03 15:58:34 -05:00
requirements.txt Use custom OpenQASM 3 lexer to highlight code examples (#370) 2022-06-28 00:04:36 +01:00

README.md

OpenQASM

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

This repo contains the OpenQASM specification, examples, and tools for the OpenQASM intermediate representation.

OpenQASM is a Qiskit project.

Current version: 3.0

About this project

In 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

An example of OpenQASM 3.0 source code is given below. Several more examples may be found in the examples folder.

/*
 * 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

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. This project adheres to a Code of Conduct. By participating, you are expected to uphold this code.

Release Notes

See the section on Release Notes contribution guidelines