A hardware-agnostic Python library for qutrit (3-level) quantum computing: gates, circuits, simulation, and SU(3) decomposition.
Project description
Qutritium
A hardware-agnostic Python library for qutrit quantum computing.
Build, simulate, and decompose three-level quantum circuits.
Installation
pip install qutritium # release
pip install -e ".[dev]" # editable + dev tools
Quick Start
from qutritium import QutritCircuit, QASMSimulator
from qutritium.gates import H3, CSUM
import numpy as np
# Qutrit Bell state: H3 + CSUM → (|00⟩ + |11⟩ + |22⟩) / √3
qc = QutritCircuit(2, None)
qc.append(H3(), first_qutrit=0)
qc.append(CSUM(), first_qutrit=0, second_qutrit=1)
qc.measure_all()
sim = QASMSimulator(qc)
sim.run(num_shots=10_000)
print(sim.get_counts()) # {'00': ~3333, '11': ~3333, '22': ~3333}
Decompose an arbitrary SU(3) unitary:
from qutritium import SU3Decomposition
import numpy as np
U = ... # any 3×3 unitary
dec = SU3Decomposition(U, qutrit_index=0, n_qutrits=1)
print(dec.angles) # nine decomposition angles
print(dec.reconstruct()) # ≈ U to machine precision
Gate Library
Single-qutrit gates
| Category | Gates |
|---|---|
| Pauli-X | X01, X02, X12 |
| Pauli-Y | Y01, Y02, Y12 |
| Pauli-Z | Z01, Z02, Z12 |
| Shifts | XPlus (cyclic), XMinus (inverse) |
| Discrete | H3 (Hadamard/DFT), S3, T3, UFT, I3 |
| Rotations | Rx01, Rx02, Rx12, Ry01, Ry02, Ry12, Rz01, Rz02, Rz12 |
| Generalized | G01(θ,φ), G02(θ,φ), G12(θ,φ) — native trapped-ion gate |
| Diagonal | Ud(φ₁,φ₂,φ₃) — virtual-Z in hardware |
Two-qutrit gates
| Gate | Action |
|---|---|
CSUM |
|c,t⟩ → |c, (t+c) mod 3⟩ |
CSUMDag |
|c,t⟩ → |c, (t−c) mod 3⟩ (CSUM inverse) |
CPhase |
|c,t⟩ → ω^{c·t} |c,t⟩ |
SWAP3 |
|a,b⟩ → |b,a⟩ |
CNOT3 |
Legacy v0.0.1 CNOT (= CSUM on adjacent qutrits) |
All gates inherit from Gate and provide .matrix(), .inverse(), .is_unitary(), .label, .params.
Package Structure
src/qutritium/
├── gates/ # Gate objects
│ ├── base.py # Gate ABC + _DaggerGate
│ ├── single_qutrit.py # 29 single-qutrit gates
│ └── two_qutrit.py # 5 two-qutrit gates
├── circuit/ # Circuit infrastructure
│ ├── elementary_matrices.py # Raw 3×3 / 9×9 unitaries
│ ├── instruction.py # Instruction + GATE_SET
│ ├── qutrit_circuit.py # QutritCircuit container
│ └── utils.py # Statevector utilities
├── simulator/ # QASMSimulator (statevector)
└── decomposition/ # SU(3) → native rotations
Supporting files at repo root:
.github/workflows/ # CI (test.yml, docs.yml)
docs/ # MkDocs source → spham1611.github.io/qutritium
examples/tutorial.ipynb # End-to-end Bell state tutorial
test/ # pytest suite (168 tests)
legacy/ # v0.0.x Qiskit-pulse code (archived, not installed)
Documentation
Full docs: https://spham1611.github.io/qutritium/
Tutorial notebook: examples/tutorial.ipynb
History
Qutritium was originally built for calibrating qutrits on IBM superconducting hardware,
presented at the Munich Quantum Software Conference 2023 and funded by a
Unitary Fund microgrant. The v1.0.0 release pivoted to a hardware-agnostic
library; the original pulse code is preserved under legacy/.
Authors
- Son Pham — Duke University · sph40@duke.edu
- Tien Nguyen — École Polytechnique, France · tienphys@gmail.com
- Bao Bach — University of Delaware, USA · bachgiabao12@gmail.com
- Charlie (abdomsisn) — Duke University · abdomsisn.haobei@gmail.com
License
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qutritium-1.4.0.tar.gz.
File metadata
- Download URL: qutritium-1.4.0.tar.gz
- Upload date:
- Size: 44.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3a490164d166c4a4f3d895237e0d975ec4d08f63d4326b7842ff75d0b22c420
|
|
| MD5 |
3ccbf095be7560adb9217de6c017e7df
|
|
| BLAKE2b-256 |
559acb0acf5fe3d2274153b5ae16d18065563241a0292ea8c42cb7ea66948f51
|
Provenance
The following attestation bundles were made for qutritium-1.4.0.tar.gz:
Publisher:
release.yml on spham1611/qutritium
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qutritium-1.4.0.tar.gz -
Subject digest:
b3a490164d166c4a4f3d895237e0d975ec4d08f63d4326b7842ff75d0b22c420 - Sigstore transparency entry: 1766728473
- Sigstore integration time:
-
Permalink:
spham1611/qutritium@b780e1ee0dcb588390b6c2416a06ffa6836d7d5b -
Branch / Tag:
refs/tags/v1.4.0 - Owner: https://github.com/spham1611
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b780e1ee0dcb588390b6c2416a06ffa6836d7d5b -
Trigger Event:
push
-
Statement type:
File details
Details for the file qutritium-1.4.0-py3-none-any.whl.
File metadata
- Download URL: qutritium-1.4.0-py3-none-any.whl
- Upload date:
- Size: 51.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e44b1e7ed4795fd7b945eee3b97777506cf2e88c4f8e9ef5578f3ff55746a3a3
|
|
| MD5 |
4d5c7683830e00bc3e3dfe5643787a09
|
|
| BLAKE2b-256 |
6be50e66fbcc97064462eb5fec50d483e32b2e2e5385be53f29b44322e765707
|
Provenance
The following attestation bundles were made for qutritium-1.4.0-py3-none-any.whl:
Publisher:
release.yml on spham1611/qutritium
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qutritium-1.4.0-py3-none-any.whl -
Subject digest:
e44b1e7ed4795fd7b945eee3b97777506cf2e88c4f8e9ef5578f3ff55746a3a3 - Sigstore transparency entry: 1766728663
- Sigstore integration time:
-
Permalink:
spham1611/qutritium@b780e1ee0dcb588390b6c2416a06ffa6836d7d5b -
Branch / Tag:
refs/tags/v1.4.0 - Owner: https://github.com/spham1611
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b780e1ee0dcb588390b6c2416a06ffa6836d7d5b -
Trigger Event:
push
-
Statement type: