Inheritance Diagram

Inheritance diagram of tenpy.algorithms.dmrg.SubspaceExpansion


SubspaceExpansion.__init__(options, ...)

SubspaceExpansion.perturb_svd(engine, theta, ...)

Preform a subspace expansion of a single-site wave function on one side.


Update the amplitude, possibly disable the mixer.

Class Attributes and Properties


how many sites the theta in perturb_svd should have

class tenpy.algorithms.dmrg.SubspaceExpansion(options, sweep_activated)[source]

Bases: tenpy.algorithms.dmrg.Mixer

Mixer of a direct subspace expansion for both single-site DMRG and two-site DMRG.

Performs a subspace expansion following [hubig2015]. It views theta as a single-site wave function.

It is actually not necessary to fill the next_B with zeros as described in Hubig’s paper; rather we directly project the wR leg of VH onto the IdL index, which corresponds to taking the original theta (up to truncation).

Pictorially for a subspace expansion of the left U while moving right:

|  --theta---            .-theta---                                  --U---S---VH---
|     |                  |   |                                         |       |
|             =dot=>    LP---H0--mix_L--     =SVD=>                    |       .---[IdL]
|                        |   |          (vL.p0),(wR.vR)

For a left-move:

|  --theta---            --theta--.                         ---U---S---VH--
|     |                      |    |                            |       |
|            =dot=>  --mix_R-H0---RP         =SVD=>      [IdR]-.       |
|                            |    |     (vL.wL),(p0.vR)

Note that only the U during the right move (or VH during left-move) is guaranteed to be an isometry as expected in the canonical form; VH during the right-move contains a “subspace expansion” and does not fulfill the canonical == eye. Moreover, the U constructed from a two-site theta viewing the '(p1.vR) leg as just vR in the right-move is (mathematically) equivalent to the U returned by the DensityMatrixMixer (up to degenerate singular values).

In other words, the SubspaceExpansion and DensityMatrixMixer should produce equivalent results; they only differ in the way they calculate U and V internally.

perturb_svd(engine, theta, i0, move_right)[source]

Preform a subspace expansion of a single-site wave function on one side.

  • engine (DMRGEngine) – The DMRG engine calling the mixer.

  • theta (Array) – The optimized wave function, prepared for svd, with labels '(vL.p0)', 'vR' for right move, or 'vL', '(p0.vR)' for left move.

  • i0 (int) – The site index where theta lives.

  • move_right (bool) – Whether we move to the right (True) or left (False).


  • U, VH (Array) – Left and right part of the subspace-expanded svd. Always such that the contraction U.S.VH resembles the original theta up to truncation error. U has labels '(vL.p0)', 'vR' (right move) or 'vL', 'vR' (left move). V has labels 'vL', 'vR' (right move) or '(vL.p0)', 'vR' (left move). For a right move, only U is canonical; for a left-move only VH is canonical.

  • S (1D ndarray) – (Perturbed) singular values on the new bond.

  • err (TruncationError) – The truncation error introduced.

  • S_approx (ndarray) – Same as S.


Update the amplitude, possibly disable the mixer.


sweeps (int) – The number of performed sweeps, to check if we need to disable the mixer.


mixer – Returns self if we should continue mixing, or None, if the mixer should be disabled.

Return type

Mixer | None