burn_quantum
Differentiable qubit and qudit simulation using Burn 0.22's native tensors, devices, modules, parameters, optimizers and weight records. Rust 1.95+.
QuantumBackend describes quantum execution; DenseSimulator implements it
using supported Burn devices. The public API accepts native Tensor<D> and
Device values. It does not require a separate tensor backend or a Burn fork.
Quick start
[]
= "0.3.0"
= { = "~0.22.1", = false, = ["std", "flex"] }
use Device;
use ;
Capabilities
- Batched qubit, qudit and mixed-dimensional pure states and density matrices.
- Validated local unitaries, differentiable rotations, observables, partial traces, Kraus channels and seeded terminal measurement.
- Serializable circuits, native autodiff, qudit-aware parameter-shift
references, and
QuantumLayerintegration with Burn modules and records. - Reusable encodings, circuit templates, probability losses and fidelity kernels.
- Quantum natural SPSA with a regularized Fubini–Study metric and checkpoints.
- Boolean CNF/DIMACS SAT search with reversible oracles and verified witnesses.
photonicadds dual-rail/vacuum encoding, loss, Fock optics, calibrated fusions, physical circuit compilation, finite fabric scheduling, Clifford/frame simulation, encoded resources, QEC memories, finite boundaries, logical/magic-state references and bounded event/process execution. A separatetensor_networkmodule supplies mixed-qudit MPS and distributed entangled-state ownership, with explicit approximation and host-SVD limits. See the implemented models and remaining gates. These capabilities are included in version 0.3.0.
Default features are flex and autodiff. Optional wgpu, cuda and fusion
features select accelerator capabilities; callers supply the execution device.
F32/F64 availability depends on the device. GPU qualification uses F32.
Dense simulation uses exponential state storage: for batch B and Hilbert
dimension N, pure states store 2BN real scalars and density matrices store 2BN².
Allocation limits are preflight checks, not a total memory cap. SAT search may
return Inconclusive when its budget is exhausted. QN-SPSA's dense host metric
uses O(d²) storage and an O(d³) solve for d parameters. These implementations do
not establish quantum advantage or efficient simulation of arbitrary circuits.
Package and repository
This package owns src/, integration tests/, simulator examples/, and the
executable-only support/device.rs helper. From a repository checkout:
The sibling burn_quantum_example package contains single-file quantum
applications, including VQE, QAOA, classifiers, a Born machine, hybrid
regression, Grover SAT, QN-SPSA VQE, physical photonic optimization, finite-boundary
QEC studies, magic-state distillation and distributed MPS workloads.
It is run from a repository checkout:
See the API documentation, example suite, guides and validation records, and changelog.
License
MIT OR Apache-2.0. Both license texts are included in this package.
Canonical algorithms and dynamic protocols
algorithms supplies reusable QFT/inverse QFT, phase estimation, Deutsch–Jozsa
parity oracles, single-target Grover, generalized Toffoli, graph MaxCut QAOA,
teleportation and coherent odd-repetition recovery. Builders retain the ordinary
Circuit, symbolic bindings and operation labels. append_qft composes with an
existing circuit; all wires follow the register's big-endian convention.
protocol::Protocol references ordinary circuit operations and explicitly adds
projective measurements and initialized classical conditions. BranchExecution
executes a supplied outcome branch incrementally, reports its cumulative
probability, and normalizes the actually collapsed state. Impossible branches are
errors. This is explicit branch execution, not random shot sampling or a claim
that requested measurement outcomes occur deterministically.