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.
Qiskit • CudaQ • Pennylane • Cirq • TKet • Quil
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
toPennylane
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 --> E1[Quil]
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
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-1.0.0.tar.gz
(8.3 kB
view details)
Built Distribution
abrax-1.0.0-py3-none-any.whl
(9.1 kB
view details)
File details
Details for the file abrax-1.0.0.tar.gz
.
File metadata
- Download URL: abrax-1.0.0.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47a2d7d157f08f91809ed2bcfca65d9108f4287602a383d290fa88a1718b36a4 |
|
MD5 | 50080de7a4b03749dc19c08d12c8ff6c |
|
BLAKE2b-256 | 44647d8e35e033ffe206c44cf4f3a5e5b92ba3a7d2760e0706f518f23a9e9463 |
File details
Details for the file abrax-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: abrax-1.0.0-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c16cc4d8976a47259a7ec8f89d8e21b0f845c8e9adff2a7749c00e04479c1773 |
|
MD5 | b7b1aa2fb34601e0727cc2c26a6d0f7c |
|
BLAKE2b-256 | 8c57cd549931291b09d97bef41dd373a0d4688bc61b3e2a5cd8c2530c1804b70 |