numerics
Loading...
Searching...
No Matches
lanczos.hpp File Reference

Lanczos algorithm – k extreme eigenvalues of a large sparse matrix. More...

Go to the source code of this file.

Classes

struct  num::LanczosResult
 Result of a Lanczos eigensolver. More...
 

Namespaces

namespace  num
 

Functions

LanczosResult num::lanczos (MatVecFn matvec, idx n, idx k, real tol=1e-10, idx max_steps=0, Backend backend=Backend::seq)
 Lanczos eigensolver for large sparse symmetric matrices.
 

Detailed Description

Lanczos algorithm – k extreme eigenvalues of a large sparse matrix.

The Lanczos algorithm builds a k-dimensional Krylov subspace

K_k(A, v) = span{v, Av, A^2v, ..., A^{k-1}v}

and finds the k Ritz pairs (approximate eigenpairs) that are the extreme eigenvalues of the projected kxk tridiagonal matrix T_k.

Key properties:

  • Matrix-free: A is given as a MatVecFn callable (works with sparse, structured A)
  • O(k*nnz) work for k steps (nnz = cost of one matvec)
  • Finds the k LARGEST and k SMALLEST eigenvalues accurately

Usage:

lanczos(mv, n, k); // sequential
lanczos(mv, n, k, 1e-10, 0, num::omp); // OMP reorthogonalisation
constexpr Backend omp
Definition policy.hpp:34

Definition in file lanczos.hpp.