NLA MT25, Lanczos decomposition and iteration


Flashcards

How is the Lanczos decomposition related to the Arnoldi decomposition?

The Lanczos decomposition is the Arnoldi decomposition for symmetric $A$.

@State (and @visualise) the Lanczos decomposition for symmetric $A \in \mathbb R^{n \times n}$. What three-term recurrence does this imply for the vectors $q _ {k}$?

When $A = A^\top$, the Arnoldi decomposition simplifies. The Lanczos decomposition produces $Q _ k = [q _ 1 \mid \cdots \mid q _ k] \in \mathbb R^{n \times k}$ with orthonormal columns spanning $\mathcal K _ k(A, b)$ and a tridiagonal matrix $T _ k \in \mathbb R^{k \times k}$, satisfying:

\[AQ _ k = Q _ k T _ k + t _ {k+1, k} q _ {k+1} e _ k^\top,\]

or equivalently with $Q _ {k+1} = [Q _ k \mid q _ {k+1}]$ and $\tilde T _ k \in \mathbb R^{(k+1) \times k}$:

\[AQ _ k = Q _ {k+1}\tilde T _ k\]

where $T _ k$ is symmetric tridiagonal

\[T _ k = \begin{bmatrix} t _ {1,1} & t _ {1,2} & & & \\ t _ {2,1} & t _ {2,2} & t _ {2,3} & & \\ & t _ {3,2} & \ddots & \ddots & \\ & & \ddots & \ddots & t _ {k-1,k} \\ & & & t _ {k,k-1} & t _ {k,k} \end{bmatrix}, \qquad \tilde T _ k = \begin{bmatrix} T _ k \\ t _ {k+1,k} e _ k^\top \end{bmatrix}.\]

Schematically,

\[\underbrace{\Big[\;A\;\Big]} _ {n \times n} \underbrace{\Big[\;Q _ k\;\Big]} _ {n \times k} \;=\; \underbrace{\Big[\;Q _ {k+1}\;\Big]} _ {n \times (k+1)} \underbrace{\Big[\;\tilde T _ k\;\Big]} _ {(k+1) \times k}.\]

Three-term recurrence. Reading off the $k$th column of $AQ _ k = Q _ {k+1}\tilde T _ k$ — whose only nonzero entries are $t _ {k-1,k}, t _ {k,k}, t _ {k+1,k}$ —

\[A q _ k = t _ {k-1,k}\, q _ {k-1} + t _ {k,k}\, q _ k + t _ {k+1,k}\, q _ {k+1},\]

with $t _ {k-1,k} = t _ {k,k-1}$ by symmetry of $T _ k$. Writing $\alpha _ k = t _ {k,k} = q _ k^\top A q _ k$ for the diagonal and $\beta _ k = t _ {k+1,k} = t _ {k,k+1}$ for the off-diagonal, this rearranges into the Lanczos iteration

\[\beta _ k\, q _ {k+1} = A q _ k - \alpha _ k q _ k - \beta _ {k-1} q _ {k-1},\]

i.e. each new basis vector comes from only the previous two. That is the payoff of symmetry: Lanczos needs $O(1)$ stored vectors and $O(n)$ work per step (one matvec + two axpys, $\alpha _ k$ from an inner product, $\beta _ k$ from a norm), versus Arnoldi’s full Gram–Schmidt against all previous $q _ j$ ($O(nk)$ work and storage at step $k$).

@Describe the Lanczos iteration. Suppose

  • $A \in \mathbb R^{n \times n}$ symmetric
  • $b \in \mathbb R^n$

State the @algorithm, the meaning of each step, the outputs, and the time and space cost.

Algorithm:

  • Set $q _ 1 = b / \|b\| _ 2$.
  • For $k = 1, 2, \ldots, r-1$:
    • Set $v = Aq _ k$ (apply $A$ to the latest basis vector)
    • $t _ {k, k} = q _ k^\top v$ (the new $q _ k$-component of $Aq _ k$)
    • $v = v - t _ {k, k} q _ k - t _ {k-1, k} q _ {k-1}$ (when $k = 1$, omit the last term. Here we orthogonalise against only the last two basis vectors, since orthogonality against the others is guaranteed, ∆lanczos-three-term-recurrence).
    • $t _ {k+1, k} = \|v\| _ 2$ (off-diagonal entry, equals $t _ {k, k+1}$ by symmetry of $T _ r$)
    • If $t _ {k+1, k} = 0$, this is a ∆happy-breakdown and the Krylov subspace is $A$-invariant, and we should stop. Otherwise,
    • $q _ {k+1} = v/t _ {k+1, k}$.

Outputs, after $r$ steps:

  • $Q _ r = [q _ 1 \mid \cdots \mid q _ r] \in \mathbb R^{n \times r}$, orthonormal columns spanning $\mathcal K _ r(A, b) = \text{span}(b, Ab, \ldots, A^{r-1} b)$.
  • $T _ r \in \mathbb R^{r \times r}$ symmetric tridiagonal. Its diagonal entries are $t _ {k,k}$ and off-diagonal entries are $t _ {k, k-1} = t _ {k-1, k}$ computed above.

Time:

  • $r$ matrix-vector products with $A$: $O(rn^2)$
  • $O(r)$ inner products of length $n$ for the orthogonalisation
  • Total: $O(nr)$, vs the ∆arnoldi-iteration's $O(nr^2)$.

Memory:

  • $O(n)$ to store $q _ {k-1}$ and $q _ k$.
  • However, downstream methods based on Lanczos may require all of $Q _ k$, and the iteration is known to suffer from ∆lanczos-loss-of-orthogonality in practice, and so we may need to occasionally re-orthogonalise against the whole $Q _ k$.
  • (Compare to ∆arnoldi-iteration, which requires $O(nk)$ to store the full $Q _ k$)

The ∆lanczos-decomposition states that for symmetric $A$, the ∆arnoldi-decomposition simplifies to

\[AQ _ k = Q _ {k+1} \tilde T _ k = Q _ k T _ k + t _ {k+1,k} q _ {k+1} e _ k^\top\]

with $T _ k$ symmetric tridiagonal.

@State the three-term recurrences this implies for the vectors $q _ k$, and explain why $q _ {k+1}$ depends only on $q _ k$ and $q _ {k-1}$, and explain why this is helpful.

Reading off the $k$th column of $AQ _ k = Q _ k T _ k + t _ {k+1, k} q _ {k+1} e _ k^\top$:

\[Aq _ k = t _ {k-1, k} q _ {k-1} + t _ {k,k} q _ k + t _ {k+1, k} q _ {k+1},\]

which rearranges to the three-term recurrence

\[t _ {k+1, k} q _ {k+1} = (A - t _ {k,k} I)q _ k - t _ {k-1, k}q _ {k-1}.\]

This is helpful because computing $q _ {k+1}$ only requires orthogonalising against $q _ k$ and $q _ {k-1}$, which reduces to $O(n)$ per step rather than $O(nk)$.

@Prove that the Arnoldi decomposition for symmetric $A \in \mathbb R^{m \times n}$ simplifies to

\[AQ _ k = Q _ k T _ k + t _ {k+1, k} q _ {k+1} e _ k^\top\]

where $T _ k$ is symmetric tridiagonal.

Setup: From the Arnoldi iteration applied to $A$ and $b$, the basis matrix $Q _ k = [q _ 1 \mid \cdots \mid q _ k]$ has orthonormal columns, and $H _ k := Q _ k^\top A Q _ k$ is, by construction, upper Hessenberg, since its entries $h _ {j,i} = q _ j^\top A q _ i$ vanish whenever $j > i+1$ because step $i$ of Arnoldi, $Aq _ i$ is orthogonalised against $q _ 1, \ldots, q _ i$ only.

Symmetry forces tridiagonality. Since $A = A^\top$,

\[H _ k^\top = (Q _ k^\top A Q _ k)^\top = Q _ k^\top A^\top Q _ k = Q _ k^\top A Q _ k = H _ k\]

so $H _ k$ is symmetric. Since it is both symmetric and upper Hessenberg, it must be tridiagonal.

Setting $T _ k := H _ k$, the Arnoldi decomposition $AQ _ k = Q _ k H _ k + h _ {k+1, k} q _ {k+1} e _ k^\top$ becomes

\[AQ _ k = Q _ k T _ k + t _ {k+1, k} q _ {k+1} e _ k^\top\]

with $T _ k$ symmetric tridiagonal and $t _ {k+1, k} := h _ {k+1, k}$.

@State the cost of $k$ steps of the Lanczos iteration (∆lanczos-iteration), and compare it to the cost of $k$ steps of the Arnoldi iteration (∆arnoldi-decomposition). Explain where the speedup comes from.

Per stepTotal ($k$ steps)Memory
Arnoldi$O(nk)$$O(nk^2)$$O(nk)$
Lanczos$O(n)$$O(nk)$$O(n)$

How much faster is the Lanczos iteration compared to the Arnoldi decomposition?::

  • Lanczos: $O(nk)$ operations
  • Arnoldi: $O(nk^2)$ operations

In floating-point arithmetic, the ∆lanczos-iteration is known to suffer from a “loss of orthogonality” of the computed basis $\hat Q _ k$. @Describe what this means.

In exact arithmetic, the basis vectors $q _ i$ produced by Lanczos satisfy $Q _ k^\top Q _ k = I _ k$ exactly. In floating point, the computed $\hat Q _ k$ progressively loses the property, so that $\hat Q _ k^\top \hat Q _ k \ne I _ k$, with the discrepancy growing as $k$ increases. This is because rounding errors in the ∆lanczos-three-term-recurrence introduce small components along the earlier basis vectors.

Bite-sized

How is loss of orthogonality in Lanczos remedied in practice?

By reorthogonalisation: re-orthogonalise the new $q _ {k+1}$ against the full $Q _ k$ (rather than just $q _ k, q _ {k-1}$), recovering numerical orthogonality at the cost of $O(nk)$ work and $O(nk)$ memory — losing Lanczos’s main advantage over Arnoldi. Strategies are full (against all of $Q _ k$ at every step), selective (only against vectors tied to converged Ritz values), or partial (against a recent window). Lecture mentions the remedy without specifying which.

Source: Lecture 13, Lanczos iteration slide and §13.1 of the lecture notes (end-of-section remark).

@bite~

Why does symmetry $A = A^\top$ force the Arnoldi Hessenberg $H _ k$ to be tridiagonal?

$H _ k := Q _ k^\top A Q _ k$ is upper Hessenberg by construction of Arnoldi. When $A = A^\top$, $H _ k^\top = Q _ k^\top A^\top Q _ k = Q _ k^\top A Q _ k = H _ k$, so $H _ k$ is symmetric. A matrix that is both symmetric and upper Hessenberg has zero entries everywhere except the diagonal and first sub/super-diagonals — i.e. it is tridiagonal.

Source: Lecture 13, Lanczos iteration slide and §13.1 of the lecture notes (the proof note).

@bite~

The Lanczos initial vector is $q _ 1 = $ $b / \ \vert b\ \vert _ 2$, the same as for Arnoldi — the symmetry of $A$ doesn’t change the starting point, only the recurrence’s depth.

Source: Lecture 13, Lanczos iteration slide and §13.1 of the lecture notes (Algorithm setup).

@bite~