KrylovBased

Inheritance Diagram

Inheritance diagram of tenpy.linalg.lanczos.KrylovBased

Methods

KrylovBased.__init__(H, psi0, options[, ...])

KrylovBased.run()

class tenpy.linalg.lanczos.KrylovBased(H, psi0, options, orthogonal_to=[])[source]

Bases: object

Base class for iterativ algorithms building a Krylov basis with np_conserved arrays.

Algorithms like LanczosGroundState and :class:`ArnoldiDiagonalize are based on iteratively building an orthonormal basis of the Krylov space spanned by |psi0>, H|psi0>, H^2|psi0>, ... H^N |psi0>, where N is the number of iterations performed so far, and |psi0> is an initial guess and starting vector. During that iteration, the projection of H into the Krylov space is built, where it can be solved effectively (with H being just a N by N matrix), yielding the “Ritz” eigenvalues/ eigenvectors. Finally, the solution can be translated back into the orginal space using the basis.

An important strategy is also to (implicitly) restart the algorithm after some number of steps. This is not done here: when we use these classes, we usually have an explicit outer loop performed until convergence, e.g., the “sweeps” in DMRG.

Parameters
  • H (NpcLinearOperator-like) – A hermitian linear operator. Must implement the method matvec acting on a Array; nothing else required. The result has to have the same legs as the argument.

  • psi0 (Array) – The starting vector defining the Krylov basis. For finding the ground state, this should be the best guess available. Note that it does not have to be a 1D “vector”; we are fine with viewing higher-rank tensors as vectors.

  • options (dict) – Further optional parameters as described in Lanczos. The algorithm stops if both criteria for e_tol and p_tol are met or if the maximum number of steps was reached.

Options

config KrylovBased
option summary

cutoff

Cutoff to abort if the norm of the new krylov vecotr is too small. [...]

E_shift

Shift the energy (=eigenvalues) by that amount *during* the Lanczos run by [...]

min_gap

Lower cutoff for the gap estimate used in the P_tol criterion.

N_max

Maximum number of steps to perform.

N_min

Minimum number of steps to perform.

P_tol

Tolerance for the error estimate from the Ritz Residual, [...]

option N_min: int

Minimum number of steps to perform.

option N_max: int

Maximum number of steps to perform.

option P_tol: float

Tolerance for the error estimate from the Ritz Residual, stop if (RitzRes/gap)**2 < P_tol

option min_gap: float

Lower cutoff for the gap estimate used in the P_tol criterion.

option cutoff: float

Cutoff to abort if the norm of the new krylov vecotr is too small. This is necessary if the rank of H is smaller than N_max, but it’s not the error tolerance for final values!

option E_shift: float

Shift the energy (=eigenvalues) by that amount during the Lanczos run by using the ShiftNpcLinearOperator. The ground state energy E0 returned by run() is made independent of the shift. This option is useful if the OrthogonalNpcLinearOperator is used: the orthogonal vectors are exact eigenvectors with eigenvalue 0 independent of the shift, so you can use it to ensure that the energy is smaller than zero to avoid getting those.

options

Optional parameters.

Type

Config

H

The linear operator used for building the Krylov space.

Type

NpcLinearOperator-like

psi0

The starting vector; normalized copy.

Type

Array

N_min, N_max, P_tol, min_gap, _cutoff, E_shift

Parameters as described in the options.

Es

Es[n, :] contains the energies of _h_krylov[:n+1, :n+1] in step n.

Type

ndarray, shape(N_max, N_max)

_h_krylov

The matrix representing H projected onto the orthonormalized Krylov basis.

Type

ndarray, shape (N_max + 1, N_max +1)

_psi0_norm

Initial norm of the psi0 parameter. Note that self.psi0 gets normalized.

Type

float

_cache

The ONB of the Krylov space generated during the iteration. FIFO (first in first out) cache of at most N_cache vectors.

Type

list of psi0-like vectors

_result_krylov

Result in the ONB of the Krylov space, e.g. the ground state of _h_krylov. What exactly this is depends on the subclass.

Type

ndarray

Notes

The Ritz residual RitzRes is computed according to http://web.eecs.utk.edu/~dongarra/etemplates/node103.html#estimate_residual. Given the gap, the Ritz residual gives a bound on the error in the wavefunction, err < (RitzRes/gap)**2. The gap is estimated from the full Lanczos spectrum.