Randomized matrix-free quadrature for spectrum and spectral sum approximation
Tyler Chen
This is a companion piece to the paper: https://arxiv.org/abs/2204.01941
Code to replicate the figures in this document can be found on Github.
Introduction
The cumulative empirical spectral measure (CESM) Φ:R→[0,1], induced by A, is defined by
Φ(x)=ΦA:=i=0∑n−1n−1I[λi≤x].
Here I[true]=1 and I[false]=0.
Traces of matrix functions are related to the CESM by
tr(f(A))=n∫fdΦ.
You can read more about applications of these quantities here.
In this paper, we provide a unified perspective of algorithms for randomized matrix-free quadrature.
Specifically, the class of algorithms we study is characterized by the use of a Krylov subspace method to approximate independent and identically distributed samples of vTf(A)v, where v is an isotropic random vector.
Since many widely used algorithms, such as stochastic Lanczos quadrature (SLQ) [1] and the kernel polynomial method (KPM) [2], fall into this class, our unified perspective allows the algorithms’ tradeoffs to be more clearly understood.
Define the weighted CESM Ψ:R→[0,1], an estimator for the CESM defined by
Ψ(x):=vTI(A≤x)v=i=1∑n∣vTui∣2I(λi≤x),
where v is a random vector satisfying E[vvT]=n−1I; i.e., v is isotropic with appropriate scale.
Then, using basic properties of the trace and expectation, we have
E[Ψ(x)]=E[vTI(A≤x)v]=E[tr(vTI(A≤x)v)]=E[tr(I(A≤x)vvT)]=tr(E[I(A≤x)vvT])=tr(I(A≤x)E[vvT])=n−1tr(I(A≤x))=Φ(x).
Further, almost by definition, we see that ∫−∞∞f(x)dΨ(x)=vTf(A)v is an unbiased estimator for n−1tr(f(A)).
The Lanczos method for matrix function approximation (Lanczos-FA) can be used to approximate vTf(A)v (read more about this task here).
The prototypical algorithm
A natural approach to approximate the CESM Ψ and therefore tr(f(A)) is to average several copies of Ψ.
However, computing Ψ requires knowledge of the eigenvalues of A.
Therefore, we can approximate Ψ with a quadrature rule; i.e. with a simpler distribution function.
The most common way to do this is by obtaining the moments of Ψ, and using this information to ensure that polynomials up to some degree are integrated exactly.
This is typically done with a Krylov subspace method.
Indeed, for any i,j with 0≤i,j≤k,
(Ajv)T(Ajv)=vTAi+jv=∫−∞∞xi+jdΨ(x).
Thus, the moments of Ψ through degree 2k can be computed using the information in the Krylov subspace
Kk(A,v):=span{v,Av,…,Akv}={p(A)v:deg(p)≤k}.
This can be summarized with the following algorithm:
Algorithm. Prototypical randomized matrix free quadrature
1:2:3:4:5:6:protoalg(A,nv,k,∘)for ℓ=1,2,…,nv dodefine (implicitly) Ψℓ∼iidΨ by sampling vℓ∼iidv, E[vvT]=n−1Icompute the moments of Ψℓ through degree s by constructing Kk(A,vℓ)approximate Ψℓ by a quadrature rulereturn average of individual quadrature rules
A unified perspective
Common algorithms like SLQ and KPM are special instances of the prototypical algorithm described above.
As such, they can all be analyzed through the lens of randomized quadrature.
Our analysis shows that all algorithms of this form satisfy similar theoretical bounds.
However there are many practical concerns which separate the algorithms.
A number of important past works have argued that Lanczos-based approaches are unstable, and therefore should not be used without costly reorthogonalization schemes
.
Based on the analysis in [3] , we argue that, even without reorthogonalzation, Lanczos-based approaches tend to outperform approaches based on explicit polynomials.
In fact, we go so far as to argue that explicit polynomial methods such as the kernel polynomial method should typically be implemented using Lanczos.
The qualitative tradeoffs between the algorithms are further illustrated by our numerical experiments in a wite variety of numerical experiments.
References
1. Ubaru, S.; Chen, J.; Saad, Y. Fast Estimation of tr (f(A)) via Stochastic Lanczos Quadrature. SIAM Journal on Matrix Analysis and Applications 2017, 38, 1075–1099, doi:10.1137/16m1104974.
2. Weiße, A.; Wellein, G.; Alvermann, A.; Fehske, H. The Kernel Polynomial Method. Reviews of Modern Physics 2006, 78, 275–306, doi:10.1103/revmodphys.78.275.
3. Knizhnerman, L.A. The Simple Lanczos Procedure: Estimates of the Error of the Gauss Quadrature Formula and Their Applications. Comput. Math. Math. Phys. 1996, 36, 1481–1492.