- Lanczos algorithm
The

**Lanczos algorithm**is an iterative algorithm invented byCornelius Lanczos that is an adaptation of power methods to findeigenvalue s andeigenvector s of asquare matrix or thesingular value decomposition of a rectangular matrix. It is particularly useful for finding decompositions of very large sparse matrices. InLatent Semantic Indexing , for instance, matrices relating millions of documents to hundreds of thousands of terms must be reduced to singular value form.Peter Montgomery published in 1995 an algorithm, based on the Lanczos algorithm, for finding elements of the nullspace of a large sparse matrix over

GF(2) ; since the set of people interested in large sparse matrices over finite fields and the set of people interested in large eigenvalue problems scarcely overlap, this is often also called the "block Lanczos algorithm" without causing unreasonable confusion. SeeBlock Lanczos algorithm for nullspace of a matrix over a finite field .**Power method for finding eigenvalues**The power method for finding the largest eigenvalue of a matrix $A,$ can be summarized by noting that if $x\_0,$ is a random vector and $x\_\{n+1\}\; =\; A\; x\_n,$, then in the large $n$ limit, $x\_n/||x\_n||$ approaches the eigenvector corresponding to the largest eigenvalue.

If $A\; =\; U\; operatorname\{diag\}(sigma\_i)\; U\text{'}\; ,$ is the eigenvalue decomposition of $A,$, then $A^n\; =\; U\; operatorname\{diag\}(sigma\_i^n)\; U\text{'}$. As $n,$ gets very large, the diagonal matrix of eigenvalues will be dominated by whichever eigenvalue is largest (neglecting the case where there are large equal eigenvalues, of course). As this happens, $|x\_\{n+1\}|\; /\; |x\_\{n\}|,$ will converge to the largest eigenvalue and $x\_n\; /\; |x\_n|,$ to the associated eigenvector. If the largest eigenvalue is multiple, then $x\_n\; ,$ will converge to a vector in the subspace spanned by the eigenvectors associated with those largest eigenvalues. After you get the first eigenvector/value, you can successively restrict the algorithm to the null space of the known eigenvectors to get the other eigenvector/values.

In practice, this simple algorithm does not work very well for computing very many of the eigenvectors because any

round-off error will tend to introduce slight components of the more significant eigenvectors back into the computation, degrading the accuracy of the computation. Pure power methods also can converge slowly, even for the first eigenvector.**Lanczos method**During the procedure of applying the power method, while getting the ultimate eigenvector $A^\{n-1\}\; v$, we also got a series of vectors $A^j\; v,\; ,\; j=0,1,cdots,n-2$ which were eventually discarded. That is clearly a huge waste. Some advanced algorithms, such as

Arnoldi's algorithm and theLanczos algorithm save this information and use theGram–Schmidt process orHouseholder algorithm to reorthogonalize them into a basis spanning theKrylov subspace corresponding to the matrix $A$.**The algorithm**The Lanczos algorithm can be viewed as a simplified

Arnoldi's algorithm in that it applies to Hermitian matrices. It transforms the original matrix into atridiagonal matrix which is real and symmetric.**Definitions**We hope to calculate the tridiagonal and symmetric matrix $H\_\{mm\}\; =\; V\_m^*\; A\; V\_m.$

The diagonal elements are denoted by $alpha\_j\; =\; h\_\{jj\}$, and the off-diagonal elements are denoted by $eta\_j\; =\; h\_\{j-1,j\}$.

Note that $h\_\{j-1,j\}\; =\; h\_\{j,j-1\}$, due to its symmetry.

**Iteration**(Note: Following these steps alone will

**not**give you the correct eigenvalue and eigenvectors. More consideration must be applied to correct for the numerical errors. See the section Numerical stability in the following.)There are in principle four ways to write the iteration procedure. Paige [1972] and other works show that the following procedure is the most numerically stable. [

*Cullum and Willoughby, "Lanczos Algorithms for Large Symmetric Eigenvalue Computations", Vol. 1, ISBN 0-8176-3058-9(v.1)*] [*Yousef Saad, "Numerical Methods for Large Eigenvalue Problems", ISBN 0-470-21820-7, http://www-users.cs.umn.edu/~saad/books.html*]$v\_1\; leftarrow$ random vector with norm 1. $v\_0\; leftarrow\; 0$ $eta\_1\; leftarrow\; 0$

**Iteration**: for $j\; =\; 1,2,cdots,m$ $w\_j\; leftarrow\; A\; v\_j\; -\; eta\_j\; v\_\{j-1\}$ $alpha\_j\; leftarrow\; (w\_j,\; v\_j)$ $w\_j\; leftarrow\; w\_j\; -\; alpha\_j\; v\_j$ $eta\_\{j+1\}\; leftarrow\; left|\; w\_j\; ight|$ $v\_\{j+1\}\; leftarrow\; w\_j\; /\; eta\_\{j+1\}$**return**Note that (x,y) represents the dot product of vectors x and y here.

After the iteration, we get the $alpha\_j$ and $eta\_j$ which constructs a tridiagonal matrix

$T\_\{mm\}\; =\; left(\; egin\{array\}\{ccccccc\}alpha\_1\; eta\_2\; 0\; 0\; cdots\; 0\; 0\; \backslash eta\_2\; alpha\_2\; eta\_3\; 0\; cdots\; 0\; 0\; \backslash 0\; eta\_3\; alpha\_3\; eta\_4\; cdots\; 0\; 0\; \backslash vdots\; vdots\; vdots\; vdots\; vdots\; vdots\; vdots\; \backslash 0\; 0\; 0\; 0\; cdots\; alpha\_\{m-1\}\; eta\_m\; \backslash 0\; 0\; 0\; 0\; cdots\; eta\_m\; alpha\_m\; \backslash end\{array\}\; ight)$

The vectors $v\_j$ (

**Lanczos vectors**) generated on the fly constructs the transformation matrix$V\_m\; =\; left(\; v\_1,\; v\_2,\; cdots,\; v\_m\; ight)$,

which is useful for calculating the eigenvectors (see below). In practice, it could be saved after generation (but takes a lot of memory), or could be regenerated when needed, as long as one keeps the first vector $v\_1$.

**olve for eigenvalue and eigenvectors**After the matrix $T\_\{mm\}$ is calculated, one can solve its eigenvalues $lambda\_i^\{(m)\}$ and their corresponding eigenvectors $u\_i^\{(m)\}$. This process is pretty simple due to the nature of $T$ being a

tridiagonal matrix .It can be proved that the eigenvalues are approximate eigenvalues of the original matrix $A$.

The Ritz eigenvectors $y\_i$ of $A$ can be calculated by $y\_i\; =\; V\_m\; u\_i^\{(m)\}$, where $V\_m$ is the transformation matrix whose column vectors are $v\_1,\; v\_2,\; cdots,\; v\_m$.

**Numerical stability**Stability means how much the algorithm will be affected (i.e. will it produce the approximate result close to the original one) if there are small numerical errors introduced and accumulated. Numerical stability is the central criterion for judging the usefulness of implementing an algorithm on a computer with roundoff.

For the Lanczos algorithm, it can be proved that with "exact arithmetic", the set of vectors $v\_1,\; v\_2,\; cdots,\; v\_\{m+1\}$ constructs an "orthogonal" basis, and the eigenvalues/vectors solved are good approximations to those of the original matrix. However, in practice (as we code it on to digital computers where round-off errors are inevitable), the orthogonality is quickly lost and in some cases the new vector could even be linearly dependent on the set that is already constructed. As a result, some of the eigenvalues of the resultant tridiagonal matrix may not be approximations to the original matrix. Therefore, the Lanczos algorithm is not very stable.

Users of this algorithm must be able to find and remove those "spurious" eigenvalues. Practical implementations of the Lanczos algorithm go in three directions to fight this stability issue:

# Prevent the loss of orthogonality

# Recover the orthogonality after the basis is generated

# After the good and "spurious" eigenvalues are all identified, remove the spurious ones.**Variations**Variations on the Lanczos algorithm exist where the vectors involved are tall, narrow matrices instead of vectors and the normalizing constants are small square matrices. These are called "block" Lanczos algorithms and can be much faster on computers with large numbers of registers and long memory fetch times.

Many implementations of the Lanczos algorithm restart after a certain number of iterations. One of the most influential restarted variations is the implicitly restarted Lanczos method [

*cite web |author=D. Calvetti, L. Reichel, and D.C. Sorensen |date=1994 |title=An Implicitly Restarted Lanczos Method for Large Symmetric Eigenvalue Problems |publisher=ETNA |url=http://etna.mcs.kent.edu/vol.2.1994/pp1-21.dir/pp1-21.ps*] , which is implemented in ARPACK [*cite web |author=R. B. Lehoucq, D. C. Sorensen, and C. Yang |date=1998 |title=ARPACK Users Guide: Solution of Large-Scale Eigenvalue Problems with Implicitly Restarted Arnoldi Methods |publisher=SIAM |url=http://www.ec-securehost.com/SIAM/SE06.html*] . This has led into a number of other restarted variations such as restarted Lanczos bidiagonalization [*cite web |author=E. Kokiopoulou and C. Bekas and E. Gallopoulos |date=2004 |title=Computing smallest singular triplets with implicitly restarted Lanczos bidiagonalization |publisher=Appl. Numer. Math. |url=http://dx.doi.org/10.1016/j.apnum.2003.11.011*] . Another successful restarted variation is the Thick-Restart Lanczos method [*cite web |author=Kesheng Wu and Horst Simon |date=2000 |title=Thick-Restart Lanczos Method for Large Symmetric Eigenvalue Problems |publisher=SIAM |url=http://dx.doi.org/10.1137/S0895479898334605*] , which has been implemented in a software package called TRLan [*cite web |author=Kesheng Wu and Horst Simon |date=2001 |title=TRLan software package |publisher= |url=http://crd.lbl.gov/~kewu/trlan.html*] .**Applications**Lanczos algorithms are very attractive because the multiplication by $A,$ is the only large scale linear operation. Since weighted-term text retrieval engines implement just this operation, the Lanczos algorithm can be applied efficiently to text documents (see

Latent Semantic Indexing ). Eigenvectors are also important for the analysis of other large scale text retrieval methods such as theHITS algorithm from IBM, or thePageRank algorithm used at one time by Google.**References****External links*** [

*http://books.google.com/books?vid=ISBN0801854148 Golub and van Loan give very good descriptions of the various forms of Lanczos algorithms in their book "Matrix Computations"*]

* [*http://ai.stanford.edu/~ang/papers/ijcai01-linkanalysis.pdf Andrew Ng et al., an analysis of PageRank*]

* [*http://www.farcaster.com/papers/crypto-solve/node3.html Lanczos and conjugate gradient methods*] B. A. LaMacchia and A. M. Odlyzko, Solving Large Sparse Linear Systems Over Finite Fields

*Wikimedia Foundation.
2010.*