Skip to content

Repository files navigation

ruqu — Quantum Computing in Pure Rust + WebAssembly

Rust WebAssembly License: MIT

ruqu is a fast, dependency-light quantum computing toolkit written in pure Rust — a state-vector quantum circuit simulator with SIMD acceleration, realistic noise models, and multi-threading, plus production quantum algorithms (VQE, Grover, QAOA, surface-code error correction) and a novel real-time coherence engine. It runs natively and in the browser via WebAssembly.

Quantum circuit simulation, VQE quantum chemistry, QAOA optimization, Grover search, surface-code QEC, and 25-qubit in-browser WASM — no Python, no C++, no heavyweight dependencies.

Why ruqu

  • Pure Rust, no FFI — portable, memory-safe, easy to embed; compiles to native and wasm32.
  • SIMD + multi-threaded state-vector engine — high-throughput circuit simulation.
  • Realistic noise models — depolarizing, dephasing, amplitude damping for NISQ-style studies.
  • Batteries-included algorithms — VQE (chemistry), Grover's search, QAOA (combinatorial optimization), and Surface Code error correction, ready to use.
  • Runs in the browser — ruqu-wasm exposes circuits, VQE, Grover and QAOA to JavaScript with ~25-qubit support.
  • Coherence-aware — a classical "nervous system for quantum machines" that assesses qubit coherence in real time via dynamic min-cut.

Crates

Crate What it does
ruqu-core High-performance state-vector quantum circuit simulator — SIMD acceleration, noise models, multi-threading.
ruqu-algorithms Production quantum algorithms — VQE for chemistry, Grover's search, QAOA optimization, Surface Code error correction.
ruqu-exotic Experimental quantum–classical hybrid algorithms — quantum memory decay, interference search, reasoning error correction, swarm interference for AI systems.
ruqu-wasm WebAssembly bindings — run quantum simulations in the browser (25-qubit, VQE/Grover/QAOA).
ruqu Classical coherence engine — real-time coherence assessment for quantum machines via dynamic min-cut.

Install

# Cargo.toml
[dependencies]
ruqu-core = "2.2"
ruqu-algorithms = "2.2"   # VQE, Grover, QAOA, surface-code QEC
cargo add ruqu-core ruqu-algorithms

Quick start

use ruqu_algorithms::qaoa::{run_qaoa, Graph, QaoaConfig};

// Solve a MaxCut instance with QAOA on the ruqu state-vector simulator.
let graph = Graph::from_edges(4, &[(0, 1), (1, 2), (2, 3), (3, 0)]);
let result = run_qaoa(&graph, &QaoaConfig::default());
println!("best cut = {:?}", result.best_bitstring);

WebAssembly

# build the browser bundle
wasm-pack build crates/ruqu-wasm --target web
import init, { simulate } from "./pkg/ruqu_wasm.js";
await init();
// run a quantum circuit entirely in the browser — up to ~25 qubits

Build

cargo build --release                            # native
cargo test                                       # run the test suite
wasm-pack build crates/ruqu-wasm --target web    # WASM

Command-line quantum (npx)

Run quantum circuits from your terminal via @ruvector/ruqu — the ruqu-wasm state-vector simulator compiled to WebAssembly, wrapped in a metaharness agent CLI:

npx @ruvector/ruqu simulate --qubits 4    # GHZ state-vector simulation
npx @ruvector/ruqu grover --qubits 3 --target 5
npx @ruvector/ruqu qaoa --nodes 4         # QAOA MaxCut on a ring
npx @ruvector/ruqu capabilities           # gates, algorithms, limits
npx @ruvector/ruqu doctor                 # verify the quantum WASM

Sources in cli/; the bundled --target nodejs WASM runs up to 25 qubits in Node — no native addon.

Use cases

Quantum algorithm research · variational quantum eigensolver (VQE) for quantum chemistry · combinatorial optimization with QAOA · quantum error-correction (surface codes) experiments · NISQ noise studies · teaching quantum computing · browser-based quantum demos.

Observer consistency laboratory

Run reproducible two-qubit controls, reversible observer interactions, and separately labelled classical memory interventions using the bundled WASM engine:

node cli/bin/cli.js observer-lab --count 128 --seed 20260920
node cli/bin/cli.js observer-lab --benchmark
node --test cli/tests/observer-lab.test.cjs

The optional native integration validates the evidence before projecting it into actual ruField synthetic events and an actual WorldGraph belief graph, using pinned upstream Rust crates. It requires an independently supplied trusted ledger root and rejects physical sensor claims. No existing database, sensor or cloud service is changed.

These are software controls of established quantum predictions, not a QPU run, new physics, physical Bell test, or quantum advantage. See the architecture and validation evidence. The new CLI command is available from this checkout; this change does not publish a new npm release.

License

MIT © Ruvector Team. Part of the ruvector ecosystem (extracted per ADR-257).

About

High-performance quantum computing in pure Rust + WebAssembly: state-vector circuit simulator with SIMD & noise models, VQE, Grover, QAOA, surface-code error correction, and real-time coherence via dynamic min-cut.

Topics

Resources

Stars

12 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages