QLEO (Quobly Logical Emulator Online)
QLEO is a Python library for building, simulating and analysing quantum circuits on Quobly hardware models. It is the Quobly-branded distribution of Exaqt by QPerfect — a SIMD-accelerated state-vector simulator with a Rust core.
Same engine, same API, Qleo names: QleoQCS is exaqt.ExaqtQCS, so
anything written against one runs unchanged on the other. This repository
holds only the branding layer; the engine is the mimiq-exaqt dependency.
Migrating from qleo 0.22.x? The simulator class is now
QleoQCS(wasQleo), andQleo(use_gpu=True)becomesQleoQCSGpu().from qleo import *still gives you the circuit API. See CHANGELOG.md.
Install (release wheel)
pip install qleo
pip install qleo[visualization] # + matplotlib, for plothistogram & co.
The wheel bundles the documentation. Read it offline, without a network round trip, with:
qleo docs # open the bundled site in a browser
qleo docs --print-path # or just print where it lives
Install (development checkout)
cd qleo
uv venv && uv sync
uv pip install -e .
.venv/bin/python -m pytest -q tests/
An editable install carries no bundled docs, so qleo docs has nothing to
open — run mkdocs serve instead. To produce the wheel exactly as CI
publishes it, documentation included, run python scripts/build_wheel.py.
GPU
The Linux wheel carries an NVIDIA GPU backend, QleoQCSGpu, on
cuStateVec. It needs the NVIDIA driver and the CUDA libraries, which the
gpu extra installs:
pip install "qleo[gpu]"
from qleo import *
sim = QleoQCSGpu() if gpu_available() else QleoQCS()
QleoQCSGpu(seed=n) follows the same trajectory as QleoQCS(seed=n), so a
GPU run can be reproduced on a CPU.
Quick example
import numpy as np
from qleo import QleoSV, Rng
sv = QleoSV.zero(3)
sv.apply_h(0)
sv.apply_cx(0, 1)
sv.apply_cx(0, 2)
print(sv.amplitudes()) # numpy complex128 array, length 2**3
# Multi-qubit Pauli expectation (no need to build a 2^k × 2^k matrix).
print(sv.expectation_pauli("XXX", [0, 1, 2])) # +1 for the GHZ state
# Sampling.
r = Rng(seed=42)
shots = sv.sample(r, nsamples=1000) # shape (1000, 3) uint8
mimiqcircuits integration
qleo re-exports the mimiqcircuits circuit API, so one import is enough:
from qleo import *
c = Circuit()
c.push(GateH(), 0)
c.push(GateCX(), 0, 1)
sim = QleoQCS()
result = sim.execute(c, nsamples=1000) # returns a mimiqcircuits.QCSResults
print(result)
Explicit imports work just as well, and are what the documentation uses:
import mimiqcircuits as mc
from qleo import QleoQCS
result = QleoQCS().execute(mc.Circuit(), nsamples=1000)
Conventions
- Qubit ordering. Qubit 0 is the least-significant bit of the basis-state index (matches Qiskit and MimiqCircuitsBase).
- 2-qubit gate basis. For
apply_gate_2q(M, q1, q2),q1is the most significant bit of the gate's local 2×2-bit basis. See the Rust crate's docs for the precise layout. - Cross-language reproducibility. The same
Rng(seed)produces the same Xoshiro256++ stream in the Rust core, the Python wrapper, and the Julia wrapper.
Errors
The wrapper raises Python exception subclasses of QleoError:
GateShapeError— gate matrix has the wrong shape or layout.QubitIndexError— qubit index out of bounds, or duplicate qubits.DegenerateStateError— sampling a state with zero / non-finite norm.NonUnitaryError— only raised when the Rust crate is built with theunitary-checksfeature; flags a non-unitary user matrix.
MemoryError is raised for state-vector allocations that won't fit
(e.g. QleoSV.zero(40)) — instead of aborting the process.
Documentation
Full documentation: docs.qperfect.io/qleo.
The mimiqcircuits circuit API it builds on is documented at
docs.qperfect.io/mimiqcircuits-python.
Contributing
See CONTRIBUTING.md. Maintainers cutting a release should read RELEASING.md.
Contact
- Suggestions: contact (Quobly) or contact (QPerfect)
- Email: support (QPerfect)
Metadata
Release files for qleo 0.24.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| qleo-0.24.0.tar.gz | 739.9 kB | Without provenance | Details for qleo-0.24.0.tar.gz |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| qleo-0.24.0-py3-none-manylinux_2_34_x86_64.whl | Python 3 | none | Linux glibc 2.34+ x86-64 | Details for qleo-0.24.0-py3-none-manylinux_2_34_x86_64.whl |
| qleo-0.24.0-py3-none-any.whl | Python 3 | none | any | Details for qleo-0.24.0-py3-none-any.whl |
Total release size: 3.8 MB
Release files / qleo-0.24.0.tar.gz
| Download URL | qleo-0.24.0.tar.gz |
|---|---|
| Size | 739.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
09014c829c26992c704da86a788297c48620d8851b0af539b9ec9c12167df6d9
|
|
BLAKE2b-256 checksum How to use checksums |
1417d2bfae985f03c89583ec926677c528a58aecd63b5b75dc3350a25fe01e55
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.16
|
Release files / qleo-0.24.0-py3-none-manylinux_2_34_x86_64.whl
| Download URL | qleo-0.24.0-py3-none-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 2.3 MB |
| Tags | Linux glibc 2.34+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
63542ac7b1681da399e5014831d1b9fcd53285ccc58c46e8aa0256778e8fec55
|
|
BLAKE2b-256 checksum How to use checksums |
a5499a7769831190c3abdc05d5af3c20cd22ae41ae49dddd9be19037f671f3d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.16
|
Release files / qleo-0.24.0-py3-none-any.whl
| Download URL | qleo-0.24.0-py3-none-any.whl |
|---|---|
| Size | 773.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aa61f67be8b8b169f1d7ba63f4d6ebd90deba3f98660657997272404c266756a
|
|
BLAKE2b-256 checksum How to use checksums |
7a3a08c01a7bcfd92c9568801aab66dbb703fcf386bdf5f7c36545af5802b1bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.16
|
Security for qleo 0.24.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.