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.1.tar.gz
(3.7 kB
view details)
Built Distribution
abrax-0.2.1-py3-none-any.whl
(3.9 kB
view details)
File details
Details for the file abrax-0.2.1.tar.gz
.
File metadata
- Download URL: abrax-0.2.1.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2627caeec78939f0b25ed0aec47fa940fd79029f29cf5fb7bc4ebe6ab446a28 |
|
MD5 | b753230753281f224016d88ae4e024c7 |
|
BLAKE2b-256 | 3c53dba133e3642e51bb6ad3dd2194ad1b5e6fabf0b07af3da4db58a31770c71 |
File details
Details for the file abrax-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: abrax-0.2.1-py3-none-any.whl
- Upload date:
- Size: 3.9 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 | eef175e1c680207bd386aa3e507722afb825898bed7a58c6c513cf2314d7e86e |
|
MD5 | 8223befb97c87ce3f8f52438ef341319 |
|
BLAKE2b-256 | 752193bf7326017ac5313a33483395245924c9b470442dc64f2c6d4286fc47a1 |