Skip to main content

Cross platform circuit transpiler

Project description

abraxas

A tiny library to transpile quantum circuits. The goal is to speed up the time it takes to convert simple circuits across languages fast. Anything beyond a certain complexity should be written in the respective languages directly.

QiskitCudaQPennylaneCirqTKetQuil

Install

While not explicity marked as required, it will be convenient to have qiskit installed since some functions use it to generate qasm code.

pip install abrax

Examples

toQiskit

from qiskit import QuantumCircuit, Parameter
from abrax import toPenny, toQasm
import pennylane as qml

qc = QuantumCircuit(3)
p = Parameter('x')
qc.h([0, 1, 2])
qc.cx(0, 2)
qc.rx(0, 0)
qc.cx(1, 2)
qc.ry(p, 2)

qasm = toQasm(qc)
dev = qml.device("default.qubit", wires=2)
circuit = toPenny(qasm, dev) # pennylane needs 'dev'
# print(qml.draw(circuit)())
# 0: ──H─╭X──RX(0.00)───────────────┤  Probs
# 1: ──H─│────────────╭X────────────┤  Probs
# 2: ──H─╰●──X────────╰●──RY(x)─────┤  Probs

Supported conversions:

graph LR
  subgraph Circuit
    direction LR
    IR[Pseudo-QASM]
    IR2[QASM]
  end
  A0[Qiskit] --> Circuit
  B0[Pennylane] --> Circuit
  C0[Cirq] --> Circuit
  D0[TKet] --> Circuit
  E0[Quil] --> Circuit
  F0["CudaQ (half)"] --> Circuit

  Circuit --> A1[Qiskit]
  Circuit --> B1[Pennylane]
  Circuit --> C1[Cirq]
  Circuit --> D1[TKet]
  Circuit --> F1[CudaQ]

Known Issues

  • Don't parameterise 'exponent' in cirq for variational circuits. Else it will hard code in some random value. As a slow hack you can run the transpiler in a for loop everytime the exponent/rads change.
  • Compiling "TO" pyquil isn't supported yet, I don't want to write a full generator loop
  • CudaQ cannot do variational gates "toQasm" and writing a parser for QIR/MLIR is extremely expensive

Supported Frameworks

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

Uploaded Source

Built Distribution

abrax-0.5.0-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: abrax-0.5.0.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for abrax-0.5.0.tar.gz
Algorithm Hash digest
SHA256 eeffb5119d13e2f76a6b03d56e26c16e36e0e2bfb424c9d54d05d16b3ff57aea
MD5 7b66d27cbf49c7d6920703614da9765e
BLAKE2b-256 f5d50607c85883730c1d43b788d74fcb2a698195c63ad015643d7dc71fdf250a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: abrax-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for abrax-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 36276aa760e7b7eb2512d93828706a2b600788ecb3c8bde8e02787c8652c5bdf
MD5 a12747c0a809b45f6250ad2af49a9ff0
BLAKE2b-256 ea0425ff69c1e704a05882012b15e0b9d5bd73db1220b0864b4ce0e5b7e69e54

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