A Quantum Circuit DSL
Project description
abraxas
A tiny DSL to compile to qiskit circuits. The goal is to speed up the time it takes to write small stupid circuits. Anything beyond a certain complexity should be written in qiskit directly.
Qiskit • Abraxas • Issues • Latest
Install
While not specified here you will need Qiskit since Abraxas takes in an initialized QuantumCircuit
object to write to.
pip install abrax
Examples
Fairly Complex
from abrax import A
from qiskit import QuantumCircuit
qc = QuantumCircuit(5)
qc = A("""
- H CX(4) RX(10)
- H - -
- H - CX(4)
- H X RY(55)
- H - -
""", qc
)
# Should be equivalent to
from qiskit import QuantumCircuit
qc = QuantumCircuit(5)
qc.h([0, 1, 2, 3, 4])
qc.cx(0, 4)
qc.x(3)
qc.rx(10, 0)
qc.cx(2, 4)
qc.ry(55, 3)
qc.measure_all()
Simple
from abrax import A
from qiskit import QuantumCircuit
qc = QuantumCircuit(2)
# This will apply H, H to 0-qubit & 1-qubit
# Then a CX on 0-qubit (as target) with 1-qubit as control
qc = A("""
- H CX(1)
- H -
""", qc
)
Syntax
- Note All lines must start with a
-
or|>
(continuation operatorNotImplemented
yet) - Everything else is a comment
- Case insensitive
Passing Config
qc = A("""
- H CX(1)
- H -
""", qc,
config={
"measure": False,
})
Key | Type (Default) | Description |
---|---|---|
measure |
bool (True ) |
Whether to measure all qubits at the end of the circuit |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
abrax-0.2.0.tar.gz
(3.6 kB
view details)
Built Distribution
abrax-0.2.0-py3-none-any.whl
(3.8 kB
view details)
File details
Details for the file abrax-0.2.0.tar.gz
.
File metadata
- Download URL: abrax-0.2.0.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6bf77fa3fcb38d8606208cd2ae50c323cfe67c6b0d8b4257d72be3cbbca9a8c7 |
|
MD5 | ec4c932a71cf62154814bc86b293b5ae |
|
BLAKE2b-256 | 5756f940a7b72df64c5f687ef294d971accce7d6e9aa5fe12310bfef3e9e9f8e |
File details
Details for the file abrax-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: abrax-0.2.0-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d27b2d769c41dab8d064028aab8e18728719ca37f821d5c8a116279b898216a |
|
MD5 | 2064de128cac7471f5bafef7d6e0e207 |
|
BLAKE2b-256 | 83f9bed832ba5ff855cd6c7a8fc3bac975a6f5d20ba444579dbd54b965bf8e6d |