Giter Site home page Giter Site logo

williamlisci / openqasm Goto Github PK

View Code? Open in Web Editor NEW

This project forked from openqasm/openqasm

0.0 1.0 0.0 11.01 MB

Quantum assembly language for extended quantum circuits

License: Apache License 2.0

TeX 81.90% Makefile 0.84% Python 9.38% Batchfile 0.50% ANTLR 7.39%

openqasm's Introduction

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 and some useful OpenQASM examples.

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 ancilla[2];
bit flags[2] = "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.

  • Andrew W. Cross, Lev S. Bishop, John A. Smolin, Jay M. Gambetta "Open Quantum Assembly Language" [arXiv:1707.03429].

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.

openqasm's People

Contributors

jaygambetta avatar delapuente avatar blakejohnson avatar ajavadia avatar awcross1 avatar jwoehr avatar taalexander avatar hitomitak avatar ismaelfaro avatar johnzl-777 avatar adcorcol avatar ewinston avatar travis-s-ibm avatar zachschoenfeld33 avatar stevenheidel avatar hushaohan avatar levbishop avatar cbjuan avatar francabrera avatar adjs avatar desireevl avatar hhorii avatar jesusprubio avatar kdk avatar mtreinish avatar omarcostahamido avatar singular-value avatar rolfhuisman avatar skissane avatar mihbor avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.