[WIP] Add two-site DMRG for tree tensor networks#122
Draft
mtfishman wants to merge 2 commits into
Draft
Conversation
Adds `dmrg`, a two-site DMRG ground-state solver for trees: the operator is a `TensorNetworkOperator`, the exact projected-Hamiltonian environments live in a `MessageCache` of `NamedDimsArrays` operators, and the driver follows the layered `AlgorithmsInterface` structure used by `beliefpropagation` and `apply_operators`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #122 +/- ##
==========================================
+ Coverage 74.79% 74.97% +0.18%
==========================================
Files 24 26 +2
Lines 1079 1247 +168
==========================================
+ Hits 807 935 +128
- Misses 272 312 +40
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Move `dmrg` to the top of `dmrg.jl` so the file reads entry-point first, matching `apply_operators.jl`. Split the generic pieces into their own files: `tensornetworkoperator.jl`, `quadraticformnetwork.jl`, `orthogonalize.jl`, and `nameddimsarrays_extensions.jl` (the temporary `VectorInterface` methods on `AbstractNamedDimsArray`). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
dmrg, a two-site DMRG ground-state solver for tree tensor networks, built on the same layeredAlgorithmsInterfacestructure asbeliefpropagationandapply_operators. It works on any tree, gauges the state with isometric (QR) orthogonalization, and holds the projected-Hamiltonian environments in aMessageCache.The operator is passed as a
TensorNetworkOperator, a tensor network together with the map between its bra-side and ket-side physical names (the tensor-network analogue of aNamedDimsArraysoperator). AQuadraticFormNetworkwraps the lazy⟨ψ|H|ψ⟩and derives the bra layer from the ket, so it tracks updates to the state. On a tree the environments are exact: each per-edge message is the contraction of the⟨ψ|H|ψ⟩subtree on one side of the cut, carried as aNamedDimsArraysoperator whose codomain and domain record the bra-to-ket link correspondence, so the bra link names generated internally are queryable from the returned environment.The environment is built once per solve and kept current incrementally as the orthogonality center walks to each region, so a sweep stays linear in the number of sites. Truncation can vary across sweeps through a
truncfunction of the sweep index, andstopping_criteriontakes(; maxsweeps, tol)(a sweep cap and an energy-convergence tolerance) or an explicit criterion.The effective Hamiltonian is currently materialized into a single operator tensor rather than applied matrix-free. A matrix-free version is a planned follow-up.
TODO
VectorInterfacemethods onAbstractNamedDimsArray(needed byKrylovKit.eigsolve) intoNamedDimsArrays, then drop thebrokenmarker on the Aqua piracy check.