
















Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity
Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium
Esta página no es visible en la vista previa
¡No te pierdas las partes importantes!

















Abstract The most expensive part of all Electronic Structure Calculations based on Density Functional The- ory, lies in the computation of an invariant subspace associated with some of the smallest eigenvalues of a discretized Hamiltonian operator. The dimension of this subspace typically depends on the total number of valence electrons in the system, and can easily reach hundreds or even thousands when large systems with many atoms are considered. At the same time, the discretization of Hamiltonians associated with large systems yields very large matrices, whether with plane-wave or real space dis- cretizations. The combination of these two factors results in one of the most significant bottlenecks in Computational Materials Science. In this paper we show how to efficiently compute a large invariant subspace associated with the smallest eigenvalues of a Hermitian matrix using polynomially filtered Lanczos iterations. The proposed method does not try to extract individual eigenvalues and eigen- vectors. Instead, it constructs an orthogonal basis of the invariant subspace by combining two main ingredients. The first is a filtering technique to dampen the undesirable contribution of the largest eigenvalues at each matrix-vector product in the Lanczos algorithm. This techniques employs a well- selected low pass filter polynomial, obtained via a conjugate residual-type algorithm in polynomial space. The second ingredient is the Lanczos algorithm with partial reorthogonalization. Experiments are reported to illustrate the efficiency of the proposed scheme compared to state-of-the-art implicitly restarted techniques.
Keywords: Polynomial Filtering, Conjugate Residual, Lanczos Algorithm, Density Functional Theory
A number of scientific and engineering applications require the computation of a large number of eigen- vectors associated with the smallest eigenvalues of a large symmetric/hermitian matrix. An important example is in electronic structure calculations where the charge density %(r) at a point r in space is calculated from the eigenfunctions Ψi of the Hamiltonian A via the formula
%(r) =
∑^ no
i=
|Ψi(r)|^2 , (1)
where the summation is taken over all occupied states (no) of the system under study. This is a crucial calculation in Density Functional Theory since the potential V of the Hamiltonian A = ∇^2 + V , depends ∗Work supported by NSF grants NSF/ITR-0325218 and NSF/ITR-0428774, by DOE under Grants DE-FG02-03ER25585, DE-FG02-03ER15491, and by the Minnesota Supercomputing Institute
on the charge density %, which in turn depends on the eigenvectors ψi of A (see (1)), and as a result, an iterative loop is required to achieve self-consistence. Computing the charge density %(r) via (1), requires eigenvectors, though it is more accurate to say that what is needed is an orthogonal basis of the invariant subspace associated with the no algebraically smallest eigenvalues. This is because %(r) is invariant under an orthogonal transformations of the basis of eigenfunctions {Ψi}. If the symmetric matrix A is the discretization of the Hamiltonian A and the vectors ψi are the corresponding discretizations of the eigenfunctions Ψi(r) with respect to r, then, the charge densities are the diagonal entries of the “functional density matrix”
P = Qno Q> no with Qno = [ψ 1 ,... , ψno ]. (2)
Specifically, the charge density at the j-th point rj is the j-th diagonal entry of P. In fact, any orthogonal basis Q which spans the same subspace as the eigenvectors ψi, i = 1,... , no can be used. This observation has lead to improved schemes which do not focus on extracting individual eigenvectors. For example, [4] showed that the semi-orthogonal basis computed by the Lanczos algorithm with partial reorthogonalization can be used in order to extract accurate approximations to the charge density. This scheme results in substantial savings relative to schemes which rely on the full reorthogonalization of the Lanczos vectors. In simple terms, the problem considered in this paper can be stated as follows. Given a real symmetric (or complex Hermitian) matrix A ∈ Rn×n^ with eigenvalues λ 1 ≤ λ 2 ≤... ≤ λn, compute the invari- ant subspace Sno associated with the eigenvalues which do not exceed a certain limit γ. In electronic structures, γ is the Fermi energy level and the interval [a, γ] contains the (algebraically) smallest occu- pied eigenstates eigenvalues λ 1 ,... , λno. We assume that we are given an interval [α, β] which (tightly) contains the spectrum of A. The nature of the algorithms used also requires that α ≥ 0. If this is not satisfied, we shift matrix A by a scalar σ so that A + σI does not have any negative eigenvalues. Methods for computing an interval [α, β] when this is not readily available are discussed in section 3.1. This well known problem received much attention in the past few decades, as can be seen from the survey [2]^1 which provides a good illustration of the wealth of algorithmic research in this field. For a comprehensive theoretical discussion of the problem one can to refer to Parlett’s classic book [24] and the references therein. When the number of desired eigenvalues is rather small, in the order of a few dozens, a variety of algorithms successfully address the problem. The most general purpose and extensively used method is based on implicitly restarted Lanczos iterations [36] and is implemented in the software package ARPACK [16]. However, the problem becomes particularly demanding in the cases when we seek to compute a large number of eigenvalues that reach deep into the interior of the spectrum of the matrix at hand. Indeed, in electronic structure calculations, the dimension of the corresponding invariant subspace is equal to the number of occupied states no which typically depends upon the number of free electrons of the system under study. Current state of the art calculations may involve hundreds or even thousands of states. In addition, the dimension n of the Hamiltonian A also depends on the number of atoms and the topology of the system and is almost always in the order of a few hundred thousands. There is a rather rich variety of ways to compute bases of large eigenspaces. Of all methods, the sub- space iteration algorithm is probably the simplest [24]. This algorithm computes the dominant eigenspace, i.e., the one associated with the largest modulus of A, by simply computing an orthogonal basis of the span of AkX, where X is an n × p initial approximation to the egenbasis. This method can be easily modified to compute the eigenspace associated with the algebraically smallest eigenvalues by shifting the matrix. In fact, the subspace iteration algorithm is often used with Chebyshev acceleration [26] which replaces the projection subspace AkX by Ck(θI + (A − σI)/η)X, where Ck is the Chebyshev polyno- mial of degree k of the first kind and θ, σ, η are scaling and shifting parameters. This method was one of the first to be used in electronic structure calculations [17, 18] and this might be attributed to its simplicity and to the availability of an old ALGOL procedure published in the Wilkinson and Reinsch collection of algorithms [38] (which later lead to the development of the EISPACK package). In subsequent (^1) Also available on line at http://www.cs.ucdavis.edu/∼bai/ET/contents.html
Lanczos
(Input) Matrix A ∈ Rn×n, starting vector q 1 , ‖q 1 ‖ 2 = 1, scalar m (Output) Orthogonal basis Qm ∈ Rn×m^ of Km(A, q 1 ), unit norm vector qm+1 such that Q> mqm+1 = 0
Figure 1: The Lanczos algorithm. The inner product for vectors is denoted by < .,. >.
If Qm = [q 1 , · · · , qm] and if Tm denotes the symmetric tridiagonal matrix
Tm =
α 1 β 2 β 2 α 2 β 2
.. .
βm− 1 αm− 1 βm βm αm
where the scalars αi, βi are computed by the Lanczos algorithm (Fig. 1), then the following matrix relation can be easily verified
AQm = QmTm + βm+1vm+1e> m. (6)
Here em is the m-th column of the canonical basis and vm+1 is the last vector computed by the Lanczos algorithm. The Lanczos algorithm approximates part of the spectrum of the original matrix A with that of the much smaller (typically m ¿ n) and simpler tridiagonal matrix Tm. Of course, only a small number of the eigenvalues of A, typically only a small fraction of m, can be approximated by corresponding eigenvalues of Tm. This leads the discussion to the next section.
As is well-known the Lanczos algorithm quickly yields good approximations to extremal eigenvalues of A. In contrast, convergence is typically much slower for the interior of the spectrum [24]. Figure 2 illustrates this phenomenon for a Hamitonian (n = 17, 077) corresponding to the cluster Si 10 H 16 produced by a real space pseudopotential discretization code [5]. For the typical situation under consideration in this paper, an invariant subspace associated with a large number of the algebraically smallest eigenvalues of A is to be computed, reaching far into the interior of the spectrum. So we expect the number m of Lanczos steps required for all the desired eigenvectors to converge, to be very large. Therefore, if the Lanczos algorithm is to be applied without any form of restarting or preconditioning, then we will have to deal with two related constraints: (1) we will need to apply some form of reorthogonalization [4, 15, 24, 33, 34] to the Lanczos vectors and as a result (2) we need to store the Lanczos basis Qm because it is needed by the reorthogonalization steps. The
−2 0 2 4 6 8 10 12 14 16 18 20
−
0
1
2
3
4
5
Index of eigenvalue: smallest to larger
Magnitude of eigenvalues
Exact λ λ 80 λ 120 λ 160 λ 200
n−20^31 n−15 n−10 n−5 n n−20 n−15 n−10 n−5 n n−
32
33
34
35
36
37
Index of eigenvalue: smallest to larger
Magnitude of eigenvalues Exact λ λ 80 λ 120 λ 160 λ 200
Figure 2: Convergence behavior for the 20 smallest (left) and the 20 largest (right) eigenvalues of the Hamiltonian (n = 17077) corresponding to Si 10 H 16. Here, λ (denoted by +) are the exact eigenvalues of the Hamiltonian and λm, m = 80, 120 , 160 and 200 are the corresponding eigenvalues obtained from the tridiagonal matrix Tm constructed by the Lanczos procedure.
first constraint increases computational cost and some care must be exercised for the reorthogonalization process not to become too expensive. The second, raises the issue of memory costs. Storing the Lanczos basis Qm will require a large memory size, and may even force one to resort to secondary storage. Note that reorthogonalization will ultimately require all basis vectors to be fetched in main memory and that the cost of orthogonalizing the vector qk against all previous ones will incur a cost of O(kn), which yields a quadratic total cost of O(m^2 n) when summed over m steps. This cost will eventually overwhelm any other computation done and it is the main reason why so many attempts have been made in the past to avoid or reduce the orthogonalization penalty in electronic structures codes, see, e.g., [7, 13, 19, 20]. Note also that there is an additional severe penalty due to memory traffic as the size of the system increases, because modern processors work at a much faster rate than memory subsystems. It was argued in [4] that memory requirements do not necessarily pose a significant problem for the matrix sizes encountered and the machines typically in use for large calculations. For example, storing 2, vectors of length 1 million, “only” requires 16 GB of memory, which is certainly within reach of most high-performance computers 2. However, for larger calculations this could be a burden and out-of-core algorithms can help. The above discussions strongly suggests that when computing large invariant subspaces, it is essential to use a Lanczos basis that is as small as possible. In order to achieve this, we apply the Lanczos process not on the original matrix A but rather on a matrix ρl(A), where ρl(t) is a polynomial of small degree designed to be close to zero for large eigenvalues and close to one for the eigenvalues of interest. Of course, polynomial acceleration in Krylov techniques is not a new idea (see for example [28] and references therein). Typically, the goal is to restart Lanczos after a fixed number of iterations with a starting vector from which unwanted eigendirections have been filtered out. In this paper we follow a slightly different approach. We do not employ any restarts, but rather filter each matrix-vector product in the Lanczos process using a small number of Conjugate-Residual type iterations on matrix A. As can be expected, (^2) In modern high-performance computers this will typically be available in a single node
(^100 20 40 60 80 100 120 140 160 180 ) −
10 −
10 −
10 −
10 −
10 −
10 −
100
Lanczos steps
level of orthogonality
(^100 20 40 60 80 100 120 140 160 180 ) −
10 −
10 −
Lanczos steps
level of orthogonality
Figure 4: Levels of orthogonality of the Lanczos basis for the Hamiltonian (n = 17077) corresponding to Si 10 H 16. Left: Lanczos without reorthogonalization. Right: Lanczos with partial reorthogonalization. The number of reorthogonalizations was 34 with an additional 3400 inner vector products.
since ρl(t) is small for t > λno , ρl(A) will not amplify any components associated with λj , j > no. In fact, ρl(A) will act as if there are no components at all in the undesired subspace. This is, in a nutshell, the heart of the proposed algorithm. Essentially, our goal is to trade a long Lanczos basis and the associated expensive reorthogonalization steps with additional matrix-vector products induced by the application of ρl(A) at every step of Lanczos. Given the high cost of orthogonalizing large bases, it is not difficult to imagine why this approach can be economical. If A has μn nonzero entries and if ρl is of small degree, say 8, then each matrix-vector product with B = ρl(A) will cost about O(8μn) floating point operations. In contrast, an orthogonaliza- tion step costs O(2in) operations at step i. If i is 1,000, and μ = 10, we have a cost of 2, 000 n versus about 80 n for the new approach. Though this may be compelling enough in the case of full reorthogonalization, the situation is more complex to analyze when a form of partial reorthogonalization is used. However, experiments (see Section 5) show that the procedure is superior to the straightforward use of the Lanczos procedure with partial reorthogonalization: it saves not only memory but arithmetic as well.
As is well-known, the standard Lanczos process is “unstable” in the sense that the column vectors of Qm will suddenly start loosing their orthogonality [22]. As an illustration, consider again the Hamiltonian (n = 17, 077) corresponding to Si 10 H 16. We test the orthogonality of the bases Qi, i = 1,... , m, with m = 200 by computing the norm ‖Q> i Qi − Ii‖ 2 , where Ii is the identity matrix of size i. The left plot in Figure 4 illustrates the rapid deterioration of orthogonality among basis vectors. A number of existing reorthogonalization schemes are often employed to remedy the problem. The simplest of these consists of a full reorthogonalization approach, whereby the orthogonality of the basis vector qi is enforced against all previous vectors at each step i. This means that the vector qi, which in theory is already orthogonal against q 1 ,... , qi− 1 , is orthogonalized (a second time) against these vectors. In principle we no longer have a 3-term recurrence but this is not an issue as the corrections are small and usually ignored (see however Stewart [37]). The additional cost at the m-th step will be O(nm). So, if reorthogonalization is required at each step, then we require an additional cost of O(nm^2 ) which is consumed by the Gram-Schmidt process. In general, all basis vectors need to be available in main memory, making this approach impractical for bases of large dimension.
An alternative to full reorthogonalization is partial reorthogonalization which attempts to perform reorthogonalization steps only when they are deemed necessary. The goal is not so much to guarantee that the vectors are exactly orthogonal, but to ensure that they are at least nearly orthogonal. Typically, the loss of orthogonality is allowed to grow to roughly the square root of the machine precision, before a reorthogonalization is performed. A result by Simon ([33]) ensures that we can get fully accurate approximations to the Ritz values (eigenvalues of the tridiagonal matrix Tm) in spite of a reduced level of orthogonality among the Lanczos basis vectors. Furthermore, a key to the successful utilization of this result is the existence of clever recurrences which allow us to estimate the level of orthogonality among the basis vectors [15, 34]. It must be stressed that the cost of updating the recurrence is very modest. Let ωi,j = q i> qj denote the “loss of orthogonality” between any basis vectors qi and qj. Then, the following is the so called ω-recurrence [34]:
βiωi+1,j = (αj − αi)ωi,j + βj− 1 ωi,j− 1 − βi− 1 ωi− 1 ,j , (7)
where the scalars αi and βi, i = 1,.. ., are identical to the ones computed by the Lanczos algorithm (see Fig. 1). Thus, we can cheaply and efficiently probe the level of orthogonality of the current vector (say qi) and determine whether a reorthogonalization step against previous basis vectors is required. The left plot in Figure 4 illustrates the corresponding level of orthogonality when partial reorthogonalization is applied. Observe that only 34 reorthogonalization steps are required, compared to 200 that would have been required if full reorthogonalization was employed. It was shown in [4] that partially reorthogonalized Lanczos combined with techniques that avoid explicit computation of eigenvectors can lead to significant savings in computing charge densities for electronic structure calculations. Partial reorthogonalization will play a key role in the algorithm to be described in the next section.
Classical convergence theory for Lanczos (see [11], [27]) predicts that if θ(ψi, q 1 ) is the acute angle between the starting vector q 1 and the eigenvector ψi associated with i-th eigenvalue λi, then
tan θ(ψi, Km) ≤ Ki Tm−i(γi)
tan θ(ψi, q 1 ), (8)
where
θ(ψi, Km) = arcsin
‖(I − QmQ> m)ψi‖ ‖ψi‖
is the acute angle between the eigenvector ψi and the Krylov subspace Km and
γi = 1 + 2
λi − λi+ λi+1 − λn
Ki =
i∏− 1
i=
λj − λn λj − λi
, if i 6 = 1 and K 1 = 1. (10)
With Tk(t) we denote the Chebyshev polynomial of the first of kind of order k, Tk(t) = cos(k arccos(t)). This result suggests that in order for the Krylov subspace Km to converge to the wanted invariant subspace, the initial vector q 1 must be “rich” in eigendirections associated with the wanted eigenvalues λ 1 ,... , λno. The rate of convergence depends on the “gap” |λno − λno+1| and on the “spread” of the spectrum |λ 1 − λn|. Observe that in exact arithmetic, if the starting vector q 1 is orthogonal to an eigenvector ψj , then the Krylov subspace Km will never have any components in ψj , regardless of the number of steps m. Restarting techniques utilize this property to speed up the computation of the desired invariant subspace. The goal is to progressively construct a starting vector q( 1 k ), which at each restart k will have larger
0 1 2 3 4 5 6 7 8 10 −
10 −
10 −
10 −
100
λ j
abs val. of eigenvector coefficient
m=
0 1 2 3 4 5 6 7 8 10 −
10 −
10 −
10 −
100
λ j
abs val. of eigenvector coefficient
m=
Figure 5: Coefficients of the last basis vector qm of the Lanczos procedure (no partial reorthogonaliza- tion was required) for the discretization of the Laplacean, when the starting vector does not have any components in undesired eigenvectors. Left: one step. Right: m = 13 steps.
Before we state the result with detail, we must recall that in inexact arithmetic, the Lanczos relation (4) is replaced by a relation of the form:
Aqi = βi+1qi+1 + αiqi + βiqi− 1 − zi. (14)
where zi is an error vector which, in general, remains small.
Lemma 2.1 Consider any eigenvalue λ > λno and let ψ be its associated eigenvector and δ ≡ ρ(λ). Assume that the sequence {qi} satisfies the model (14) and define ²ψi =< ψ, zi >. Then the scalar sequence σi =< qi, ψ > satisfies the recurrence,
βi+1σi+1 + (αi − δ)σi + βiσi = ²ψi (15)
and, assuming βm+1e> 1 (Tm − δI)−^1 em 6 = 0 then the component σm+1 of qm+1 along ψ, can be expressed as
σm+1 =
ε> m(Tm − δI)−^1 e 1 − σ 1 βm+1e> m(Tm − δI)−^1 e 1
in which εm = [²ψ 1 , ²ψ 2 , · · · , ²ψm]>^ and Tm is the tridiagonal matrix (5).
Proof. We begin with the relation
Bqi = βi+1qi+1 + αiqi + βiqi− 1 − zi.
Taking the inner product with ψ yields
< Bqi, ψ >= βi+1 < qi+1, ψ > +αi < qi, ψ > +βi < qi− 1 , ψ > −²ψi.
Since Bψ = δψ, this readily yields the expression (15).
Define the vector sm = [σ 1 , σ 2 , · · · , σm]>. We can rewrite the relations (15) for i = 1,... , m in matrix form as (Tm − δI)sm = εm − βm+1σm+1em
which yields the relation, sm = (Tm − δI)−^1 εm − βm+1σm+1(Tm − δI)−^1 em. Now, we add the condition that σ 1 is known:
σ 1 = e> 1 sm = e> 1 (Tm − δI)−^1 εm − βm+1σm+1e> 1 (Tm − δI)−^1 em,
from which we obtain the desired expression (16).
The main point of the above lemma is that it explicitly provides the amplification factor for the coefficient in the direction ψ, in terms of computed quantities. This factor is the denominator of the expression (16). Note that in exact arithmetic, the vector εm is zero and the initial error of σ 1 in the direction of ψ is divided by the factor βm+1e> 1 (Tm −δI)−^1 em. We can obtain a slightly simpler expression by “folding” the term σ 1 into the vector εm. This is helpful if σ 1 is of the same order as the ²ψi s as it simplifies the expression. Set εˆm = εm − σ 1 (Tm − δI)e 1.
Note that only ²ψ 1 and ²ψ 2 are modified into ˆ²ψ 1 = ²ψ 1 − (α 1 − δ)σ 1 and ˆ²ψ 2 = ²ψ 2 − β 2 σ 1 , while the other
terms remain unchanged, i.e., ˆ²ψi = ²ψi for i > 2. Then, (16) becomes,
σm+1 = ˆε> m(Tm − δI)−^1 e 1 βm+1e> m(Tm − δI)−^1 e 1
Let us consider the unfavorable scenario first. When B ≡ A then Tm is simply the tridiagonal matrix obtained from the Lanczos algorithm and δ is an eigenvalue of A. Assume that λ = λn, the largest (unwanted) eigenvalue. Even if q 1 has very small components in the direction of λ, convergence will eventually take place, see (13), and Tm will tend to have an eigenvalue close to λ, so (Tm −δI)−^1 e 1 ≡ ym is close to an eigenvector of Tm associated with its largest eigenvalue. As is well known, the last components of (converged) eigenvectors of Tm will tend to be much smaller than the first ones. Therefore, if ˆεm is a small random vector, then σm will become larger and larger because the numerator will converge to a certain quantity while the denominator will converge to zero. The use of an inner polynomial ρ(t) prevents this from happening early by ensuring that convergence towards unwanted eigenvalues does not take place. In this situation δ is an eigenvalue of B among many others that are clustered around zero, so convergence is considerably slower toward the corresponding eigenvector. By the time convergence takes place, the desirable subspace will have already been computed.
Partial reorthogonalization can significantly extend the applicability of Lanczos in electronic structure calculations (see [4]), but there are computational issues related to the use of very long Lanczos bases when a large invariant subspace is sought. These issues can be addressed by employing polynomial filtering in the Lanczos procedure. In exact arithmetic, the ideal solution to this problem is to use an initial vector which is filtered so that it has no eigencomponents associated with λi, i > no. However, we saw earlier that in the course of the Lanczos procedure, components along the largest eigenvectors will quickly return. We discussed the reasons for this behavior and suggested a simple remedy which consists of replacing the matrix-vector product Aqi of the Lanczos algorithm (see line 3, Fig. 1) by ρl(A)qi, where ρl(t) is a low degree polynomial filter that approximates the Heaviside function (see Fig. 6). The interval [γ, β] contains all the unwanted (largest) eigenvalues, which are approximately mapped by ρl(t) to zero. All that is required to implement the proposed filtered Lanczos scheme is to substitute the matrix- vector product Aqi with a function P(A, qi, d) which evaluates the product of the matrix polynomial
In order to compute a basis for an invariant subspace Sno for the no algebraically smallest eigenvalues of matrix A, we assume that we are given an interval (γ, β], which contains all the unwanted eigenvalues λj > λno. Assuming that matrix A does not have any negative eigenvalues, it suffices to consider only the left endpoint γ of the interval. In electronic structure calculations, the problem is often a variation of this one, in that we wish to compute an invariant subspace associated with the no smallest eigenvalues. However, there is an outer loop and previous information can be used to obtain a good interval on which to restrict the search. There are also instances where the number of eigenvalues no is unknown, but rather we are given an upper bound γ for the eigenvalues that need to be considered.
Starting vector. It is important that the starting vector q 1 be free of components in the undesired eigenvectors. To this end we apply a high degree polynomial filter ρh on a random vector ˜q, such that q 1 = ρh(A)˜q. The degree of this first polynomial can be quite high (say dh = 200 or so) to get a good elimination of the undesired components.
Bounding interval. If we are not given an interval [α, β] that tightly contains the eigenvalues, then we employ a number of unrestarted Lanczos iterations in order to obtain approximations for the bounds α and β. In practice, the number of these iterations is kept low. Let r 1 and rn be the residual vectors for the approximate extremal eigenvalues λ˜ 1 and λ˜n of matrix A after a number of Lanczos iterations. Then, we use the practical bounds ˜α = λ˜ 1 − ‖r 1 ‖ and β˜ = ˜λn + ‖rn‖. If, ˜α (or α) is negative, then we shift the Hamiltonian so as to ensure that all its eigenvalues are positive.
Inner polynomial transformation. The main Lanczos iteration will be performed with a filter poly- nomial of A, i.e., the Lanczos algorithm is run with B = ρl(A). The degree dl of ρl is much smaller than that of ρh, in order to reduce the overall cost. Typically dl ≡ 8.
Convergence criterion. Equally important in order to restrain the computational cost is the conver- gence test. Let (λ˜i, x˜i) be an approximate eigenpair, where
xi = Qmyi
and (˜λi, y) is an eigenpair of the dense matrix (19). Then, it is natural to monitor the norm of the remainder ri = Ax˜i − λ˜i x˜i. It is well-known (see, e.g., [24]) that
‖ri‖ = ‖Ax˜i − ˜λi ˜xi‖ = |βm+1| |ymi |,
where ymi is the last element of the eigenvector yi. Monitoring the norm ‖ri‖ for all no eigenvalues of interest, at each step of the (filtered) Lanczos procedure entails computing the eigenvectors yi every time a test is required. This, however, is expensive, since computing all eigenpairs of a dense k × k matrix will be cubic in k, and this is to be summed for a total of m Lanczos steps. We have chosen a significantly cheaper alternative. We monitor the sum of the eigenvalues of matrix T˜i, that are smaller than the upper bound γ, si = ∑˜ λi<γ λ˜i. When si converges we stop the iteration. In order to further restrict the cost we conduct the convergence test at fixed intervals and not at every step of the Filtered Lanczos iteration. If convergence is achieved after m steps, then the cost of the test will be O(m^2 ).
Computation of the projection matrix T˜m. Observe that
T˜i = Q> i+1A Qi+1 = [ Qi qi+1 ]>A[ Qi qi+1 ] =
Q> i AQi Q> i Aqi+ q i>+1AQi q> i+1Aqi+
Thus, matrix T˜m can be computed incrementally during the course of the algorithm. Obviously, if T˜m is updated at every step i, then no additional memory is required. However, a more efficient BLAS 3
Filtered Lanczos
(Input) Matrix A ∈ Rn×n, starting vector q 1 , ‖q 1 ‖ 2 = 1, scalar m, polynomial filter function F(A, q, d) that approximates the step function, low and high polynomial degrees dl, dh, stride strd, upper bound γ
(Output) Eigenvalues of A smaller than γ and orthogonal basis Q = [q 1 , q 2 ,.. .] for the invariant subspace associated with these eigenvalues
˜λi<γ ˜λi
Figure 7: The Filtered Lanczos algorithm. The inner product for vectors is denoted by < .,. >.
implementation is possible if we postpone the update of T˜m and rather perform it at fixed intervals (which can be made to coincide with the intervals at which convergence it checked). This will come at the expense of a few additional vectors in memory. In particular, we will have to store the vectors Aqi+ for a number of consecutive steps. Figure 7 shows a high level algorithmic description of the Filtered Lanczos iteration.
This section focuses on the problem of defining the polynomial filter and applying it. Details on the algorithms described here can be found in [30]. We begin with a brief summary of filtering techniques when solving linear systems of equation by “regularization” [21]. In regularized solution methods, one seeks to find an approximate solution to the linear system Ax = b by inverting A only in the space associated with the largest eigenvalues, leaving the other part untouched. As was explained in [30], computing a filtered solution amounts to computing a vector s(A)b whose residual vector ρ(A)b = b − As(A)b is a certain filter polynomial, typically one that is computed to be close to one for small eigenvalues and close to zero for larger eigenvalues. In other words, it would resemble the desired filter polynomial, such as the one shown in Figure 3. The approximate solutions produced by Krylov subspace methods for solving a linear system Ax = b, are of the form sj (A)r 0 where sj is a polynomial of degree ≤ j. The corresponding residual vector
The standard way of computing the best polynomial is to generate an orthogonal sequence of polynomials and expand the least-squares solution in it. This approach was taken in [8] and more recently in [12]. The formulation of the solution given next is based on the following observation. The polynomials associated with the residual vectors of the (standard) CR algorithm, are such that {λπj } is an orthogonal sequence of polynomials and so it can be used as an intermediate sequence in which to express the solution. We can generate the residual polynomial which will help obtain the pi’s: the one that would be obtained from the actual CR algorithm, i.e., the same r vectors as those of the generic CR algorithm (see Fig. 8). It is interesting to note that with this sequence of residual vectors, which will be denoted by ˜rj , it is easy to generate the directions pi which are the same for both algorithms. The idea becomes straightforward: obtain the auxiliary residual polynomials ˜ρj that are those associated with the standard CR algorithm and exploit them to obtain the πi’s in the same way as in the CR algorithm. The polynomials λπj are orthogonal and therefore the expression of the desired approximation is the same. The algorithm is described in Figure 9 where now ˜ρj is the polynomial associated with the auxiliary sequence ˜rj. The only difference with a generic Conjugate Residual-type algorithm (see, e.g. Figure 8) is that the updates to xj+1 use different coefficients αj from the updates to the vectors ˜rj+1. Observe that the residual vectors ˜rj obtained by the algorithm are just auxiliary vectors that do not correspond to the actual residuals rj = b − Axj. Needless to say, these actual residuals, the rj ’s, can also be generated after Line 5 (or 6) from rj+1 = rj − αj Apj. Depending on the application, it may or may not be necessary to include these computations. The solution vector xj+1 computed at the j-th step of the corrected CR algorithm is of the form xj+1 = x 0 + sj (A)r 0 , where sj is the j-th degree polynomial:
sj (λ) = α 0 π 0 (λ) + · · · + αj πj (λ). (22)
The polynomials πj and the auxiliary polynomials ˜ρj+1(λ) satisfy the orthogonality relations,
〈λπj (λ), λπi(λ)〉w = 〈λρ˜j (λ), ρ˜i(λ)〉w = 0 for i 6 = j. (23)
In addition, the filtered residual polynomial φ − λsj (λ) minimizes ‖φ − λs(λ)‖w among all polynomials s of degree ≤ j − 1. It is worth mentioning that there is an alternative formula for αj which is
αj = ˜αj − 〈 1 − φ, λπj 〉 〈λπj , λπj 〉
whose merit, relative to the expression used in Line 4 of the algorithm, is that it clearly establishes the new algorithm as a corrected version of the generic CR algorithm of Figure 8. In the special situation when φ ≡ 1, αi = ˜αi, and the two algorithms coincide as expected.
The solutions computed by the algorithms just seen consist of generating polynomial approximations to a certain base filter function φ. It is generally not a good idea to use as φ the step function because this function is discontinuous and approximations to it by high degree polynomials will exhibit very wide oscillations near the discontinuities. It is preferable to take as a “base” filter, i.e., the filter which is ultimately approximated by polynomials, a smooth function such as the one illustrated in Figure 10. The filter function in Figure 10 can be a piecewise polynomial consisting of two pieces: A function which increases from zero to one when λ increases smoothly from 0 to γ, and the constant function unity in the interval [γ, β]. Alternatively, the function can begin with the value zero in the interval [0, γ 1 ], then increase smoothly from 0 to one in a second interval [γ 1 , γ 2 ], and finally take the value one in [γ 2 , β]. This second part of the function (the first part for the first scenario) bridges the values one and one by a smooth function and was termed a “bridge function” in [8].
Filtered Conjugate Residual Polynomials Algorithm
Figure 9: The filtered Conjugate Residual polynomials algorithm
Figure 10: A typical filter function φ and its dual filter 1 − φ
A systematic way of generating base filter functions is to use bridge functions obtained from Hermite interpolation. The bridge function is an interpolating polynomial (in the Hermite sense) depending on two integer parameters m 0 , m 1 , and denoted by Θ[m 0 ,m 1 ] which satisfies the following conditions:
Θm 0 ,m 1 = 0; Θ′ m 0 ,m 1 = · · · = Θ(mm^00 ,m) 1 = 0 Θm 0 ,m 1 = 1; Θ′ m 0 ,m 1 = · · · = Θ(mm^10 ,m) 1 = 0
Thus, Θ[m 0 ,m 1 ] has degree m 0 +m 1 +1 and m 0 , m 1 define the degree of smoothness at the points 0 and α respectively. The ratio m m^10 determines the localization of the inflexion point. Making the polynomial increase rapidly from 0 to 1 in a small interval, can be achieved by taking high degree polynomials but this has the effect of slowing down convergence toward the desired filter as it has the effect of causing undesired oscillations. Two examples are shown in Figures 11 and 12. Once the base filter is selected, the filtered CR algorithm can be executed. There remains however to define the inner products. Details on the weight functions and the actual techniques for computing inner products of polynomials can be found in [30]. We only mention that it is possible to avoid numerical integration by defining the inner products by using classical weights (e.g., Chebyshev) in each sub-interval of the whole interval where the base filter is defined. Since the base filter is a standard polynomial in each of these sub-intervals, inner products in these intervals can be evaluated without numerical integration. This, in effect, is equivalent to using Gaussian quadrature in each of these sub-intervals.
−0.2 0 1 2 3 4 5 6 7 8
0
1
x
y
Base filter; Intervals : [0 2 ] ; [2 8 ] ; deg = 11
−0.2 0 1 2 3 4 5 6 7 8
0
1
x
y
Polynomial filter; Intervals : [0 2 ] ; [2 8 ] ; deg = 15
Figure 12: The base filter Θ[10,2] in [0, 2] and one in [2, 8] and its polynomial approximation of degree
matrix size n nnz nnz/n Si 10 H 16 17077 875923 51. Ge 99 H 100 94341 6332795 67. Ge 87 H 76 94341 5963003 63. Si 34 H 36 97569 5156379 52. Andrews 60000 760154 12.
Table 1: Characteristics of test matrices: nnz is the total number of nonzeros, so the last column shows the average number of nonzeros per row.
cost. This was previously shown in [4], however at the important expense of additional memory, relative to implicitly restarted techniques. In this paper we show that the Filtered Lanczos iteration can achieve both goals: it can operate on limited memory while significantly reducing the overall computational cost.
Test matrices. We have used four matrices from electronic structure calculations for the tests. These are Hamiltonians obtained from a real space code [5]. In addition, we have also used a test matrix, namely the Andrews matrix, from the University of Florida sparse matrix collection^3. Table 1 provides the char- acteristics of the test matrices. For the Hamiltonians the number of the requested eigenvalues generally correspond to physical properties of the corresponding molecular system. For example, Si 10 H 16 has 28 occupied states, while Si 34 H 36 has 86, Ge 87 H 76 has 212 and Ge 99 H 100 has 248. In order to test the scala- bility of the methods under study we requested additional eigenvalues as well. For the matrix Andrews we arbitrarily requested 100-400 eigenvalues. We point out that all statistics for the Filtered Lanczos algorithm include an initial call to the unrestarted Lanczos algorithm, with partial reorthogonalization, in order to approximate (upper and lower) bounds for the extremal eigenvalues.
Discussion. The experimental results clearly illustrate that the Filtered Lanczos algorithm achieves significant improvements over the other two competing methods. The performance improvement becomes more evident as the number of requested eigenvalues increases. (^3) http://www.cise.ufl.edu/research/sparse/
All of our test matrices are sparse. However, the degree of sparsity (as measured by the average number of nonzeros per row shown in the last column of Table 1) differs significantly between the “denser” Ge 99 H 100 Hamiltonian and the “sparser” Andrews matrix. A careful look in the results illustrated in Table 2 clearly suggests that the improvements in run-times of the Filtered Lanczos algorithm over ARPACK is more pronounced for the sparser test matrices. Thus, although the number of matrix-vector products in the Filtered Lanczos algorithm increases relative to ARPACK, a significant gain results from avoiding to update a large number of eigenvectors, which standard methods do at every step. In comparison with the unrestarted partially reorthogonalized Lanczos procedure observe that the Filtered Lanczos method always requires far less memory. In fact, the amount of additional memory in comparison to ARPACK is quite modest. Typically, the new method will require a Lanczos basis with length close to three times the number of computed eigenvalues. We also observe that for rather dense matrices and small number of eigenvalues (i.e. Si 34 H 36 and Si 10 H 16 ) the unrestarted Lanczos method with partial reorthogonalization is the fastest of the three methods. However, when a large invariant subspace is sought, then the unrestarted Lanczos method will tend to require a long basis, ultimately causing even infrequent reorthogonalizations to dominate the cost.
This paper presented a Filtered Lanczos iteration method (FLAN) for computing large invariant subspaces associated with the algebraically smallest eigenvalues of very large and sparse matrices. In contrast to restarted techniques (e.g. ARPACK) which repeatedly update a fixed number of basis vectors, FLAN is allowed to augment the search subspace until all eigenvalues smaller than a predetermined upper bound have converged. The loss of orthogonality of the Lanczos basis vectors is treated by a partial reorhtogo- nalization scheme [33]. One technique which FLAN and explicit/implicit restarted Krylov subspace algo- rithms have in common is the use of filtering polynomials, designed to dampen eigencomponents along “unwanted” parts of the spectrum. However, while restarted techniques apply these polynomials period- ically (i.e. at each restart), the FLAN procedure applies a fixed, pre-computed, low-degree polynomial of A to the working Lanczos vector, which amounts to a polynomial preconditioning technique applied to A. We showed that if the unwanted eigendirections are thoroughly filtered from the starting vector of the Lanczos algorithm, then the application of the aforementioned small degree polynomial successfully prevents the unwanted directions from reappearing into the iteration, thus significantly expediting con- vergence towards the desired invariant subspace. Earlier work (see, e.g., [30]) showed how one can design a Conjugate Residual type iteration that efficiently applies a low pass filter in order to solve regularized linear systems. The low degree polynomial which is involved in this procedure is used in FLAN. Experimental evidence clearly shows that FLAN achieves significant performance improvements over the most sophisticated restarted technique (i.e. ARPACK) while at the same time incurring very mod- est additional memory requirements. These gains in efficiency are obtained by essentially trading the repeated and costly updates of the working eigenbasis which is inherit in restarted techniques for addi- tional matrix-vector products. Thus, the method will work quite well whenever matrix-vector products are not expensive. Finally, we should point out that the filtering methods described here can be easily extended to the cases where the desired spectrum corresponds to the algebraically largest eigenvalues, and perhaps more importantly, to all eigenvalues in a given interval well inside the spectrum. This will be the subject of the forthcoming report [3].
Acknowledgments This work would not have been possible without the availability of excellent source codes for diagonalization. Specifically, our experiments made use of the PLAN code developed by Wu and Simon [39] and the ARPACK code of Lehoucq, Sorensen, and Yang [16].