COOLJAPAN
← All posts

QuantRS2 0.1.3 Released — Real Decompositions, Parameter-Shift Gradients, and a Hardened Core

QuantRS2 0.1.3, the pure-Rust quantum framework — real KAK/ZYZ/holonomic decompositions, parameter-shift VQE gradients, ZX-calculus rewrites, SABRE routing, MPS tensor-network compression, ML circuit optimizers, PyO3 0.26, and a ~210-unwrap robustness pass.

release quantrs2 quantum-computing rust vqe zx-calculus tensor-networks pyo3 pure-rust

The scaffolding is gone. The hard math is in.

Today we released QuantRS2 0.1.3 — the release where a great deal of placeholder and approximate machinery becomes real, verified quantum math, shipped alongside a major robustness pass that takes panics out of the production paths.

No C. No Fortran. No CUDA toolkit. No Python runtime. QuantRS2 is a comprehensive, modular, pure-Rust quantum computing framework — simulation, algorithm development, and hardware interaction — and a Rust-native alternative to Qiskit, Cirq, PennyLane, and the C++/CUDA simulators like Stim and cuQuantum. Even SymEngine’s C++ symbolic core is replaced here by quantrs2-symengine-pure, a 100%-Rust SymEngine substitute. The result compiles to a single static binary, or to WASM, with no glue layer to babysit.

Why QuantRS2 0.1.3 is a game changer

The incumbent quantum stacks are Python orchestration over C++/CUDA kernels, and they ship plenty of routines that are honest about being approximate or placeholder until someone fills them in. QuantRS2 0.1.3 fills a lot of those in — and does it in one type-safe language all the way down. Concretely:

This all sits on a substantial base: 4,707 tests passing (0 failures, 69 skipped) across 777,061 lines of Rust.

Technical Deep Dive

Core synthesis & math. The core crate is where most of the placeholder-to-real work happened. cartan.rs performs KAK decomposition through a Householder + Givens QR eigensolver; synthesis.rs fixes the ZYZ theta formulas; adiabatic.rs computes ground-state energy with inverse power iteration, deflation, and Rayleigh-quotient refinement; and holonomic.rs now runs with graceful convergence handling. The quantum-walk eigensolvers were rebuilt entirely on Golub-Reinsch QR iteration, Householder tridiagonalization, Sturm-sequence bisection, and Wilkinson-shift implicit QR for tridiagonal eigenproblems — verified against known spectra (P4 eigenvalues {0, 2−√2, 2, 2+√2}, K4 Fiedler value 4.0).

Circuit compilation. The circuit crate gained SABRE routing with coupling-map distance scoring, ASAP scheduling via Kahn topological sort, greedy noise-aware qubit remapping, and dynamical-decoupling insertion (XY4, CPMG, XY8). Peephole/template matching now handles 2-gate cancellations (H-H, X-X) and a 3-gate pattern (H-X-H → Z). Tensor-network support added TensorNetwork::compress via SVD truncation and MatrixProductState::from_circuit / ::compress, and the DistributedExecutor gained real job tracking (JobRecord + registry, with submit_job / get_job_status / cancel_job / get_results state transitions).

Variational & QML stack. Beyond parameter-shift gradients, the QML layer adds Möttönen-style amplitude encoding (recursive binary-tree multiplexor for arbitrary state preparation) and correct IQP ZZ interactions, e^{-iθ/2 Z⊗Z} built as CNOT·(I⊗RZ(θ))·CNOT. VQE’s set_parameters now actually rebuilds parameterized gates with updated angles via ParameterizedGateRecord tracking. Symbolic evaluation is wired to the pure-Rust quantrs2-symengine-pure backend (evaluate, evaluate_complex, free_symbols, is_constant, substitute).

Python & error mitigation. The py crate migrated from PyO3 0.22 to 0.26 (Python::attach replaces with_gil; Py<PyAny> replaces PyObject) and added error-mitigation bindings: quasi-probability decomposition (PEC, returning 1+3n terms), virtual distillation via a SWAP-test circuit (M=2 copies), and symmetry verification (Z2/parity, U(1)/particle-number, time-reversal). On the simulation side, the sim crate’s quantum-supremacy path got a real inline statevector apply_gate_to_state and inverse-CDF sample_from_amplitudes, replacing zero-filled placeholders.

As engineering discipline, this release also kept the no-unwrap robustness work moving and honored the COOLJAPAN 2000-line policy: several large files were split into module directories (quantrs2/src/lib.rs, py/src/lib.rs, circuit/src/builder.rs, core/src/quantum_walk.rs, plus splits across ml/, device/, and anneal/).

Getting Started

cargo add quantrs2-core quantrs2-circuit quantrs2-sim

A Bell state from scratch:

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);
    }
}

Note the const-generic Circuit::<2> — qubit counts are checked at compile time.

What’s New in 0.1.3

Tips

This is the foundation

QuantRS2 is built on the SciRS2 scientific-computing stack — scirs2-core supplies arrays, linear algebra, FFT, parallelism, and GPU primitives. Around it sit NumRS2 for numerics, OptiRS powering the VQE/QAOA optimizers, and OxiFFT and OxiZ (SMT) where transforms and symbolic reasoning are needed. The same pure-Rust ecosystem also carries ML tooling — ToRSh, SkleaRS, and TrustformeRS — so a quantum-classical hybrid workflow never has to leave the language.

Repository: https://github.com/cool-japan/quantrs

Star the repo if a pure-Rust quantum stack — with real decompositions, exact gradients, and no panics in the hot path — is what you’ve been waiting for.

Pure Rust quantum computing is here — fast, safe, and sovereign.

KitaSan at COOLJAPAN OÜ March 27, 2026

↑ Back to all posts