diagonalize.lanczos

diagonalize.lanczos(A, v0=None, deg=None, rtol=1e-08, orth=0, sparse_mat=False, return_basis=False, seed=None, dtype=None)

Lanczos method for matrix tridiagonalization.

This function implements Paiges A27 variant (1) of the Lanczos method for tridiagonalizing linear operators, with additional modifications to support varying degrees of re-orthogonalization. In particular, orth=0 corresponds to no re-orthogonalization, orth < deg corresponds to partial re-orthogonalization, and orth >= deg corresponds to full re-orthogonalization.

Notes

The Lanczos method builds a tridiagonal T from a symmetric A via an orthogonal change-of-basis Q: Q^T A Q = T Unlike other Lanczos implementations (e.g. SciPy’s eigsh), which includes e.g. sophisticated restarting, deflation, and selective-reorthogonalization steps, this method simply executes deg steps of the Lanczos method with the supplied v0 and returns the resulting tridiagonal matrix T.

Rayleigh-Ritz approximations of the eigenvalues of A can be further obtained by diagonalizing T via any symmetric tridiagonal eigenvalue solver, scipy.linalg.eigh_tridiagonal though note unlike eigsh no checking is performed for ‘ghost’ or already converged eigenvalues. To increase the accuracy of these eigenvalue approximation, try increasing orth and deg. Supplying either negative values or values larger than deg for orth will result in full re-orthogonalization, though note the number of matvecs scales linearly with deg and the number of inner-products scales quadratically with orth.

Parameters

Name Type Description Default
A scipy.sparse.linalg.LinearOperator or ndarray or sparray Symmetric operator to tridiagonalize. required
v0 ndarray Initial vector to orthogonalize against. None
deg int Size of the Krylov subspace to expand. None
rtol float Relative tolerance to consider the invariant subspace as converged. 1e-8
orth int Number of additional Lanczos vectors to orthogonalize against. 0
sparse_mat bool Whether to output the tridiagonal matrix as a sparse matrix. False
return_basis bool If True, returns the Krylov basis vectors Q. False
dtype dtype The precision dtype to specialize the computation. None

Returns

Type Description
tuple A tuple (a,b) parameterizing the diagonal and off-diagonal of the tridiagonal matrix. If return_basis=True, the tuple (a,b), Q is returned, where Q represents an orthogonal basis for the degree-deg Krylov subspace.

See Also

scipy.linalg.eigh_tridiagonal : Eigenvalue solver for real symmetric tridiagonal matrices. operator.matrix_function : Approximates the action of a matrix function via the Lanczos method.

References

  1. Paige, Christopher C. “Computational variants of the Lanczos method for the eigenproblem.” IMA Journal of Applied Mathematics 10.3 (1972): 373-381.