Skip to content

itsubaki/qasm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

qasm

PkgGoDev Go Report Card tests codecov

Install

go install github.com/itsubaki/qasm@latest

Example

$ cat testdata/bell.qasm
OPENQASM 3.0;
include "testdata/stdgates.qasm";

qubit[2] q;
reset q;

h q[0];
cx q[0], q[1];
$ qasm -f testdata/bell.qasm
[00][  0]( 0.7071 0.0000i): 0.5000
[11][  3]( 0.7071 0.0000i): 0.5000

REPL

$ qasm repl
>> OPENQASM 3.0;
>>
>> gate h q { U(pi/2.0, 0.0, pi) q; }
>> gate x q { U(pi, 0, pi) q; }
>> gate cx q, p { ctrl @ x q, p; }
>>
>> qubit[2] q;
[00][  0]( 1.0000 0.0000i): 1.0000
>> h q[0];
[00][  0]( 0.7071 0.0000i): 0.5000
[10][  2]( 0.7071 0.0000i): 0.5000
>> cx q[0], q[1];
[00][  0]( 0.7071 0.0000i): 0.5000
[11][  3]( 0.7071 0.0000i): 0.5000

built-in

  • U, X, Y, Z, H, S, T
  • QFT, IQFT, CMODEXP2
  • print