wai-quantum 0.3.35: time evolution of spin chains by TDVP, held to exact answers #160

Merged
dcharlot merged 2 commits from wai-quantum-tdvp into main 2026-10-05 15:54:10 -04:00
Owner

Stacked on #159 (DMRG); the diff against main includes #151, #155, #156 and #159 until they merge.

What this adds

quantum_tdvp: time evolution of spin chains by the time-dependent variational principle, held to exact answers.

  • Two-site TDVP, symmetric and second order. Each bond goes forward half a step under its effective Hamiltonian; the new centre goes back half a step under its one-site one.
  • Krylov exponentials (expm_krylov): Lanczos with full re-orthogonalisation. A step that does not converge in krylov vectors is halved.
  • SVD splits by one-sided Jacobi on θ†. The left vectors are accumulated rotations, so they stay orthonormal however small the singular value, and amplitudes resolve to rounding. A density-matrix split resolves them only to about 10⁻⁸.
  • Complete bases. Evolution::new completes every bond's basis with orthonormal null vectors up to max_bond. The state does not change, but the tangent space grows. A product state's bases cannot express H|ψ⟩, and that, not the time step, was the error: with complete bases a chain that fits the bond evolves exactly, to rounding, at any step size.
  • Measurements: site and bond expectations, the entropy at every bond (from the Gram matrix of the left part), the energy from the centre, and overlaps, which give the Loschmidt echo.
  • Exact referees:
    • exact_evolve evolves all 2ⁿ amplitudes (≤ 20 sites).
    • ising_quench is the Ising chain from σˣ = +1 as free fermions, at any length: σˣ, σᶻσᶻ, and the echo as |det((Γ₀+Γₜ)/2)|^{1/2}.

The DMRG engine is now generic over a Scalar trait (f64, or the crate's complex type). Real arithmetic keeps its exact operation order, and the DMRG pin is unchanged. hermitian_eigen reduces to a real tridiagonal matrix and then shares the QL iteration.

Checked

  • The free-fermion solution matches exact evolution to 10⁻¹⁰ (8 sites, three quenches, echo included). The Krylov exponential matches the dense one to 10⁻¹¹, including a step it has to halve.

  • Complete bases: steps of 0.5 match exact evolution to 10⁻¹¹ in the state, for Heisenberg from the Néel state and for Ising from a tilted product state.

  • 16 sites at bond 8 follow the critical Ising quench to 10⁻⁶ in σˣ, σᶻσᶻ and the echo.

  • At scale (tdvp_quench):

    sites bond t max error in σˣ discarded weight
    100 64 1 5.6·10⁻¹¹ 1·10⁻¹³
    100 64 2 2.5·10⁻¹⁰ 3·10⁻¹³
    100 64 3 9.0·10⁻¹⁰ 4·10⁻¹⁰
    100 64 3.5 6.7·10⁻⁷ 8·10⁻⁷
    100 64 4 1.6·10⁻⁴ 1.5·10⁻⁴
    100 32 3 1.5·10⁻⁵ 8·10⁻⁶

    The quench is critical (J = h = 1), with step 0.1 and cutoff 10⁻²⁰. Until the entanglement fills the bond, the error stays below 10⁻⁹ and the Loschmidt rate agrees with the exact one to seven digits. After that, the error follows the reported discarded weight, within a factor of three.

  • Cutoff, measured on 40 sites at bond 32 and dt 0.05, error at t = 2: 4·10⁻⁶ at 10⁻¹², 3·10⁻⁸ at 10⁻¹⁶, 2·10⁻¹⁰ at 10⁻²⁰ (the new default), and 4·10⁻¹⁰ at 0, where the bond is full and costs three times as much.

  • Lengthening the backward half-step by 0.1 % fails both accuracy tests.

  • Energy holds to 10⁻⁹ over ten truncated steps. Runs are bit-identical at 1 and 5 threads, and complex threaded effective Hamiltonians are bit-identical to single-threaded ones.

  • New pin tdvp_time_evolution. All 20 pins pass natively and under wasm32-wasip2.

Measured, and not kept

A fourth-order composition of the step (Yoshida, three stages) was built and measured on the 40-site critical quench at bond 32. At dt 0.05, 0.1 and 0.2 it was less accurate than second order: 1.1·10⁻⁹ against 2.3·10⁻¹⁰ at t = 2, dt 0.05. It was also 3–10× slower, because its backward middle stage entangles the state the next split then truncates. It was removed.

CLI

wai-quantum tdvp [--chain ising|heisenberg] [-n N] [--start plus|neel|up] [--bond D] [--dt DT] [--t T] [--cutoff C] [--json]. For the Ising chain from plus, every report carries the exact free-fermion values beside TDVP's.

CI note

The stack below this one (#151, #155, #156) is merged, and 0.3.31–0.3.33 are published.

The macOS runner is single-slot and was about a day behind. Its three WAI legs (energy receipts, byte-equality, conformance) were replicated step by step from the workflow files against the #159 head aa64bcf1, in a clean worktree with its own target directory. All steps passed.

🤖 Generated with Claude Code

Stacked on #159 (DMRG); the diff against main includes #151, #155, #156 and #159 until they merge. ## What this adds `quantum_tdvp`: time evolution of spin chains by the time-dependent variational principle, held to exact answers. - **Two-site TDVP**, symmetric and second order. Each bond goes forward half a step under its effective Hamiltonian; the new centre goes back half a step under its one-site one. - **Krylov exponentials** (`expm_krylov`): Lanczos with full re-orthogonalisation. A step that does not converge in `krylov` vectors is halved. - **SVD splits** by one-sided Jacobi on `θ†`. The left vectors are accumulated rotations, so they stay orthonormal however small the singular value, and amplitudes resolve to rounding. A density-matrix split resolves them only to about `10⁻⁸`. - **Complete bases.** `Evolution::new` completes every bond's basis with orthonormal null vectors up to `max_bond`. The state does not change, but the tangent space grows. A product state's bases cannot express `H|ψ⟩`, and that, not the time step, was the error: with complete bases a chain that fits the bond evolves exactly, to rounding, at any step size. - **Measurements:** site and bond expectations, the entropy at every bond (from the Gram matrix of the left part), the energy from the centre, and overlaps, which give the Loschmidt echo. - **Exact referees:** - `exact_evolve` evolves all `2ⁿ` amplitudes (≤ 20 sites). - `ising_quench` is the Ising chain from `σˣ = +1` as free fermions, at any length: `σˣ`, `σᶻσᶻ`, and the echo as `|det((Γ₀+Γₜ)/2)|^{1/2}`. The DMRG engine is now generic over a `Scalar` trait (`f64`, or the crate's complex type). Real arithmetic keeps its exact operation order, and the DMRG pin is unchanged. `hermitian_eigen` reduces to a real tridiagonal matrix and then shares the QL iteration. ## Checked - The free-fermion solution matches exact evolution to `10⁻¹⁰` (8 sites, three quenches, echo included). The Krylov exponential matches the dense one to `10⁻¹¹`, including a step it has to halve. - Complete bases: steps of 0.5 match exact evolution to `10⁻¹¹` in the state, for Heisenberg from the Néel state and for Ising from a tilted product state. - 16 sites at bond 8 follow the critical Ising quench to `10⁻⁶` in `σˣ`, `σᶻσᶻ` and the echo. - At scale (`tdvp_quench`): | sites | bond | t | max error in σˣ | discarded weight | |-------|------|-----|-----------------|------------------| | 100 | 64 | 1 | 5.6·10⁻¹¹ | 1·10⁻¹³ | | 100 | 64 | 2 | 2.5·10⁻¹⁰ | 3·10⁻¹³ | | 100 | 64 | 3 | 9.0·10⁻¹⁰ | 4·10⁻¹⁰ | | 100 | 64 | 3.5 | 6.7·10⁻⁷ | 8·10⁻⁷ | | 100 | 64 | 4 | 1.6·10⁻⁴ | 1.5·10⁻⁴ | | 100 | 32 | 3 | 1.5·10⁻⁵ | 8·10⁻⁶ | The quench is critical (`J = h = 1`), with step 0.1 and cutoff `10⁻²⁰`. Until the entanglement fills the bond, the error stays below `10⁻⁹` and the Loschmidt rate agrees with the exact one to seven digits. After that, the error follows the reported discarded weight, within a factor of three. - Cutoff, measured on 40 sites at bond 32 and dt 0.05, error at `t = 2`: `4·10⁻⁶` at `10⁻¹²`, `3·10⁻⁸` at `10⁻¹⁶`, `2·10⁻¹⁰` at `10⁻²⁰` (the new default), and `4·10⁻¹⁰` at 0, where the bond is full and costs three times as much. - Lengthening the backward half-step by 0.1 % fails both accuracy tests. - Energy holds to `10⁻⁹` over ten truncated steps. Runs are bit-identical at 1 and 5 threads, and complex threaded effective Hamiltonians are bit-identical to single-threaded ones. - New pin `tdvp_time_evolution`. All 20 pins pass natively and under `wasm32-wasip2`. ## Measured, and not kept A fourth-order composition of the step (Yoshida, three stages) was built and measured on the 40-site critical quench at bond 32. At dt 0.05, 0.1 and 0.2 it was less accurate than second order: `1.1·10⁻⁹` against `2.3·10⁻¹⁰` at `t = 2`, dt 0.05. It was also 3–10× slower, because its backward middle stage entangles the state the next split then truncates. It was removed. ## CLI `wai-quantum tdvp [--chain ising|heisenberg] [-n N] [--start plus|neel|up] [--bond D] [--dt DT] [--t T] [--cutoff C] [--json]`. For the Ising chain from `plus`, every report carries the exact free-fermion values beside TDVP's. ## CI note The stack below this one (#151, #155, #156) is merged, and 0.3.31–0.3.33 are published. The macOS runner is single-slot and was about a day behind. Its three WAI legs (energy receipts, byte-equality, conformance) were replicated step by step from the workflow files against the #159 head `aa64bcf1`, in a clean worktree with its own target directory. All steps passed. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
wai-quantum 0.3.34: ground states of spin chains by DMRG, held to exact answers
Some checks failed
standards workspaces build + test / smart-byte-rs (pull_request) Successful in 3m37s
WAI conformance / cargo-class corpora · linux (pull_request) Successful in 4m28s
WAI conformance / v2 vocabulary · manifests validate as stated (pull_request) Successful in 12s
WAI conformance / independent verifiers · claims, JWP, key discovery and integer payloads (Python) (pull_request) Successful in 2m9s
WAI conformance / cross-arch byte-equality · linux (pull_request) Successful in 23s
WAI conformance / C2PA manifest emission · signed, read back, validated (pull_request) Successful in 44s
WAI energy receipts / energy receipts · linux (pull_request) Successful in 1m26s
WAI JPEG-AI whole decode (pinned inputs, required) / fetch pinned JPEG-AI inputs → whole decode + pixel hash, required (pull_request) Successful in 58s
WAI neural sink gates / model-free refusals of the neural sink (pull_request) Successful in 1m0s
WAI mbt2018_mean integer decode (regenerated vectors) / regenerate mbt2018_mean integer vectors → Rust decode, required (pull_request) Successful in 3m54s
wai-web wasm32 / wai-web wasm32 build · corpus, menu and writers (pull_request) Successful in 1m50s
standards workspaces build + test / jouleclaw-rs (pull_request) Successful in 12m4s
standards workspaces build + test / aac-rs (pull_request) Successful in 3m44s
standards workspaces build + test / joule-code-rs (pull_request) Successful in 2m50s
standards workspaces build + test / joulecontract-rs (pull_request) Successful in 2m9s
standards workspaces build + test / map-rs (pull_request) Successful in 1m47s
standards workspaces build + test / mesh-rs (pull_request) Successful in 1m13s
standards workspaces build + test / openpay (pull_request) Successful in 5m39s
WAI conformance / cargo-class corpora · linux-arm64 (pull_request) Successful in 9m48s
WAI conformance / cross-arch byte-equality · linux-arm64 (pull_request) Successful in 59s
WAI energy receipts / energy receipts · linux-arm64 (pull_request) Successful in 3m34s
standards workspaces build + test / arl-rs (pull_request) Successful in 2m18s
standards workspaces build + test / joule-ui-rs (pull_request) Successful in 4m44s
standards workspaces build + test / jouledesk-rs (pull_request) Successful in 2m40s
standards workspaces build + test / joulehook-rs (pull_request) Successful in 5m50s
standards workspaces build + test / sense-rs (pull_request) Successful in 2m39s
standards workspaces build + test / macOS energy backends (pull_request) Successful in 4m32s
WAI conformance / cargo-class corpora · macos (pull_request) Successful in 7m32s
WAI conformance / cross-arch byte-equality · macos (pull_request) Successful in 33s
WAI energy receipts / energy receipts · macos (pull_request) Failing after 11m34s
aa64bcf112
Claims that classical computers cannot simulate a material are claims about
entanglement; in one dimension the density-matrix renormalization group
usually can, with an error it reports. quantum_dmrg:

- Chain: nearest-neighbour spin-1/2 chains with real terms (XXZ Heisenberg in
  a field, transverse-field Ising), written as matrix-product operators (the
  finite-state machine of their terms).
- Two-site DMRG: Lanczos with full re-orthogonalisation for the lowest state
  of the effective Hamiltonian; truncation by the reduced density matrix's
  eigenvectors (max bond, weight cutoff); discarded weight and the
  entanglement entropy at every bond.
- symmetric_eigen: Householder tridiagonalisation and implicit QL
  (tred2/tql2), hypotenuses in-crate.
- Exact referees: Lanczos on the full 2^n space (to 22 sites), and the open
  transverse-field Ising chain as free fermions at any length
  (E0 = -1/2 sum Lambda_k, Lambda_k^2 the eigenvalues of (A-B)(A+B)).
- The effective Hamiltonian runs in blocks of rows across threads, each row in
  the same order: bit-identical at any thread count (a direct test fails on a
  1e-15 change to one block). The Lanczos tolerance is a setting (1e-8 by
  default; the energy error goes as its square).

Checked:
- the eigensolver reconstructs random symmetric matrices to 1e-12;
- the free-fermion energy equals exact diagonalisation (n = 4, 7, 10);
- DMRG equals exact diagonalisation to 1e-8 on Heisenberg and Ising chains;
- critical Ising: 1.1e-11 per site at 100 sites, 1.4e-11 at 200 against the
  exact energy; Heisenberg 100 sites: -44.127739250 at bond 64 and
  -44.127739889 at bond 128, converging from above;
- variational, monotone in sweeps, repeatable.

The cross-platform pin caught a pointer-width bug: the exact-diagonalisation
start vector multiplied in usize, which wraps differently on wasm32; it now
uses u64, and all 19 pins hold natively and under wasm32-wasip2.

CLI: wai-quantum dmrg [--chain ising|heisenberg] [-n] [--j --jz --h] [--bond]
[--sweeps] [--exact] [--json]. Example: dmrg_chain. CLI output byte-identical
natively and under WASI.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The contraction engine, the density-matrix split and the canonical form
now run on any Scalar: f64 for ground states, the crate's complex type
for time evolution. Real arithmetic keeps its exact order, so the DMRG
pin does not move. A Hermitian eigensolver (Householder to a real
tridiagonal, the shared QL iteration, reflections carried back) serves
the complex split.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
wai-quantum 0.3.35: time evolution of spin chains by TDVP, held to exact answers
Some checks failed
standards workspaces build + test / smart-byte-rs (pull_request) Successful in 3m40s
WAI conformance / cargo-class corpora · linux (pull_request) Successful in 4m29s
WAI conformance / v2 vocabulary · manifests validate as stated (pull_request) Successful in 12s
WAI conformance / independent verifiers · claims, JWP, key discovery and integer payloads (Python) (pull_request) Successful in 2m11s
WAI conformance / cross-arch byte-equality · linux (pull_request) Successful in 29s
WAI conformance / C2PA manifest emission · signed, read back, validated (pull_request) Successful in 46s
WAI energy receipts / energy receipts · linux (pull_request) Successful in 1m31s
WAI JPEG-AI whole decode (pinned inputs, required) / fetch pinned JPEG-AI inputs → whole decode + pixel hash, required (pull_request) Successful in 1m4s
WAI neural sink gates / model-free refusals of the neural sink (pull_request) Successful in 1m2s
WAI mbt2018_mean integer decode (regenerated vectors) / regenerate mbt2018_mean integer vectors → Rust decode, required (pull_request) Successful in 3m56s
wai-web wasm32 / wai-web wasm32 build · corpus, menu and writers (pull_request) Successful in 1m45s
standards workspaces build + test / jouleclaw-rs (pull_request) Successful in 2m41s
standards workspaces build + test / aac-rs (pull_request) Successful in 1m37s
standards workspaces build + test / joule-code-rs (pull_request) Successful in 1m0s
standards workspaces build + test / joulecontract-rs (pull_request) Successful in 41s
standards workspaces build + test / map-rs (pull_request) Successful in 41s
standards workspaces build + test / mesh-rs (pull_request) Successful in 34s
standards workspaces build + test / openpay (pull_request) Successful in 2m7s
WAI conformance / cargo-class corpora · linux-arm64 (pull_request) Successful in 6m5s
WAI conformance / cross-arch byte-equality · linux-arm64 (pull_request) Successful in 34s
WAI energy receipts / energy receipts · linux-arm64 (pull_request) Successful in 2m9s
standards workspaces build + test / arl-rs (pull_request) Successful in 3m57s
standards workspaces build + test / joule-ui-rs (pull_request) Successful in 3m58s
standards workspaces build + test / jouledesk-rs (pull_request) Successful in 4m0s
standards workspaces build + test / joulehook-rs (pull_request) Successful in 3m53s
standards workspaces build + test / sense-rs (pull_request) Successful in 3m57s
standards workspaces build + test / macOS energy backends (pull_request) Failing after 6m44s
WAI conformance / cargo-class corpora · macos (pull_request) Successful in 8m36s
WAI conformance / cross-arch byte-equality · macos (pull_request) Successful in 35s
WAI energy receipts / energy receipts · macos (pull_request) Successful in 3m2s
e2a6baa5b1
quantum_tdvp evolves a matrix-product state by the two-site time-dependent
variational principle, a symmetric second-order sweep:
- each bond goes forward half a step under its effective Hamiltonian, and the
  new centre goes back half a step under its one-site one;
- the exponentials are Lanczos with full re-orthogonalisation, and a step
  that does not converge is halved;
- bonds are split by a Jacobi SVD, so amplitudes resolve to rounding;
- every bond's basis is completed with null vectors up to max_bond, which
  removes the projection error a product state's small bonds would cause.

The referees are exact Krylov evolution of all amplitudes (up to 20 sites) and
the free-fermion Ising quench at any length, including the Loschmidt echo.

Checked:
- complete bases are exact to rounding at any step size;
- at 100 sites and bond 64 the critical quench stays within 1e-9 of the exact
  answer through t = 3, and past that the error follows the reported
  discarded weight;
- runs are bit-identical across thread counts and natively vs wasm32-wasip2
  (new pin);
- the CLI command tdvp prints the same bytes natively and under WASI.

A fourth-order Yoshida composition was measured as less accurate and slower,
and was removed; the module docs record why.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Transaction-Science/open-standards!160
No description provided.