Skip to content

eigs_lanczos

Performs an iterative eigenvalue calculation building eigenvectors using the Lanczos algorithm. Returns the tridiagonal matrix, eigenvalues, number of iterations and the stopping criterion. The Lanczos interations are performed twice, where at the second run the eigenvectors are built.

Sources
eigs_lanczos.hpp
eigs_lanczos.cpp
eigs_lanczos.jl


Definition

The Lanczos algorithm can be run in two distinct ways:

  1. A random intial state ψ0=r|\psi_0\rangle = |r\rangle with normal distributed entries is used.

    EigsLanczosResult
    eigs_lanczos(OpSum const &ops, Block const &block, int64_t neigvals = 1,
                 double precision = 1e-12, int64_t max_iterations = 1000,
                 double deflation_tol = 1e-7, int64_t random_seed = 42);
    
    eigs_lanczos(ops::OpSum, block::Block; neigvals::Int64 = 1,
                 precision::Float64 = 1e-12, max_iterations::Int64 = 1000,
                 deflation_tol::Float64 = 1e-7, random_seed::Int64 = 42)
    
  2. The initial state ψ0|\psi_0\rangle is explicitly specified

    EigsLanczosResult 
    eigs_lanczos(OpSum const &ops, State const &psi0, int64_t neigvals = 1,
                 double precision = 1e-12, int64_t max_iterations = 1000,
                 double deflation_tol = 1e-7);
    
    eigs_lanczos(ops::OpSum, psi0::State; neigvals::Int64 = 1,
                 precision::Float64 = 1e-12, max_iterations::Int64 = 1000,
                 deflation_tol::Float64 = 1e-7, random_seed::Int64 = 42)
    


Parameters

Name Description Default
ops OpSum defining the bonds of the operator
block block on which the operator is defined
psi0 Initial State from which the Lanczos algorithm is started
neigvals number of eigenvalues to converge 1
precision accuracy of the computed ground state 1e-12
max_iterations maximum number of iterations 1000
deflation_tol tolerance for deflation, i.e. breakdown of Lanczos due to Krylow space exhaustion 1e-7
random_seed random seed for setting up the initial vector 42

Returns

A struct with the following entries

Entry Description
alphas diagonal elements of the tridiagonal matrix
betas off-diagonal elements of the tridiagonal matrix
eigenvalues the computed Ritz eigenvalues of the tridiagonal matrix
eigenvectors State of shape D×D \times neigvals holding all low-lying eigenvalues up to neigvals
niterations number of iterations performed
criterion string denoting the reason why the algorithm stopped

Convergence criterion

The algorithm terminates if the kk-th (kk is the argument neigvals) approximate eigenvalue changes only by a fraction smaller than ϵ\epsilon (kk is the argument precision), i.e.

(e~k(n)e~k(n1))/e~k(n)<ϵ. (\tilde{e}_k^{(n)} - \tilde{e}_k^{(n-1)}) / \tilde{e}_k^{(n)} < \epsilon.

Here, e~k(n)\tilde{e}_k^{(n)} denotes the Lanczos approximation to the kk-th eigenvalue after nn iterations.


Usage Example

int N = 8;
int nup = N / 2;
auto block = Spinhalf(N, nup);

// Define the nearest-neighbor Heisenberg model
auto ops = OpSum();
for (int i=0; i<N; ++i) {
  ops += "J" * Op("SdotS", {i, (i+1) % N});
}
ops["J"] = 1.0;

// With random intial state
auto res = eigs_lanczos(ops, block);
XDIAG_SHOW(res.alphas);
XDIAG_SHOW(res.betas);
XDIAG_SHOW(res.eigenvalues);
XDIAG_SHOW(res.eigenvectors);
let
    N = 8
    nup = N ÷ 2
    block = Spinhalf(N, nup)

    # Define the nearest-neighbor Heisenberg model
    ops = OpSum()
    for i in 1:N
        ops += "J" * Op("SdotS", [i, mod1(i+1, N)])
    end
    ops["J"] = 1.0

    # With random intial state
    res = eigs_lanczos(ops, block)
    @show res.alphas
    @show res.betas
    @show res.eigenvalues
    @show res.eigenvectors
end