Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/itsubaki/qasm
Run Quantum Computation Simulator with OpenQASM 3.0
https://github.com/itsubaki/qasm
openqasm quantum-computation quantum-computing
Last synced: 9 days ago
JSON representation
Run Quantum Computation Simulator with OpenQASM 3.0
- Host: GitHub
- URL: https://github.com/itsubaki/qasm
- Owner: itsubaki
- License: mit
- Created: 2021-08-01T12:15:55.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-08-24T04:48:49.000Z (4 months ago)
- Last Synced: 2024-08-24T05:41:00.690Z (4 months ago)
- Topics: openqasm, quantum-computation, quantum-computing
- Language: Go
- Homepage: https://pkg.go.dev/github.com/itsubaki/qasm
- Size: 495 KB
- Stars: 12
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# qasm
[![PkgGoDev](https://pkg.go.dev/badge/github.com/itsubaki/qasm)](https://pkg.go.dev/github.com/itsubaki/qasm)
[![Go Report Card](https://goreportcard.com/badge/github.com/itsubaki/qasm?style=flat-square)](https://goreportcard.com/report/github.com/itsubaki/qasm)
[![tests](https://github.com/itsubaki/qasm/workflows/tests/badge.svg?branch=main)](https://github.com/itsubaki/qasm/actions)
[![codecov](https://codecov.io/gh/itsubaki/qasm/branch/main/graph/badge.svg?token=94KAQTK9KT)](https://codecov.io/gh/itsubaki/qasm)- Run Quantum Computation Simulator with [OpenQASM 3.0](https://openqasm.com)
## Install
```shell
go install github.com/itsubaki/qasm@latest
```## Example
```shell
$ cat testdata/bell.qasm
OPENQASM 3.0;
include "testdata/stdgates.qasm";qubit[2] q;
reset q;h q[0];
cx q[0], q[1];
``````shell
$ qasm -f testdata/bell.qasm
[00][ 0]( 0.7071 0.0000i): 0.5000
[11][ 3]( 0.7071 0.0000i): 0.5000
```## REPL
```shell
$ 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`