LanczosGroundState¶
full name: tenpy.linalg.lanczos.LanczosGroundState
parent module:
tenpy.linalg.lanczos
type: class
Inheritance Diagram
Methods
|
|
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 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.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 to abort if `beta` (= norm of next vector in Krylov basis before nor [...]
Shift the energy (=eigenvalues) by that amount *during* the Lanczos run by [...]
Stop if energy difference per step < `E_tol`
Lower cutoff for the gap estimate used in the P_tol criterion.
The maximum number of `psi` to keep in memory during the first iteration. [...]
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 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
. 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.
- H¶
The hermitian linear operator.
- Type
NpcLinearOperator
-like
- 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)
- _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.