KrylovBased
full name: tenpy.linalg.krylov_based.KrylovBased
parent module:
tenpy.linalg.krylov_based
type: class
Inheritance Diagram
Methods
|
|
|
|
|
|
|
- class tenpy.linalg.krylov_based.KrylovBased(H, psi0, options)[source]
Bases:
object
Base class for iterative 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 original 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 aArray
; 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 to abort if the norm of the new krylov vector is too small. [...]
Shift the energy (=eigenvalues) by that amount *during* the Lanczos run by [...]
Lower cutoff for the gap estimate used in the P_tol criterion.
Maximum number of steps to perform.
Minimum number of steps to perform.
Tolerance for the error estimate from the Ritz Residual, [...]
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 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 vector 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 byrun()
is made independent of the shift. This option is useful if theOrthogonalNpcLinearOperator
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.
- 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.
- H
The linear operator used for building the Krylov space.
- Type:
NpcLinearOperator
-like
- 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)
- _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.