LanczosGroundState

  • full name: tenpy.linalg.lanczos.LanczosGroundState

  • parent module: tenpy.linalg.lanczos

  • type: class

Inheritance Diagram

Inheritance diagram of tenpy.linalg.lanczos.LanczosGroundState

Methods

LanczosGroundState.__init__(H, psi0, options)

LanczosGroundState.run()

Find the ground state of H.

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

Bases: object

Lanczos algorithm working on npc arrays.

The Lanczos algorithm can finds extremal eigenvalues (in terms of magnitude) along with the corresponding eigenvectors. It assumes that the linear operator H is hermitian. Given a start vector psi0, it generates an orthonormal basis of the Krylov space, in which H is a small tridiagonal matrix, and solves the eigenvalue problem there. Finally, it transform the resulting ground state back into the original space.

Deprecated since version 0.6.0: Renamed parameter/attribute params to options.

Deprecated since version 0.6.0: Going to remove the orthogonal_to argument. Instead, replace H with OrthogonalNpcLinearOperator(H, orthogonal_to) using the OrthogonalNpcLinearOperator.

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.

  • orthogonal_to (list of Array) – Vectors (same tensor structure as psi) against which Lanczos will orthogonalize, ensuring that the result is perpendicular to them. (Assumes that the smallest eigenvalue is smaller than 0, which should always be the case if you want to find ground states with Lanczos!)

Options

config Lanczos
option summary

cutoff

Cutoff to abort if `beta` (= norm of next vector in Krylov basis before nor [...]

E_shift

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

E_tol

Stop if energy difference per step < `E_tol`

min_gap

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

N_cache

The maximum number of `psi` to keep in memory during the first iteration. [...]

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, [...]

reortho

For poorly conditioned matrices, one can quickly loose orthogonality of the [...]

option N_min: int

Minimum number of steps to perform.

option N_max: int

Maximum number of steps to perform.

option E_tol: float

Stop if energy difference per step < E_tol

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 N_cache: int

The maximum number of psi to keep in memory during the first iteration. By default, we keep all states (up to N_max). Set this to a number >= 2 if you are short on memory. The penalty is that one needs another Lanczos iteration to determine the ground state in the end, i.e., runtime is large.

option reortho: bool

For poorly conditioned matrices, one can quickly loose orthogonality of the generated Krylov basis. If reortho is True, we re-orthogonalize against all the vectors kept in cache to avoid that problem.

option cutoff: float

Cutoff to abort if beta (= norm of next vector in Krylov basis before normalizing) is too small. This is necessary if the rank of H is smaller than N_max - then we get a complete basis of the Krylov space, and beta will be zero.

option E_shift: float

Shift the energy (=eigenvalues) by that amount during the Lanczos run by using the ShiftNpcLinearOperator. Since the Lanczos algorithm finds extremal eigenvalues, this can help convergence. Moreover, if the OrthogonalNpcLinearOperator is used, the orthogonal vectors are exact eigenvectors with eigenvalue 0, so you have to ensure that the energy is smaller than zero to avoid getting those. The ground state energy E0 returned by run() is made independent of the shift.

options

Optional parameters.

Type

Config

H

The hermitian linear operator.

Type

NpcLinearOperator-like

psi0

The starting vector.

Type

Array

orthogonal_to

Vectors to orthogonalize against.

Type

list of Array

N_min, N_max, E_tol, P_tol, N_cache, reortho

Parameters as described above.

Es

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

Type

ndarray, shape(N_max, N_max)

_T

The tridiagonal matrix representing H in the orthonormalized Krylov basis.

Type

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

_psi0_norm

Initial norm of the psi0 passed.

Type

float

_cutoff

See parameter cutoff.

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: ground state of _T.

Type

ndarray

Notes

I have computed the Ritz residual RitzRes 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.

run()[source]

Find the ground state of H.

Returns

  • E0 (float) – Ground state energy (estimate).

  • psi0 (Array) – Ground state vector (estimate).

  • N (int) – Used dimension of the Krylov space, i.e., how many iterations where performed.