DMRG and Matrix Product States
Tensor Networks
What you need to know first 24 concepts, 6 layers
The requisite-knowledge inventory for this page, bottom-up: the primitives at the base, combined upward until you reach what this page assumes. Skim the layers you already own; start wherever the ground gets unfamiliar.
- base
- Linear algebraconcept
- Quantum mechanics (states & operators)
- L1
- Functional derivatives
- Linear systems (Ax = b)concept
- Matrix eigenvalue problems
- Orthogonality & projectionconcept
- Symmetric / Hermitian operatorsconcept
- The eigenvalue problem (Ax = λx)concept
- Two-electron integrals (ERIs)
- L2
- Gaussian elimination
- Krylov subspacesconcept
- Power iteration
- Singular value decomposition
- Variational principle
- L3
- Entanglement entropyconcept
- Hartree-Fock
- Householder QR
- L4
- Arnoldi iteration
- Electron correlationconcept
- Matrix product statesconcept
- SCF iteration
- The area lawconcept
- L5
- ↳you are here
10 of these are concepts without a dedicated page yet — the grey chips. Following the linked ones first makes the rest land.
Full configuration interaction stores every amplitude of an -particle wavefunction and runs straight into a wall: numbers, doubling with every site. DMRG is how you climb the wall instead of hitting it — by noticing that the ground states you actually care about are barely entangled, and compressing the wavefunction into a chain of small matrices. The same Lanczos you already use sits at its heart. Five ways in; read the one that lands.
A quantum state on sites with states each lives in a space of dimension . Full configuration interaction (FCI) stores all amplitudes and diagonalizes in that space — exact, and exponentially doomed. At , fifty spins is amplitudes: a petabyte for one vector.
But you rarely need all of it. The ground state of a local Hamiltonian is one very particular vector in that enormous space, and it has far less structure than its length suggests. DMRG is the bet that you can throw away almost every amplitude and keep the answer — if you compress along the right seams.
Cut the chain in two and ask how entangled the halves are. For a random state the answer is "maximally" — the entanglement entropy grows with the volume of the smaller half. But ground states of local, gapped Hamiltonians obey an area law: in 1D the entropy across a cut is bounded by a constant, independent of how long the chain is.
That constant is the whole game. Bounded entanglement means each cut can be described by a fixed number of effective states, not the a generic vector would demand. The demo below shows it directly: in the gapped phase the entropy is flat and tiny, and a handful of states per bond reproduces the energy to machine precision. At a critical point the area law fails gently — the entropy creeps up like — and DMRG has to work harder.
Take the coefficient tensor and reshape it into a matrix splitting site 1 from the rest. Its singular value decomposition is the Schmidt decomposition across that cut: the singular values are the entanglement spectrum, and is exactly the weight you lose by keeping only the top . Eckart–Young says that truncation is the best rank- approximation there is.
Now peel site 2 off the remainder and SVD again. And again, down the chain. Each step factors one more site and truncates its bond to . What is left when you reach the end is the wavefunction rewritten as a product of small matrices — a matrix product state — with every bond an SVD you understand.
Draw the wavefunction as a single box with legs, one per site. A matrix product state replaces that one fat box with a row of small boxes — one per site — joined left-to-right by internal "bond" legs. Each box has one physical leg (its site's state) and up to two bond legs; contracting all the bonds reconstructs the full tensor.
The bond dimension — the width of those internal legs — is the single dial. is a product state, mean-field, no entanglement. Crank up and the train can carry more correlation between the sites; at it is exact again. Cost grows as , not — linear in the chain length, for fixed entanglement.
Here is the algorithm DMRG actually runs. Hold every tensor in the train fixed except one. With the rest frozen, minimizing over that one tensor is no longer a -dimensional problem — it collapses to a small effective eigenvalue problem, a few unknowns. You solve it for the lowest eigenvector with Lanczos — the same three-term recurrence you already use everywhere on this site.
Move to the next site, rebuild the local problem, Lanczos again. Sweep left to right, then right to left, and the energy comes down every pass. It is the variational principle restricted to the MPS manifold — coordinate descent where each coordinate is one tensor and each line-search is an eigensolve. An SVD after each step re-truncates the bond back to .
Watch the wall fall, on real numbers
This is the payoff, computed by exact diagonalization of a 12-site transverse-field Ising chain (so we have the true answer to compare to) and then asking: how well does the best bond- matrix product state reproduce the ground-state energy? Switch phases and drag . The error falls off a cliff — and the entanglement profile on the right tells you, in advance, how steep that cliff will be.
At χ = 4, the chain keeps the top 4 of 64 Schmidt states per bond. Ground-state energy error 2.7e-5 · discarded weight at the middle cut 1.6e-6.
Read the gap between the curves. The disordered chain is gapped, its entanglement flat and tiny, and already buys six digits. The critical chain wears the arch, and the same leaves you three digits short — the area law's failure mode, made visible. This is why DMRG is a 1D method first: it is exactly as good as the area law is true.
The whole thing, in code you can run
Build the Hamiltonian and get the exact ground state with the Lanczos solver you already know. is fine at ; the point is to have ground truth to truncate against.
import numpy as np, scipy.sparse as sp
from scipy.sparse.linalg import eigsh
# Transverse-field Ising chain (open): H = -J Σ Z_i Z_{i+1} - h Σ X_i
X = sp.csr_matrix([[0., 1.], [1., 0.]]); Z = sp.csr_matrix([[1., 0.], [0., -1.]])
def op_at(o, i, N): # o acting on site i, identity elsewhere
m = sp.identity(1)
for k in range(N): m = sp.kron(m, o if k == i else sp.identity(2))
return m
def tfim(N, h, J=1.0):
H = sp.csr_matrix((2**N, 2**N))
for i in range(N-1): H -= J * op_at(Z, i, N) @ op_at(Z, i+1, N)
for i in range(N): H -= h * op_at(X, i, N)
return H
N = 12
E0, psi = eigsh(tfim(N, h=1.0), k=1, which='SA') # Lanczos — the same solver
E0, psi = float(E0[0]), psi[:, 0] # DMRG calls on each sweep Now measure the entanglement across every cut, and build the best bond- MPS by the sweep-of-SVDs from framing 3 — then contract it back and re-measure the energy. No DMRG sweep yet; this is the target DMRG climbs toward variationally.
def entanglement(psi, N): # von Neumann entropy across each cut
out = []
for c in range(1, N):
s = np.linalg.svd(psi.reshape(2**c, 2**(N-c)), compute_uv=False)
p = s**2; p = p[p > 1e-16]
out.append(float(-(p*np.log2(p)).sum()))
return out
def best_mps_energy(psi, N, chi, H): # truncate to bond dimension chi, re-measure
state, chiL, A = psi.reshape(1, -1), 1, []
for i in range(N): # sweep left to right
U, s, Vh = np.linalg.svd(state.reshape(chiL*2, -1), full_matrices=False)
k = min(chi, len(s)) # keep the top chi
A.append(U[:, :k].reshape(chiL, 2, k)); state = s[:k, None]*Vh[:k]; chiL = k
v = A[0] # contract the train back
for t in A[1:]: v = np.tensordot(v, t, ([-1], [0]))
v = v.reshape(-1) * state.reshape(-1)[0]
return (v @ (H @ v)) / (v @ v) Run it across the three phases and the area law turns into a table. Every number is reproduced by the demo above; the validation row is the part that earns your trust in the rest.
# Energy error |E(chi) - E_exact|, transverse-field Ising chain, N = 12
phase E_exact S_mid chi=1 chi=4 chi=8 chi=16
disordered -25.39350 0.13 bit 1.4e+00 1.1e-06 3.3e-13 ~0 (gapped: trivial)
critical -14.92597 0.57 bit 2.9e+00 2.9e-03 8.2e-09 5e-15 (the hard one)
ordered -11.89205 1.00 bit 5.9e+00 5.4e-05 2.0e-10 6e-14 (cat state)
# validated: h=0 -> -(N-1), h->inf -> -hN, eigsh == dense eigh to 1e-10 Where this goes
What is here is the statics — why an MPS exists and how truncation works. The natural continuation is a series, each step a real algorithm: the Hamiltonian as a matrix product operator; the left/right environment tensors that make the local eigenproblem cheap; the actual two-site DMRG sweep with Lanczos and adaptive bond growth; then TEBD and time evolution, and the leap to 2D with PEPS where the area law — and this whole story — starts to fight back. It also closes a loop on this site: DMRG is the variational answer to the same correlation problem that FCI solves by brute force and that the nuclear shell model meets from the second-quantized side.