Fault-tolerant quantum computing is no longer a C++/CUDA-only game — production surface-code QEC, 3D state visualization, and Toshiba Simulated Bifurcation now live in pure Rust.
Today we released QuantRS2 0.2.0 — the biggest release so far, leading with a production-grade surface-code error-correction stack (rotated codes at d = 3/5/7 with MWPM and union-find decoders), 3D quantum-state visualization, a trio of new native-Rust Tytan samplers including Toshiba Simulated Bifurcation, and a PennyLane device backend.
No C. No Fortran. No CUDA toolkit. No Python runtime. QuantRS2 is a comprehensive, modular, pure-Rust quantum computing framework — a Rust-native alternative to Qiskit, Cirq, and PennyLane, and to the C++/CUDA simulators (Stim, cuQuantum) that have owned QEC and large-scale simulation until now. SymEngine’s C++ symbolic core is replaced by the 100%-Rust quantrs2-symengine-pure; OpenBLAS is replaced by the pure-Rust OxiBLAS backend. Default features are 100% Pure Rust (CUDA and MKL are optional and feature-gated), and the whole framework compiles to Linux, macOS, Windows, and WASM — shipping as a single static binary with no shared-library hunt at deploy time.
Why QuantRS2 0.2.0 is a game changer
For years, the moment you needed real quantum error correction or serious sampling you were pushed out of Rust and into a C++/CUDA stack: Stim for QEC decoding, cuQuantum for big state vectors, vendor SDKs for annealing. QuantRS2 0.2.0 closes that gap with native Rust capability:
- Production surface-code QEC — rotated planar codes at distances d = 3, 5, 7, with a bitmask-DP minimum-weight perfect-matching decoder that is optimal up to 24 defects, plus a faster Delfosse–Nickerson union-find decoder and a Clifford Pauli-frame tracker.
- 3D quantum-state visualization — five renderers (multi-qubit Bloch array, Q-sphere, discrete Wigner, Husimi-Q, density-matrix bars) straight to HTML, no notebook plumbing required.
- Three new Tytan samplers — Tabu search, bSB/dSB Simulated Bifurcation, and population annealing, all riding a new allocation-free SIMD energy engine with O(1) incremental ΔE.
- A PennyLane device backend — drive QuantRS2’s state-vector simulator from existing PennyLane circuits over a JSON protocol.
- A real physics fix — the Coherent Ising Machine’s noise term, previously hardcoded to zero, now injects genuine Wiener increments under Euler–Maruyama.
This lands on a mature base: 5,237 tests passing (0 failures, 74 skipped), 804,894 lines of Rust across 2,744 files, organized as a Cargo workspace of 11 crates.
Technical Deep Dive
(a) The QEC stack — core/src/error_correction/. RotatedSurfaceCode lays out a d×d rotated planar code (data / X-ancilla / Z-ancilla qubits) with a full stabilizer schedule and logical-operator extraction for d = 3/5/7. MwpmSurfaceDecoder is a bitmask-DP minimum-weight perfect matcher — optimal for ≤ 24 defects (i.e. d ≤ 7) — using Dijkstra over the rotated lattice to weight syndrome-graph edges. UnionFindDecoder implements the Delfosse–Nickerson weighted union-find algorithm with peeling for near-linear decoding. PauliFrame tracks Pauli frames by Clifford conjugation with H/S/CNOT propagation rules. All four are exposed to Python via py::qec (PyRotatedSurfaceCode, PyMwpmSurfaceDecoder, PyUnionFindDecoder, PyPauliFrame).
(b) Visualization — core/src/state_visualization_3d/. Five Plotly-JSON renderers, rendered with plotters: a multi-qubit Bloch-sphere array (per-qubit reduced density matrix via partial_trace), a Qiskit-style Q-sphere (latitude ∝ Hamming weight, phase-colored markers), a discrete Wigner function (Wootters 1987, n = 1, 2; explicit error for n ≥ 3), a Husimi-Q distribution (spin-coherent projection on a 64×64 grid), and a density-matrix 3D bar plot (Re/Im side by side). Python bindings ship via PyQuantumState3DVisualizer with {bloch_array,qsphere,wigner,husimi,density_bars}_html().
(c) The Tytan optimization engine — tytan/src/sampler/. The new energy.rs module provides shared, allocation-free QUBO/PUBO energy primitives: QUBO kernels energy_full / energy_delta / compute_influence / update_influence give O(1) incremental ΔE via a maintained influence vector, each with an autovectorized _simd companion (opt-level=3 autovectorization — no nightly std::simd). HOBO/PUBO kernels include specialized 3-body and 4-body paths, and hobo_to_qubo performs Rosenberg-polynomial quadratization. Three new samplers implement the canonical Sampler trait (run_qubo, run_hobo): TabuSampler (FIFO-ring tabu search, aspiration criterion, restart-from-best), SBSampler (Toshiba Simulated Bifurcation, Goto–Tatsumura–Dixon 2019, ballistic bSB and discrete dSB via symplectic Euler dynamics), and PopulationAnnealingSampler (Hukushima–Iba, importance-weighted resampling, log-sum-exp ESS threshold). HOBO parallelization runs through rayon (scirs2_core::parallel_ops) above size thresholds, and the CIM and photonic samplers now support run_hobo (previously NotImplemented) by quadratizing through hobo_to_qubo.
(d) Interop and numerical foundation. The PennyLane device backend (sim/src/pennylane/) exposes QuantRS2Device, executing PennyLane circuits against the state-vector simulator over a JSON protocol (execute / execute_json), with PennyLaneCircuit / Operation / Observable / Result payload types and a WireMap / WireId translation layer. Underneath, the whole stack rides SciRS2 0.5.0 (arrays / linalg / FFT-via-OxiFFT / optimize), the pure-Rust OxiBLAS backend, and OxiFFT — a C/C++/Fortran-free numerical core.
Getting Started
cargo add quantrs2-core quantrs2-circuit quantrs2-sim
use quantrs2_circuit::builder::Circuit;
use quantrs2_sim::statevector::StateVectorSimulator;
fn main() {
let mut circuit = Circuit::<2>::new();
circuit.h(0).unwrap()
.cnot(0, 1).unwrap();
let simulator = StateVectorSimulator::new();
let result = circuit.run(simulator).unwrap();
for (i, prob) in result.probabilities().iter().enumerate() {
let bits = format!("{:02b}", i);
println!("|{}⟩: {:.6}", bits, prob);
}
}
The Circuit::<2> const-generic parameter makes qubit counts part of the type — out-of-range qubit indices are a compile error, not a runtime panic.
What’s New in 0.2.0
Added
- Surface-code QEC:
RotatedSurfaceCode(d = 3/5/7),MwpmSurfaceDecoder(bitmask-DP MWPM),UnionFindDecoder(Delfosse–Nickerson),PauliFrametracker, plus Pythonqecbindings. - 3D state visualization: five renderers (Bloch array, Q-sphere, Wigner, Husimi, density bars) with
PyQuantumState3DVisualizerbindings. - Tytan samplers:
TabuSampler,SBSampler(bSB/dSB Simulated Bifurcation),PopulationAnnealingSampler, a new allocation-free SIMD energy engine, HOBO rayon parallelization, and HOBO support on the CIM and photonic samplers. - PennyLane device backend: run QuantRS2 from PennyLane over JSON.
- VQF multilevel factorization: opt-in
with_multilevel(true)for recursive full prime factorization (complete prime spectrum, not just a bi-factor split); new tests for 15, 13, 105. - Quantum-inspired classical algorithms: completed
quantum_differential_evolution(QDE) andquantum_harmony_search(QHS). - Clustering: functional
KMeans.fit(centers, labels, inertia) andDBSCAN(fit_dbscan). - Circuit-formatter passes:
optimize_layout/enforce_style/organize_codeand more. - Device benchmarking intelligence: metric-driven recommendations, historical baselines, and point/trend/collective anomaly detection.
- Governance:
CONTRIBUTING.md,CODE_OF_CONDUCT.md,SECURITY.md.
Changed
- SciRS2 ecosystem bumped 0.4.0 → 0.5.0 across the family (core, autograd, linalg, optimize, special, sparse, fft [with oxifft], neural, metrics, stats, cluster, graph, numpy).
- COOLJAPAN pure-Rust deps: oxicode 0.2.1 → 0.2.4; oxiarc-deflate / oxiarc-lz4 0.2.6 → 0.3.3.
- Data stack: numrs2 0.3.2 → 0.4.0; pandrs 0.3.0 → 0.4.0. Supporting: pyo3 0.28.x, tokio 1.52.x, nalgebra 0.34.2; added
plotters. MSRV unchanged (Rust 1.86.0, edition 2021).
Fixed
- Coherent Ising Machine noise injection: the SDE noise term was hardcoded to zero (effectively deterministic). It now injects independent Gaussian real/imag Wiener increments scaled by
noise_strengthunder Euler–Maruyama (dA = f(A)dt + g·dW). Verified by 4 new tests.
Tips
- Protect logical qubits with a
RotatedSurfaceCode. Start at d = 3 to validate, then scale to d = 5/7. Decode withMwpmSurfaceDecoderfor optimal results up to 24 defects, or switch to the fasterUnionFindDecoderonce your syndromes grow larger. - Render any state in 3D, straight to HTML. Reach for
PyQuantumState3DVisualizerand callbloch_array_html(),qsphere_html(),wigner_html(), orhusimi_html()— no notebook backend required. - For tough QUBO/PUBO, try Simulated Bifurcation. Use
SBSampler(bSB for speed, dSB for accuracy) orPopulationAnnealingSampler, and lean on the O(1) incremental-ΔE energy kernels for fast local moves. - Higher-order problems now just work. HOBO/PUBO objectives run on the CIM and photonic samplers via automatic Rosenberg quadratization (
hobo_to_qubo) — no manual reduction. - Drive QuantRS2 from PennyLane. Point your existing PennyLane circuits at the new
QuantRS2Devicebackend to execute against the pure-Rust state-vector simulator. - Turn on
with_multilevel(true)in VQF to get full prime factorization (the complete prime spectrum) instead of a single bi-factor split.
This is the foundation
QuantRS2 0.2.0 doesn’t stand alone — it stands on the COOLJAPAN ecosystem as of June 2026. It builds on SciRS2 0.5.0 (arrays, linalg, FFT-via-OxiFFT, optimize), the pure-Rust OxiBLAS backend that replaces OpenBLAS, NumRS2 0.4.0 and PandRS 0.4.0 for data, OptiRS for VQE/QAOA optimization, and Oxicode 0.2.4 plus OxiARC (oxiarc-deflate / oxiarc-lz4) for pure-Rust serialization and compression. The result is an end-to-end, C/C++/Fortran-free quantum stack — from circuit construction through simulation, error correction, and optimization, all the way down to the BLAS calls.
Repository: https://github.com/cool-japan/quantrs
Star the repo if a pure-Rust path to fault-tolerant quantum computing is something you want to see grow — and tell us what you build with surface codes and Simulated Bifurcation.
Pure Rust quantum computing is here — fast, safe, and sovereign.
— KitaSan at COOLJAPAN OÜ June 6, 2026