Open Source Rust/Python Anyon Braiding & Surface Code Simulation Sandbox
Wanted to share a project I’ve been building that compiles entirely from scratch: shbt-unified (https://github.com/sys1own/shbt-unified.git).
It is a cross-language computational sandbox designed to simulate polymorphic anyonic tracking across SU(2), SU(3), and SO(10) Lie sectors. The repository couples a zero-allocation Rust core to a multi-precision Python orchestration layer to maintain high execution integrity across long computational steps.
What's Under the Hood:
- Polymorphic Tracker Core (Rust): Maintains a heap-allocated 512-bit precision state vector. Intermediate matrix arithmetic uses stack-allocated structures to achieve zero heap allocations during the high-frequency braiding loops.
- Solovay-Kitaev Matrix Engine: Recursively approximates arbitrary SU(2) unitaries using stack-allocated fixed-size arrays to guarantee bounded execution depth.
- Lattice Fault-Tolerance Decoder: Implements a programmatic, dynamically scaling surface code lattice that derives weight-4 stabilizers directly from active qubits. Parity check defects feed into an optimized Python union-find cluster decoder featuring rank-weighted union and path compression.
- Downstream Audits: Computes discretized holographic stress tensors, tracks curvature defects, and reviews semiclassical ADM velocity Hessians for stability at customizable multi-precision (up to 250+ decimal places).
- Data-Parallel Linking Engine: Uses standard uniform-grid spatial partitioning and Rayon parallel iterators to calculate pairwise Gauss linking integrals.
Custom OpenQASM Dialect
The engine parses a custom OpenQASM 2.0-compatible dialect via an internal compiler. It supports basic single-qubit gates, parametric rotations (rx/rz), 4x4 row-major complex unitaries (unitary4), and on-the-fly fault-tolerant decoding instructions:
Code snippet
qreg q[4];
creg c[4];
h q[0];
rz(0.5) q[0];
cx q[0], q[1];
// Inline 4x4 row-major complex unitary compilation
unitary4(re00,im00, ..., re33,im33) q[0];
// Trigger syndrome decode and MWPM correction pass
decode_and_correct;
measure q[0] -> c[0];
Setup & Environment Integration
The repository is built to be entirely self-contained. Running python build_native.py automatically handles native environment detection, builds the wheel via maturin, installs it into your active environment, and verifies the exposed symbol registry.
The code is fully open-source under an MIT License. If you're into cross-language performance, quantum memory benchmarking, or numerical high-precision math pipelines, feel free to clone it, poke at the Rust FFI layers, or run a few validations.