Skip to main content

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.

QiskitAbraxasIssuesLatest

Install

While not specified here you will need Qiskit since Abraxas takes in an initialized QuantumCircuit object to write to.

pip install abraxas

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 operator NotImplemented 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


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.1.0.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

abrax-0.1.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file abrax-0.1.0.tar.gz.

File metadata

  • Download URL: abrax-0.1.0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for abrax-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0c1629fd9894b845f8d08b48b07167e87daa901f44a8cd12a71d865fef5225b3
MD5 4a4f598a0aedb363f425a8b19bb287b9
BLAKE2b-256 17da052b0a9bb8c08a595e7ac02792c45d42adcd81f0459638d6dcc86b4f5e24

See more details on using hashes here.

File details

Details for the file abrax-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: abrax-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for abrax-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dec4d104fbaf2d36b49dc90bf58d96a7e6e7437a9e2419744247f6611ac2bb72
MD5 59fa5d694220f45e67d5c7fb9bbcc9d7
BLAKE2b-256 54f67221029b1d1544503663d17fe67d2748a10474bccb8bbe9483aaa7214678

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page