22  Module E — Numerical Eigenvalue Methods: Conditioning, Stability, Polynomial Filtering, and Mixed Precision

22.1 From a spectral decomposition to a numerical claim

Suppose a program returns a unit vector \(x\) and a number \(\theta\). You can multiply by \(A\), but you do not know any of its eigenvectors. What calculation would justify the statement “this is an accurate approximation to the second eigenvector”? Computing \(\|Ax-\theta x\|\) is a first step. You still need to identify the eigenvalue, establish separation from competing directions, and know how accurately you evaluated the residual itself. Each of the ten sessions develops one part of that argument.

Starting point in Review II. Module A (§4.11) supplied invariant subspaces and direct sums. Module B (§5.7) explained how a functional pulls back through a map. Module C (§§6.7, 6.11) supplied orthogonal projections and the mass-matrix inner product. Module D (§§7.5–7.10) established the spectral theorem, principal angles, Rayleigh–Ritz, and polynomial filtering. Its §7.18 asks what accuracy and cost survive implementation. Here a spectral theorem becomes both a way to design an algorithm and a way to audit its output.

Running example and conventions. Work over a finite-dimensional real or complex inner-product space, using orthonormal coordinates unless specified. A star denotes conjugate transpose. Write \(\|\cdot\|\) for the Euclidean or induced spectral norm, \(\|\cdot\|_F\) for the Frobenius norm. The Rayleigh quotient is \(\rho_A(x)=x^*Ax/(x^*x)\). Reuse the matrix from §7.5.5,

\[ A_0=\begin{pmatrix}2&1&0\\1&2&0\\0&0&9\end{pmatrix}, \quad q_1=(1,-1,0)^T/\sqrt2,\quad q_2=(1,1,0)^T/\sqrt2,\quad q_3=e_3 . \]

The corresponding eigenvalues are \(1,3,9\). These subscripts stay attached to these vectors. For general results we state the ordering separately, since largest magnitude, largest algebraic value and closest to a shift are three different targets.

Route through the chapter. Sessions 1–3 build certificates for computed answers. Sessions 4–6 derive vector, block and Krylov methods. Sessions 7–8 follow one Chebyshev filter from interval design to a bound on the angle of its computed output. Sessions 9–10 turn those bounds into precision choices and a common-target solver comparison. Experiments A–J form one executable Python laboratory in reading order.

Write \(\sigma(A)\) for the spectrum and \(\rho(A)=\max_{\lambda\in\sigma(A)}|\lambda|\) for its radius. A hat denotes a computed quantity. A tilde denotes intentionally perturbed or quantized data. A residual written without a hat is the mathematical residual of the supplied pair, even when the pair itself was computed.

22.2 Session 1 — How accurately does a computer apply a matrix?

What one rounding step changes

In binary precision \(p\) a normalized positive number has form \((1.b_2\ldots b_p)_2 2^e\) with a bounded exponent. Adjacent numbers in \([1,2)\) are \(2^{1-p}\) apart. Rounding to nearest therefore gives unit roundoff \(u=2^{-p}\). In binary32, \(p=24\); in binary64, \(p=53\). The spacing at one is \(2u\). The exponent controls range independently of the precision. For a correctly rounded real operation with exact result in the normal range and no overflow,

\[ \operatorname{fl}(a\mathbin{\circ}b)=(a\mathbin{\circ}b)(1+\delta),\quad |\delta|\le u . \]

Indeed half an ulp in the binade starting at \(2^e\) is \(2^eu\), while the result has magnitude at least \(2^e\). Zero is exact. Near underflow one needs an absolute-error term. A fused multiply-add rounds the combined expression once. Complex arithmetic implemented with real operations has different operation counts.

Hand experiment. With \(p=3\) and ties to even, \(1+1/8\) rounds to \(1\). Thus \((1+1/8)-1\) evaluates to zero while \((1-1)+1/8\) evaluates exactly. The final subtraction in the first expression is itself exact. It exposes the loss in the preceding sum. This is the same difficulty that arises when subtracting two large nearly equal terms in an eigenpair residual.

From dot products to a matrix product

For \(ku<1\) write \(\gamma_k=ku/(1-ku)\). A product of at most \(k\) factors \(1+\delta_j\) differs from one by at most \(\gamma_k\): its upper bound is \((1+u)^k\le 1/(1-ku)\) by binomial expansion and the geometric series, and its lower bound is at least \(1-ku\). Unroll a sequential real dot product. Each exact summand \(a_jx_j\) is multiplied by the rounding factor from its product and factors from subsequent additions, at most \(n\) in total when the first product initializes the sum. Thus

\[ |\operatorname{fl}(a^Tx)-a^Tx|\le\gamma_n\sum_j|a_jx_j|, \qquad |\operatorname{fl}(Ax)-Ax|\le\gamma_n|A|\,|x|. \]

Absolute values and the second inequality are entrywise. Equivalently, for this multiply there exists \(\Delta A\) with \(|\Delta A|\le\gamma_n|A|\) giving the computed result exactly as \((A+\Delta A)x\). The perturbation can change with the input and with each multiply. For sparse rows one can replace \(n\) by their maximum number of summed products under the same arithmetic model. Cancellation can make the relative output error large even when the componentwise backward error is small.

For a sequential sum of \(n\) numbers there are at most \(n-1\) additions on the path of any summand, giving \(|\widehat s-s|\le\gamma_{n-1}\sum|x_j|\). A balanced pairwise reduction has depth \(\lceil\log_2 n\rceil\) and gives the corresponding depth bound. Applying the dot-product argument to entry \((i,j)\) of a block gives \[ |\widehat{AX}-AX|\le\gamma_n |A|\,|X|. \] Each output column admits its own nearby matrix. Replacing these by a single small perturbation shared across the block requires another argument. On a GPU, fused instructions, accumulation format and reduction order determine which operation count belongs in the bound.

Binary format Significand bits including leading bit Normal exponents Unit roundoff
binary16 11 \(-14\) to \(15\) \(2^{-11}\)
bfloat16 8 \(-126\) to \(127\) \(2^{-8}\)
TF32 input format 11 \(-126\) to \(127\) \(2^{-11}\) for nearest rounding
binary32 24 \(-126\) to \(127\) \(2^{-24}\)
binary64 53 \(-1022\) to \(1023\) \(2^{-53}\)

Below the smallest normal \(2^{e_{\min}}\), gradual underflow uses a fixed spacing \(2^{e_{\min}-p+1}\). For example, binary16 represents \(2^{-24}\) exactly and rounds \(2^{-25}\) to zero with ties to even. At the other end, \(2^{16}\) overflows binary16 although it is a power of two. TF32 describes a matrix-product input mode with a wider accumulator on supported hardware. A storage cast alone does not implement that pipeline.

22.3 Session 2 — Is the problem sensitive or the algorithm unstable?

Problem sensitivity versus the error of a method

For differentiable \(f\) the local absolute condition number in specified norms is \(\|Df(d)\|\). For \(d,f(d)\ne0\), the relative one is \(\|Df(d)\|\|d\|/\|f(d)\|\). This follows by maximizing the first-order change \(Df(d)h\) over a ball of input perturbations. Specifying which data may change is part of defining the problem.

A forward error measures distance from the exact output. A backward error is the least size of a permitted perturbation for which the computed output is exact. Backward stability means this size is small on the scale of arithmetic error under stated hypotheses. For \(Ax=b\) with nonsingular \(A\), fixed \(A\), and \(r=b-A\hat x\), the exact perturbed right side is \(b-r\). Hence

\[ x-\hat x=A^{-1}r,\qquad \frac{\|x-\hat x\|}{\|x\|}\le\kappa_2(A)\frac{\|r\|}{\|b\|}, \quad \kappa_2(A)=\|A\|\|A^{-1}\|=\sigma_{\max}/\sigma_{\min}. \]

Here \(\|b\|\le\|A\|\|x\|\) supplies the last factor. For \(A=\operatorname{diag}(1,\varepsilon)\), \(b=e_1\) and \(\hat x=(1,1)^T\), the relative residual is \(\varepsilon\) and the relative forward error is one. The SVD from Module D explains this amplification by the long axis of the inverse image ellipsoid. In iterative refinement a more accurate residual helps recover the correction. The eigenvalue analogue requires spectral separation, developed next.

Which entries may change?

With simultaneous relative perturbations \(|E|\le\eta |A|\) and \(|f|\le\eta |b|\), feasibility of \((A+E)\hat x=b+f\) requires \(|r_i|\le\eta (|A||\hat x|+|b|)_i\). This is also sufficient for real data. In each row select the signs of \(E_{ij}\hat x_j\) and \(-f_i\) to agree with \(r_i\), and scale every allowed term in that row by the same fraction until their sum is \(r_i\). Thus the smallest feasible \(\eta\) is the maximum of the row ratios. A zero denominator contributes zero if its residual is zero and infinity otherwise. This model preserves structural zeros. A normwise perturbation of the same relative size can fill them.

A backward-stable algorithm gives \(\hat y=f(d+\Delta d)\) for \(\|\Delta d\|/\|d\|\le Cu\) on the stated data class. Applying the definition of the derivative bounds the relative forward error locally by \(Cu\kappa_f(d)+o(u)\) for fixed \(d\). Forward stability asks directly for accuracy at this conditioning-dependent scale. A mixed analysis permits a small final output perturbation as well as perturbed inputs. A meaningful analysis specifies how \(C\) depends on dimension, implementation and any growth factors.

Checkpoint. For \(a=(1,-1)\), \(x=(1,1+\varepsilon)^T\), explain why the dot-product bound divided by \(|a^Tx|\) grows like \(2\gamma_2/|\varepsilon|\). Which two terms cancel?

22.4 Session 3 — What does an eigenpair residual certify?

A residual as the price of exactness

For a unit vector \(x\), set \(r=Ax-\theta x\). A matrix \(E\) makes \((\theta,x)\) exact for \(A+E\) precisely when \(Ex=-r\). Consequently \(\|E\|\ge\|r\|\), with equality for \(E=-rx^*\). This is an exact, normwise, absolute backward error allowing arbitrary matrix perturbations. For a nonzero unnormalized vector divide the residual norm by \(\|x\|\). Normalizing further by \(\|A\|\) gives a relative perturbation in \(A\) when \(\|A\|>0\).

If \(A=A^*\) and \(\theta=\rho_A(x)\), then \(x^*r=0\). Now \(E=-rx^*-xr^*\) is Hermitian and has the same optimal norm. On the orthonormal pair \(x,r/\|r\|\) its matrix has zero diagonal and off-diagonals \(-\|r\|\), and it vanishes on their orthogonal complement. The case \(r=0\) takes \(E=0\). This construction preserves self-adjointness. Additional requirements such as a fixed sparsity pattern change the backward-error problem.

Locating an eigenvalue and locating a direction

Let \(A=A^*=U\Lambda U^*\), \(x=\sum_i c_i u_i\), \(\|x\|=1\). Pythagoras gives the identity

\[ \|r\|^2=\sum_i|\lambda_i-\theta|^2|c_i|^2 . \]

Since \(\sum_i|c_i|^2=1\), some eigenvalue lies within \(\|r\|\) of \(\theta\). To identify a target set \(I\), let \(P_I=\sum_{i\in I}u_i u_i^*\) and \(\delta=\min_{i\notin I}|\lambda_i-\theta|>0\). Discarding the target terms gives

\[ \sin\angle(x,\operatorname{ran}P_I)=\|(I-P_I)x\|\le\|r\|/\delta . \]

Knowing which eigenvalues are excluded is substantive information. An exact eigenvector of the wrong eigenvalue has zero residual. Eigenvectors inside a multiple eigenspace are interchangeable, so a particular basis there cannot be certified from the equation.

For a simple target \(\lambda_j\), expansion of the Rayleigh quotient gives \(\rho_A(x)-\lambda_j=\sum_{i\ne j}(\lambda_i-\lambda_j)|c_i|^2\). Its absolute value is bounded by \(\max_i|\lambda_i-\lambda_j|\sin^2\angle(x,u_j)\). Thus the value can settle to many digits while its direction still moves appreciably. For \(x=\cos t\,q_2+\sin t\,q_3\), the value is \(3+6\sin^2 t\) and the residual norm is \(6|\sin t\cos t|\).

Weyl and subspace separation

For two Hermitian matrices \(A\) and \(A+E\), their eigenvalues in increasing order satisfy \(|\lambda_i(A+E)-\lambda_i(A)|\le\|E\|\). Proof. For every unit vector the Rayleigh quotients differ by at most \(\|E\|\). Taking the maximum over vectors in an \(i\)-dimensional subspace and then the minimum over such subspaces preserves both inequalities. Apply Module D’s min–max theorem. This is an absolute bound. Relative sensitivity may be large near zero.

Here is a residual version of the subspace separation argument behind Davis–Kahan. Let \(X^*X=I\), \(H=X^*AX\), and \(R=AX-XH\). Rotate \(X\) by a unitary matrix to diagonalize \(H=\operatorname{diag}(\theta_j)\) in its new basis. If \(U_2\) spans the exact unwanted eigenvectors with diagonal matrix \(\Lambda_2\), then \(S=U_2^*X\) satisfies

\[ \Lambda_2 S-SH=U_2^*R . \]

If every \(|\lambda_i(\Lambda_2)-\theta_j|\ge\delta>0\), division entry by entry and summation of squares gives \(\|S\|_F\le\|R\|_F/\delta\). The square roots of the eigenvalues of \(S^*S\) are the sines of the principal angles when the target and trial dimensions agree. This proves a Frobenius sin-theta bound and therefore also bounds the largest sine. Entrywise division alone does not prove the same constant for a spectral-norm right side. For a perturbed invariant subspace of \(A+E\), \(R=-(I-XX^*)EX\); the denominator must still separate the perturbed Ritz spectrum from the unwanted spectrum of \(A\).

Small-gap example. For \(\operatorname{diag}(1,1+g)\) add a real symmetric off-diagonal \(\varepsilon\). The diagonalizing rotation has \(|\tan(2t)|=2|\varepsilon|/g\). Taking \(\varepsilon=g/2\) rotates the axes by \(\pi/8\) even as \(g\to0\). Appending a third eigenvalue \(9\) leaves the first two coordinates as an exact invariant plane. A well-determined plane may contain poorly determined individual directions.

Why nonnormality changes the certificate

If \(A=V\Lambda V^{-1}\) and \(\mu\) is an eigenvalue of \(A+E\), then \(\min_i|\mu-\lambda_i|\le\kappa_2(V)\|E\|\) (Bauer–Fike). For \(\mu\) outside the spectrum, apply \((\mu I-A)^{-1}\) to \(Ex\) for a unit perturbed eigenvector \(x\). The resolvent has norm at most \(\kappa_2(V)/\min_i|\mu-\lambda_i|\), giving the claim. A normal matrix admits unitary \(V\). For a simple eigenvalue, differentiating \(Ax=\lambda x\) and testing with a left eigenvector \(y^*\) gives \(\dot\lambda=y^*\dot A x/(y^*x)\). This is Module B’s dual measurement in action. Nearly orthogonal left and right eigenvectors amplify perturbations.

For the Jordan block \(J=\left(\begin{smallmatrix}0&1\\0&0\end{smallmatrix}\right)\), adding \(\varepsilon\) in position \((2,1)\) produces eigenvalues \(\pm\sqrt{\varepsilon}\). Even the order of the displacement changes at a defective eigenvalue. More generally the \(\varepsilon\)-pseudospectrum consists of the possible eigenvalues under \(\|E\|\le\varepsilon\). The rank-one construction identifies it exactly with those \(\theta\) admitting a unit vector of residual at most \(\varepsilon\).

Checkpoint. If a normalized Hermitian Ritz vector has residual \(10^{-8}\) and every unwanted eigenvalue is at least \(10^{-3}\) away from its Ritz value, what is certified? Some eigenvalue is within \(10^{-8}\) and the sine to the identified target space is at most \(10^{-5}\).

22.5 Session 4 — Vector iterations as spectral transformations

Power iteration and its rate

Given a unit \(x_0\), form \(y=Ax_k\), \(x_{k+1}=y/\|y\|\) whenever \(y\ne0\). Normalization controls the scale and preserves the line generated by \(A^{k+1}x_0\). For Hermitian \(A\), order \(|\lambda_1|>|\lambda_2|\ge\cdots\) and write \(x_0=\sum c_i u_i\) with \(c_1\ne0\). Divide the squared norm of the unwanted components by that of the desired component:

\[ \tan^2\angle(x_k,u_1)= \sum_{i>1}\left|\frac{c_i}{c_1}\right|^2 \left|\frac{\lambda_i}{\lambda_1}\right|^{2k}. \]

Consequently the tangent decreases at least as fast as the bound \((|\lambda_2/\lambda_1|)^k\tan\angle(x_0,u_1)\). Equality holds if all active unwanted components have modulus \(|\lambda_2|\). The Rayleigh quotient error is quadratic in the sine by Session 3. A negative dominant eigenvalue reverses sign each iteration. Monitor the line or its residual. A zero starting coefficient stays zero in exact arithmetic. Equal dominant moduli can prevent convergence to a line, as \(\operatorname{diag}(1,-1)\) shows.

For \(A_0\), start at \((q_2+q_3)/\sqrt2\). After two multiplications the tangent to \(q_3\) is \(1/9\), and the Rayleigh quotient is \((3+9\cdot81)/82\). Compare the error \(6/82\) with the angle \(\arctan(1/9)\). In an optimization interpretation, \(\rho_A\) on the unit sphere has tangential gradient \(2(Ax-\rho_A(x)x)\) in real coordinates. A stationary point is an eigenvector. Power iteration selects by modulus, so on an indefinite matrix it need not maximize the quotient.

Inverse iteration and Rayleigh quotient iteration

Choose a real shift \(\sigma\) outside the spectrum. Solve \((A-\sigma I)y=x_k\) and normalize \(y\). In the eigenbasis the component multiplier is \(1/(\lambda_i-\sigma)\). For a unique closest eigenvalue \(\lambda_t\), nonzero starting overlap, and second-closest distance \(d_2\), the tangent bound contracts per step by \(|\lambda_t-\sigma|/d_2\). A fixed shift permits reuse of a factorization. For \(A_0\), \(\sigma=2.8\) gives distances \(1.8,0.2,6.2\). The target is \(q_2\) and the worst-case factor is \(1/9\). Near-singularity is the source of selectivity. It also calls for stable shifted solves and residual checks on the original eigenproblem. A solve residual \(s=x_k-(A-\sigma I)\hat y\) changes the inverse application by \(-(A-\sigma I)^{-1}s\).

Rayleigh quotient iteration (RQI) recomputes \(\sigma=\rho_A(x_k)\) each time. Assume \(A\) Hermitian, \(\lambda_t\) simple, gap \(g>0\), and \(x_k\) close enough that \(|\rho_A(x_k)-\lambda_t|<g/2\). Put \(t=\angle(x_k,u_t)\) and \(D=\max_i|\lambda_i-\lambda_t|\). When the shifted solve exists, the same component calculation gives

\[ \tan t_{\mathrm{new}}\le \frac{|\lambda_t-\rho_A(x_k)|}{\min_{i\ne t}|\lambda_i-\rho_A(x_k)|}\tan t \le (2D/g)\sin^2 t\,\tan t . \]

This proves local cubic convergence of the direction. Each changing shift can require a new factorization. Check convergence before solving: at an eigenvector the shifted matrix is singular. At an interior eigenvalue cancellation can also give a singular shift away from an eigenvector. For \(\operatorname{diag}(-1,0,1)\), the equal mixture of the outer directions has quotient zero. A practical safeguard detects a failed solve and selects a perturbed shift. The cubic estimate makes no global claim about which eigenpair a distant start selects.

Newton interpretation. For real symmetric \(A\), linearize \((Ax-\lambda x,(x^Tx-1)/2)=0\) at a unit vector and its Rayleigh quotient. The correction obeys \((A-\lambda I)\Delta x-x\Delta\lambda=-r\) and \(x^T\Delta x=0\). Rearrangement yields \((A-\lambda I)(x+\Delta x)=x\Delta\lambda\). Whenever the Newton system and shifted solve are nonsingular, the normalized Newton direction is the RQI direction up to sign. Rayleigh quotient extraction supplies the next shift.

Checkpoint. Explain why a smaller shift distance helps inverse iteration in exact arithmetic and simultaneously increases the potential amplification of a linear-solve residual.

22.6 Session 5 — Block iteration, principal angles, and extraction

Why a basis needs attention

To find a \(p\)-dimensional invariant space, start with \(X_0^*X_0=I_p\), form \(Y=AX_k\), and take \(X_{k+1}\) as the thin \(Q\) in \(Y=QR\). Provided \(Y\) has full column rank, \(R\) is invertible and the range is unchanged by this operation. Independent power iterations tend to align all columns with the strongest direction. A QR step restores a basis with which the weaker directions can still be represented. A unitary change of basis \(X\mapsto XW\) leaves the orthogonal projector \(XX^*\) unchanged.

Write \(A=[U_1,U_2]\operatorname{diag}(\Lambda_1,\Lambda_2)[U_1,U_2]^*\) for Hermitian \(A\), with \(p\) target columns in \(U_1\). Put \(C=U_1^*X_0\), \(D=U_2^*X_0\). Assume \(C\) invertible and every target eigenvalue nonzero. In eigen-coordinates a basis of the iterated space can be written \[ \begin{pmatrix}\Lambda_1^k C\\\Lambda_2^k D\end{pmatrix} (\Lambda_1^k C)^{-1}=\begin{pmatrix}I\\Z_k\end{pmatrix}, \qquad Z_k=\Lambda_2^k DC^{-1}\Lambda_1^{-k}. \] This is the graph of a map from the target to its orthogonal complement. A vector on it has tangent \(\|Z_k v\|/\|v\|\) to the target. Maximization therefore gives \(\tan\theta_{\max}=\|Z_k\|\). In particular \[ \tan\theta_{\max,k}\le \left(\frac{\max_{\mathrm{out}}|\lambda|}{\min_{\mathrm{in}}|\lambda|}\right)^k\|DC^{-1}\| . \] Separation is needed across the boundary of the target. Multiplicities wholly inside it cause no difficulty. Taking a block larger than the requested number can move that boundary beyond a cluster; then interpret the bound for the enlarged space and extract the requested Ritz pairs.

Two orthogonalization algorithms. For an incoming column \(z\), classical Gram–Schmidt computes all coefficients \(Q^*z\) before subtracting \(Q(Q^*z)\). Modified Gram–Schmidt updates \(z\leftarrow z-q_i(q_i^*z)\) after each coefficient, so later measurements see the revised vector. Both formulas coincide with exact orthonormal \(Q\). For \(z_1=(1,\epsilon)^T\), \(z_2=(1,0)^T\), the independent component has size about \(\epsilon\). An absolute error of size \(u\) before normalization can therefore produce angular error of order \(u/\epsilon\). A second pass measures and removes components left by the first. Rank-revealing QR or an SVD can diagnose the point at which the residual direction is indistinguishable from perturbations in the input.

Rayleigh–Ritz and finite precision

With orthonormal \(X\), compress to \(H=X^*AX\). Solve \(Hw_j=\theta_jw_j\) with orthonormal \(w_j\), form \(v_j=Xw_j\). Then \(r_j=Av_j-\theta_j v_j\) satisfies \(X^*r_j=0\) by substitution. Conversely this orthogonality for \(v=Xw\) is precisely the projected eigenproblem. Thus the defect annihilates every trial-space test direction (Module B), or equivalently has zero orthogonal projection there (Module C). For nonorthonormal full-rank \(Y\) the corresponding problem is \(Y^*AYw=\theta Y^*Yw\). An ill-conditioned Gram matrix squares the basis condition number. Orthogonalize first.

For \(A_0\), use \(X=[q_2,(q_1+q_3)/\sqrt2]\). The compression is \(\operatorname{diag}(3,5)\), yet \(5\) is not an eigenvalue of \(A_0\). Its residual is \(4(q_3-q_1)/\sqrt2\), perpendicular to both columns. One exact Ritz pair can coexist with a poor second pair. Sorted Ritz values alone do not verify a block.

Householder QR uses unitary reflections \(I-2vv^*/(v^*v)\) to zero entries below a pivot without changing exact lengths. In floating point it is a standard stable choice for a dense block. Gram–Schmidt subtracts projections onto earlier columns. If this leaves a tiny vector, errors made in subtracting large components are magnified upon normalization. A second orthogonalization pass often repairs the defect. If the input block has lost numerical rank, reorthogonalization cannot recover information already lost. Monitor \(\|I-X^*X\|\), the size and conditioning of the small triangular factor, and the direct residual. Computing small angles through \(\arccos(\sigma_{\min}(U_1^*X))\) loses digits near one. Prefer \(\|(I-U_1U_1^*)X\|\) or \(\|U_2^*X\|\) for the largest sine.

Checkpoint. For trial columns \(q_3,(q_2+q_1)/\sqrt2\) and target \(\operatorname{span}(q_3,q_2)\), calculate the tangent after one power step. It is \(1/3\), even though the first column is already exact.

22.7 Session 6 — Krylov spaces and projected eigenproblems

Keeping the history

For \(v\ne0\), \(\mathcal K_m(A,v)=\operatorname{span}(v,Av,\ldots,A^{m-1}v)=\{p(A)v:\deg p<m\}\). Power iteration keeps one polynomial. Krylov projection searches the span of all these candidates. If \(A^m v\) lies in the earlier span then applying \(A\) to any spanning vector stays inside and the space is invariant. Algebraically, \(p\mapsto p(A)v\) maps the polynomial ring onto the cyclic space generated by \(v\). Its kernel is the ideal generated by the least-degree monic polynomial annihilating \(v\). Polynomial division shows that its degree equals the eventual Krylov dimension. This is the first isomorphism theorem of Module A in the language of Module F2.

Arnoldi, Lanczos, and the residual shortcut

Normalize \(v_1=v/\|v\|\). Given \(V_j=[v_1,\ldots,v_j]\), project \(Av_j\) onto the basis, subtract that projection and normalize the remainder: \[ h_{ij}=v_i^*Av_j,\quad w=Av_j-\sum_{i=1}^j h_{ij}v_i,\quad h_{j+1,j}=\|w\|,\quad v_{j+1}=w/h_{j+1,j}. \] A zero norm gives an invariant space in exact arithmetic. Stacking the identities gives \[ AV_m=V_m H_m+h_{m+1,m}v_{m+1}e_m^*,\qquad H_m=V_m^*AV_m . \] \(H_m\) is upper Hessenberg because \(Av_j\) lies in the first \(j+1\) basis vectors. For a unit eigenvector \(H_m y=\theta y\), its lifted residual has norm \(|h_{m+1,m}|\,|e_m^*y|\). Only the last coefficient and the last subdiagonal enter.

For Hermitian \(A\), Hermitian symmetry of \(H_m\) forces all entries above its first superdiagonal to vanish as well. Writing its real diagonal as \(\alpha_j\) and nonnegative subdiagonal as \(\beta_j\) gives the Lanczos recurrence \[ \beta_jv_{j+1}=Av_j-\alpha_jv_j-\beta_{j-1}v_{j-1}, \quad \beta_0=0 . \] In exact arithmetic earlier projections vanish by the Hessenberg identity and symmetry. In finite precision tiny components along converged Ritz directions can grow back, causing duplicate approximate eigenvalues. Full or selective reorthogonalization trades additional work and communication for control of this effect. The direct residual checks both the recurrence shortcut and the projected solve.

Two steps by hand. Start \(A_0\) at \(e_1\). Then \(Ae_1=2e_1+e_2\), so \(\alpha_1=2\), \(\beta_1=1\), \(v_2=e_2\). Next \(Ae_2=e_1+2e_2\), yielding \(\alpha_2=2\), \(\beta_2=0\). The projected problem has eigenvalues \(1,3\). The missing \(9\) cannot be recovered from this start because every polynomial in \(A\) preserves this coordinate plane.

Nonnormal diagnostic. A simple, diagonalizable example makes the dual measurement explicit. Let \(N=\left(\begin{smallmatrix}1&K\\0&2\end{smallmatrix}\right)\) for large \(K>0\). At eigenvalue one, right vector \(e_1\) and left row \((1,-K)\) have pairing one but product of norms \(\sqrt{1+K^2}\). A perturbation \(\epsilon e_2e_1^T\) changes the characteristic equation to \((\lambda-1)(\lambda-2)-K\epsilon=0\). The eigenvalue near one is \((3-\sqrt{1+4K\epsilon})/2=1-K\epsilon+O((K\epsilon)^2)\) for \(|K\epsilon|\ll1\). Merely seeing a unit gap between eigenvalues would miss this amplification.

A sparse Arnoldi step needs one matrix application and projections against earlier vectors. For \(m\) steps, storing the full basis costs order \(nm\) and orthogonalization costs order \(nm^2\). Short-recurrence Lanczos can generate coefficients with a few vectors, but recovering Ritz vectors later requires stored or regenerated basis information. Restarting bounds storage by retaining selected approximate spectral information before building a new space. Discarding too much can erase progress near a cluster. Block iteration has fixed width and can exploit matrix–block products. A degree-\(d\) filtered block also belongs to a block Krylov space, but evaluates a prescribed polynomial without storing every power.

Checkpoint. What evidence distinguishes exact invariance from numerical breakdown? A tiny computed \(\beta_j\) is a clue. Directly test \(\|AV_j-V_jH_j\|\) and \(\|V_j^*V_j-I\|\) at the accuracy required by the application.

22.8 Session 7 — Designing and evaluating a Chebyshev filter

The design problem

Suppose the unwanted eigenvalues of a Hermitian operator lie in \([a,b]\) and all desired eigenvalues lie above \(b\). Let \(c=(a+b)/2\), \(h=(b-a)/2>0\), and \(B=(A-cI)/h\). The unwanted interval maps to \([-1,1]\). A filter should be bounded there and large at every target. The same map works for a target below \(a\) using the parity of the polynomial. An interior band generally needs a different filter design: two exterior tails cannot both be mapped to this single unwanted interval by one affine map without also including the interior target.

Define \(T_j(\cos t)=\cos(jt)\). The addition formula gives \(T_0=1\), \(T_1=z\), \(T_{j+1}=2zT_j-T_{j-1}\). Thus \(|T_j|\le1\) on \([-1,1]\), and \(T_j(-z)=(-1)^jT_j(z)\). For \(z>1\) substitute \(z=\cosh s\) into the same recurrence to obtain \(T_j(z)=\cosh(js)\), \(s=\operatorname{arcosh}z\). Growth is exponential for fixed exterior \(z\). It slows as the target approaches the cutoff. Taking higher powers \(z^j\) also amplifies exterior components, but misses the extremal property below.

Normalized minimax theorem. Fix \(z_*>1\), \(d\ge1\). Among real polynomials \(p\) of degree at most \(d\) satisfying \(p(z_*)=1\), the least possible maximum of \(|p|\) on \([-1,1]\) is \(1/T_d(z_*)\). The candidate is \(p=T_d/T_d(z_*)\). To prove optimality, suppose a competitor has strictly smaller maximum. The difference \(T_d-T_d(z_*)p\) alternates in sign at \(\cos(j\pi/d)\) for \(j=0,\ldots,d\). It has \(d\) distinct interior zeros and another zero at \(z_*\). A nonzero polynomial of degree at most \(d\) cannot have \(d+1\) roots. This optimality concerns uniform suppression of an interval with a specified exterior normalization. It does not optimize wall time or rounding errors.

Subspace convergence and degree choice

The spectral theorem gives \(T_d(B)u_i=T_d((\lambda_i-c)/h)u_i\). Apply the graph proof from Session 5 with each eigenvalue replaced by its filter value. For full initial target overlap, \[ \tan\theta_{\max,k}\le \rho_d^k\tan\theta_{\max,0},\qquad \rho_d=\frac{\max_{\mathrm{out}}|T_d((\lambda-c)/h)|} {\min_{\mathrm{in}}|T_d((\lambda-c)/h)|}. \] If the nearest target maps to \(z_*>1\) and all unwanted eigenvalues lie in the design interval, \(\rho_d\le\operatorname{sech}(d\,\operatorname{arcosh}z_*)\). For a desired one-block contraction \(\tau<1\) choose \(d\ge\operatorname{arcosh}(1/\tau)/\operatorname{arcosh}z_*\). Round upward. This counts polynomial degree, hence block products, per application. It is a sufficient interval estimate. The finite set of actual unwanted eigenvalues can give a smaller ratio.

Running matrix. Seek \(q_3\) of \(A_0\). For \([1,3]\), \(B=A_0-2I\) has eigenvalues \(-1,1,7\). A degree-two filter has values \(1,1,97\). Starting at \((q_2+q_3)/\sqrt2\), two ordinary power steps leave tangent \(1/9\). One degree-two filter also takes two products and leaves tangent \(1/97\). Both calculations start with the same angle and cost the same number of applications. Differences in QR, memory access and coefficient operations enter an actual timing comparison.

Evaluating a polynomial without forming powers

Use \(Y_0=X\), \(Y_1=BX\), \(Y_{j+1}=2BY_j-Y_{j-1}\). Induction gives \(Y_j=T_j(B)X\). Only successive blocks are needed. The product \(BY=(AY-cY)/h\) can be implemented as an operator action. Forming \(B\) once can change cancellation, rounding and memory requirements. An exact-arithmetic scalar normalization common to the entire block leaves the resulting space unchanged.

To control range, choose an exterior reference \(z_s>1\), typically near the largest mapped target, and set \(W_j=Y_j/T_j(z_s)\). Define \(s_j=T_{j-1}(z_s)/T_j(z_s)\). Then \[ s_1=1/z_s,\quad s_{j+1}=1/(2z_s-s_j),\quad W_0=X,\quad W_1=s_1BX,\quad W_{j+1}=2s_{j+1}BW_j-s_js_{j+1}W_{j-1}. \] This follows by dividing the recurrence by \(T_{j+1}(z_s)\). It avoids computing the huge normalization factor explicitly. Common scaling controls overflow but leaves the ratio between the strongest and weakest wanted components intact. Large degree can make the filtered block nearly rank deficient before QR. Compare singular values of the small \(R\) factor, shorten the polynomial or orthogonalize between complete shorter filters. Inserting arbitrary independent normalizations into an unmodified three-term recurrence changes the polynomial.

22.9 Session 8 — What happens to an error made inside a filter?

What a local error becomes

For the unscaled recurrence define a local additive defect \(F_j\) in each computed step, incorporating whatever product and update errors occurred: \[ \widehat Y_0=X,\quad \widehat Y_1=BX+F_1,\quad \widehat Y_j=2B\widehat Y_{j-1}-\widehat Y_{j-2}+F_j,\quad j\ge2 . \] Let \(U_0(z)=1\), \(U_1(z)=2z\), \(U_{k+1}=2zU_k-U_{k-1}\) be the Chebyshev polynomials of the second kind (here \(U_k\) is a polynomial). Subtract the exact recurrence. Induction, using \(U_0=1\) for the newest defect, gives the exact error representation \[ \widehat Y_d-Y_d=\sum_{j=1}^d U_{d-j}(B)F_j . \] This identity assumes a fixed exact \(B\) and exact initial block. Errors in storing or applying \(B\) can be included in \(F_j\). It does not presume independent random signs. Projection onto any eigendirection reduces the propagation to scalar weights. For \(z=\cos t\), \(U_k(z)=\sin((k+1)t)/\sin t\), bounded by \(k+1\) including the limiting endpoints (expand the sine quotient as a sum of unit complex exponentials). Consequently for the unwanted spectral projector \(P_2\), \[ \|P_2(\widehat Y_d-Y_d)\|\le \sum_{j=1}^d(d-j+1)\|P_2 F_j\|. \] For \(z=\cosh s>1\), the corresponding weight is \(\sinh((k+1)s)/\sinh s\). An early error in a desired component can grow very large in absolute norm. Whether it rotates the range is a separate question. For instance, at \(d=3\) a defect in the first product contributes \((4B^2-I)F_1\), while a defect in the last update contributes \(F_3\) directly.

Initialization, storage and one local product

If the stored start is \(X+G_0\) and the first multiply is \(B(X+G_0)+F_1\), linearity contributes the additional term \(T_d(B)G_0\) to the preceding sum. Alternatively, prescribe independent initial errors \(Z_0,Z_1\) relative to \(X,BX\). For \(d\ge2\), homogeneous propagation gives \(U_{d-1}(B)Z_1-U_{d-2}(B)Z_0\), followed by the sum starting at \(j=2\). Substitution of \(Z_1=B G_0+F_1\) recovers the first convention. Counting both initial terms and a separate storage defect for the same conversion double-counts the error.

For a real stored \(B\), let \(D_j=\operatorname{fl}(B\widehat Y_{j-1})-B\widehat Y_{j-1}\). Sequential products give \(|D_j|\le\gamma_n|B||\widehat Y_{j-1}|\). If doubling is exact and a single rounded subtraction finishes the update, then \[ |F_j|\le 2|D_j|+u\big(2|B\widehat Y_{j-1}+D_j|+|\widehat Y_{j-2}|\big). \] This follows by adding and subtracting the exact update of the computed operands. If \(B\) was stored as \(B+E_s\), include \(E_s\widehat Y_{j-1}\) in the product defect. The bound varies with block size in norm, input magnitudes and degree. A single fitted constant times unit roundoff can conceal all three effects.

Turning application error into angle error

In the target/complement coordinates write the input block as \(\binom{C}{D}\), and write one computed filter output as \(\binom{P_1 C+G_1}{P_2' D+G_2}\), where \(P_1,P_2'\) are diagonal target and unwanted filter values, and \(G_i\) are the total filter errors in those coordinates. Put \(\alpha=\min|\operatorname{diag}P_1|\), \(\beta=\max|\operatorname{diag}P_2'|\). Right-multiplying by \(C^{-1}\) shows that the graph of the output has tangent bounded by \[ t_{\mathrm{new}}\le \frac{\beta t+\|G_2 C^{-1}\|}{\alpha-\|G_1 C^{-1}\|}, \qquad t=\|DC^{-1}\|. \] Indeed the smallest singular value of the top block after multiplication is at least the denominator, which must be positive. The unwanted numerator is bounded by the triangle inequality. This inequality explains why a global absolute error bound alone is a poor predictor of angle accuracy. Unwanted leakage adds a new direction and poor target overlap can amplify it.

If the resulting step bounds yield uniform constants \(t_{k+1}\le q t_k+\eta\) with \(0\le q<1\), summing a geometric progression gives \(t_k\le q^kt_0+\eta(1-q^k)/(1-q)\). The second term predicts a possible stagnation scale. It is an upper envelope, never a proof that every run stagnates there. Errors can cancel or decrease as the residual shrinks. An observed plateau can also be real. For a scalar graph update \(z_{k+1}=qz_k+f\) with fixed positive leakage \(f\) and \(0<q<1\), the exact limit is \(f/(1-q)\). This is realized by target multiplier one, unwanted multiplier \(q\) and additive unwanted component \(f\) in graph coordinates. A verified residual and a gap estimate are needed to diagnose a real run.

Bounds that miss part of the spectrum

If an unwanted eigenvalue falls just outside the designed interval, its multiplier becomes \(\cosh(d\,\operatorname{arcosh}|z|)\) in magnitude. Recompute the actual ratio \(\rho_d\): convergence can slow and an unwanted direction can even dominate. Conversely an overly wide interval can bring the nearest target closer to \(1\), requiring higher degree. Obtain bounds from analysis of the operator, enclosing intervals such as Gershgorin bounds, or preliminary iterations with explicit margins. An interior Ritz estimate of an extreme eigenvalue alone is generally not an outer enclosure, as min–max already shows.

Checkpoint. With \([a,b]=[1,5]\) and target \(8\), \(z_*=2.5\). Show \(T_3(2.5)=55\). If an unwanted \(6\) was missed, its mapped value is \(1.5\), giving \(T_3(1.5)=9\). The ratio estimate changes from \(1/55\) to \(9/55\) when this is the only missed eigenvalue.

22.10 Session 9 — Mixed precision and hardware-aware computation

An error budget by operation

Operation Where accuracy enters Measurement or design choice
Store and apply \(A\) Quantization perturbs the operator before accumulation begins Retain a reference action for verification
Evaluate the filter Every recurrence defect is propagated by a different polynomial Select degree, scaling, product and update precisions separately
QR Small singular directions of the input may be obscured Check orthogonality and inspect the triangular factor
Rayleigh–Ritz Projection errors perturb a small Hermitian problem Form and solve the compression accurately, check its symmetry
Stop and report Cancellation in \(AX-X\Theta\) may hide the true residual Reapply the original operator in a specified verification precision

If storage gives \(\widetilde A=A+E_s\) and arithmetic returns \(\widetilde A X+F\), the product error relative to the original data is \(E_s X+F\). Higher-precision accumulation can reduce \(F\) but does not remove \(E_sX\). If \(X\) itself is quantized, expand \((A+E_s)(X+E_x)\) to see the additional terms \(AE_x+E_sE_x\). In a distributed computation rounding communicated entries contributes to \(E_x\), possibly only on boundary data. A uniform normwise model may overestimate that effect. Floating-point format, product precision, accumulation precision and communication format must be specified separately.

Verification bound. If the computed verification residual is \(\hat r=r+e\) with \(\|e\|\le\epsilon_v\), then \(\|r\|\le\|\hat r\|+\epsilon_v\). A matvec bound from Session 1 plus bounds for the scale and subtraction can supply \(\epsilon_v\) under a known arithmetic model. A double-precision direct residual is a practical independent diagnostic when the filter ran in single. Calling it a rigorous enclosure additionally requires controlling its own evaluation and norm rounding. Increasing the verification precision can reveal an existing error without changing the iterate.

A scalar identity behind residual-based methods. For a polynomial \(p\) and approximate eigenpair \((x,\theta)\), the factor theorem gives \(p(z)-p(\theta)=(z-\theta)s_\theta(z)\). Therefore \[ p(A)x=p(\theta)x+s_\theta(A)r,\qquad r=Ax-\theta x . \] For \(p(z)=2z^2-1\), \(s_\theta(z)=2(z+\theta)\). Near convergence the argument of the operator in the correction is small. If a product error is proportional to the norm of its input, the error in applying an operator to a small residual may shrink with convergence. An accurately evaluated residual and a controlled correction recurrence are essential. When the input residual is already corrupted at the scale of \(u\|A\|\), the argument loses force. This identity provides a way into the seminar paper’s residual-based recurrence. The ordinary recurrence in the lab is its comparison case. For the actual algorithm and its numerical evidence see Kodali, Ramakrishnan and Motamarri, Residual-based Chebyshev filtered subspace iteration.

Cost of reaching an accuracy target

A dense matrix–block product with an \(n\times p\) real block costs approximately \(2n^2p\) scalar floating-point operations. A sparse product costs approximately \(2\,\mathrm{nnz}(A)p\). A thin dense QR costs order \(np^2\) and the compressed eigensolve costs order \(p^3\). A degree-\(d\) filter takes \(d\) matrix–block products before extraction. These counts give no sustained bandwidth, occupancy or collective latency. For an illustrative machine model with peak rate \(F\) and bandwidth \(B_w\), moving \(S\) bytes and doing \(W\) operations requires at least \(\max(W/F,S/B_w)\) time for the modeled resources. Sparse indices, cache reuse, conversions, synchronization and contention affect actual time. A block may reuse matrix entries across columns. Distributed inner products require reductions, whereas stencil products often require neighbor exchanges.

For a fair comparison specify a target cluster, a common residual tolerance on the original operator, an orthogonality threshold, starting block and stopping rule. Time setup, transfers, filtering, QR, extraction and verification; include all repetitions needed to reach tolerance. Record failures to meet tolerance. A low-precision run with faster individual products can take longer to deliver an acceptable subspace, or never meet the criterion. Timing the dense teaching example says little about a sparse device implementation.

Checkpoint. A single-precision filter and double-precision QR produce \(\|I-X^*X\|\approx10^{-15}\) but a verified residual of \(10^{-6}\). These diagnostics can coexist: one measures internal geometry of the basis, the other tests its relation to \(A\).

22.11 Session 10 — From a contraction factor to a verified eigenspace

Construct a problem with known answers

Take \(n=32\) and the orthonormal discrete cosine basis \(U\). Its zeroth column is constant \(1/\sqrt n\), and for row \(i=0,\ldots,n-1\) and column \(j=1,\ldots,n-1\) its entry is \(\sqrt{2/n}\cos(\pi(i+1/2)j/n)\). Set \(A=U\Lambda U^T\) with 29 equally spaced unwanted eigenvalues from \(1\) to \(5\) and targets \(8,9,10\). The dense rotation is deliberate: rounding a diagonal example can preserve exact zeros and hide leakage between directions. The exact mathematical construction and its stored floating-point realization differ slightly.

For each target eigenvector take its equal mixture with a different unwanted eigenvector. Pair \(8\) with \(5\), \(9\) with \(1\), and \(10\) with the second-smallest eigenvalue. These three vectors are orthonormal. Each angle is initially \(\pi/4\). For the pair determining the worst angle the power multiplier ratio is \(5/8\) and the degree-three Chebyshev ratio is \(1/55\). All other ratios are smaller. The graph estimate is attained, so the predicted largest tangents are exactly \((5/8)^k\) and \(55^{-k}\) in mathematical arithmetic. Convert a tangent \(t\) to a sine by \(t/\sqrt{1+t^2}\) before comparing with the lab’s sine diagnostic.

Each outer step applies the chosen operator, orthogonalizes, solves the projected eigenproblem, and checks the residuals in the original coordinates. The lab retains the QR basis for the next step; rotating it to the Ritz basis gives the same next range in exact arithmetic. It records the largest column residual, largest sine, maximum sorted Ritz-value error and orthogonality defect. Only the synthetic example supplies the exact target basis and exact target values. In applications, identification and separation must come from other information.

Predict before running

Experiments E and I use this paired start to isolate the boundary eigenvalue ratio. Experiment J uses a common random block so the Krylov trial space can reach the entire spectrum. Compare verified residual, orientation and work at the first accepted step. A residual check alone would accept an exact invariant plane at the wrong end of the spectrum. In this reference problem the midpoint between 5 and 8 supplies a cluster identification check.

Transfer to a variational PDE problem

In §6.11, \(Kx=\lambda Mx\) came from testing \(-u''=\lambda u\) with finite-element basis functions. Assume \(K=K^*\), \(M=M^*>0\) and \(M=LL^*\). Set \(y=L^*x\) and \(C=L^{-1}KL^{-*}\). Then \(Cy=\lambda y\) is Hermitian, \(\|y\|^2=x^*Mx\), and \[ Cy-\theta y=L^{-1}(Kx-\theta Mx). \] For an \(M\)-normalized approximate eigenvector, \(\|Kx-\theta Mx\|_{M^{-1}}\) is precisely the Euclidean residual norm of the transformed problem. Solve triangular systems to apply the transformations. An \(M\)-orthonormal trial basis \(X\) gives the small matrix \(X^*KX\) and the Ritz residual satisfies \(X^*(KX-MXH)=0\). These are the Galerkin test equations again. A verified algebraic residual certifies the discrete eigenproblem. Errors due to the mesh and the choice of trial functions require an additional approximation argument.

Checkpoint. Why can a change of finite-element basis alter the Euclidean norm of a residual without changing the mathematical approximation? The residual represents a functional; its coordinates and the mass Gram matrix transform together. The dual norm accounts for both changes.

22.12 Exercises and worked solutions

Try each problem before reading its solution. Problems 4, 6, 8 and 11 form a short proof-reconstruction route into the seminar.

1. Which data are allowed to move?

For \(A=\operatorname{diag}(1,10^{-6})\), \(b=e_1\) and \(\hat x=(1,1)^T\), find the minimum absolute normwise perturbations when (i) only \(b\) may move, (ii) only \(A\) may move. Compare with the relative forward error.

Solution. The residual is \((0,-10^{-6})^T\). The new right side is forced to be \(A\hat x\), so its distance is \(10^{-6}\). For a matrix change \(E\hat x=r\), the lower bound is \(\|r\|/\|\hat x\|=10^{-6}/\sqrt2\). It is attained by \(E=r\hat x^*/\|\hat x\|^2\). The exact \(x=e_1\) gives relative forward error \(1\). Backward error has meaning only after specifying the allowed data and norm.

2. A Rayleigh quotient can conceal an inaccurate vector

For \(A_0\) take \(x=(q_2+0.01q_3)/\sqrt{1.0001}\). Compute the quotient error relative to \(3\) in absolute units, the residual norm and the sine to \(q_2\).

Solution. With \(t=0.01\), \(\rho=(3+9t^2)/(1+t^2)\), so the absolute error is \(6t^2/(1+t^2)\approx 0.000600\). The two residual coordinates in the eigenbasis are \((3-\rho)/\sqrt{1+t^2}\) and \((9-\rho)t/\sqrt{1+t^2}\). Squaring and adding gives \(6t/(1+t^2)\approx0.059994\) for the norm. The sine is \(t/\sqrt{1+t^2}\approx0.0099995\). To call the quotient error relative, one would divide it by \(3\).

3. A backward error with symmetry

For \(A=\operatorname{diag}(1,3)\), \(x=(1,1)^T/\sqrt2\), find an optimal Hermitian perturbation for its Rayleigh quotient.

Solution. \(\theta=2\), \(r=(-1,1)^T/\sqrt2\), \(\|r\|=1\). Expanding \(-rx^*-xr^*\) gives \(\operatorname{diag}(1,-1)\). The corrected matrix is \(2I\), so \((2,x)\) is exact. Any admissible \(E\) has \(\|E\|\ge\|Ex\|=1\), proving optimality. The perturbation merges two simple eigenvalues; the backward-error condition imposes no constraint on multiplicities.

4. Fixed versus adaptive inverse iteration

In a two-dimensional Hermitian eigenspace mixture take \(x=(u_1+t u_2)/\sqrt{1+t^2}\), real \(t\ne0\), and distinct eigenvalues. Derive exactly the new signed coefficient ratio under RQI.

Solution. \(\rho=(\lambda_1+t^2\lambda_2)/(1+t^2)\). The new ratio equals \(t(\lambda_1-\rho)/(\lambda_2-\rho)=-t^3\). Thus the tangent cubes even with the sign change. A fixed shift produces \(t(\lambda_1-\sigma)/(\lambda_2-\sigma)\) instead. Starting at \(t=1\) gives a two-cycle in the line for RQI, illustrating the locality of the convergence statement.

5. A block that cannot recover its target

For \(A_0\) target \(\operatorname{span}(q_2,q_3)\) and start with \([q_1,q_3]\). Predict the residuals and the sine of the largest target angle after any number of power steps.

Solution. Multiplication and QR preserve the starting invariant plane. Both Ritz residuals are zero, whereas \(q_1\) is orthogonal to the target plane and the largest sine is one. In target coordinates the overlap matrix has rank one. The invertibility hypothesis in the graph argument fails. This is why stopping on residuals requires an eigenvalue selection or cluster identification rule as well.

6. From an approximate Arnoldi relation to a trustworthy residual

Suppose \(AV=VH+hve_m^*+F\), \(\|v\|=1\), and \(Hy=\theta y+s\) with \(\|y\|=1\). Bound the lifted residual and explain the role of \(\|Vy\|\).

Solution. Substitution gives \((A-\theta I)Vy=hve_m^*y+Vs+Fy\). By the reverse triangle inequality its norm differs from \(|h|\,|e_m^*y|\) by at most \(\|V\|\|s\|+\|F\|\). To report the residual for a unit vector divide by \(\|Vy\|\). If \(\|V^*V-I\|\le\epsilon<1\) then \(\sqrt{1-\epsilon}\le\|Vy\|\le\sqrt{1+\epsilon}\). A shortcut reporting zero can coexist with a nonzero direct residual when the recurrence has a defect.

7. Designing a degree

For an unwanted interval \([1,5]\), a nearest target at \(8\), and a desired one-step angle contraction \(10^{-3}\), find the smallest degree certified by the interval bound.

Solution. \(z_*=(8-3)/2=2.5\). Successive values \(T_j(2.5)\) are \(1,2.5,11.5,55,263.5,1262.5\) by the recurrence. Since the requirement is \(T_d(2.5)\ge1000\), the first sufficient degree is five. Degrees lower than five might meet the goal on a particular starting block if the most weakly amplified target component carries no error, but the interval certificate is uniform.

8. Endpoint accumulation

Consider the scalar recurrence with \(B=1\), exact initial value, and the same additive defect \(f\) at every computed step starting with step one. Find the exact error after \(d\) steps. Compare it with a single defect only at step one.

Solution. \(U_k(1)=k+1\) by induction. Summation gives \(f\sum_{j=1}^d(d-j+1)=fd(d+1)/2\). A single first defect gives \(df\). The polynomial endpoint satisfies \(|T_d(1)|=1\), yet perturbations in recurrence evaluation can accumulate quadratically with degree. Using a uniform bound \(\|F_j\|\le |f|\) attains equality in this example.

9. Verification with a mass matrix

Let \(M=\operatorname{diag}(4,1)\), \(K=\operatorname{diag}(4,3)\), \(x=(1/2,1)^T/\sqrt2\). Determine the generalized Rayleigh quotient and the dual residual norm.

Solution. \(x^*Mx=1\), \(x^*Kx=2\). Thus \(r=Kx-2Mx=(-2,1)^T/\sqrt2\). The Euclidean norm is \(\sqrt{5/2}\), whereas \(r^*M^{-1}r=(1+1)/2=1\). Under \(L=\operatorname{diag}(2,1)\) the transformed matrix is \(\operatorname{diag}(1,3)\), \(y=(1,1)^T/\sqrt2\), and its Euclidean residual norm is exactly one.

10. Distinguishing a measured floor from a theorem

Suppose \(t_{k+1}\le0.1t_k+10^{-7}\). Can one prove that \(t_k\) can never fall below \(10^{-7}\)? For \(t_0=1\) bound \(t_8\).

Solution. The zero sequence after step zero obeys the inequality, so it supplies no lower bound. Repeated substitution gives \(t_8\le10^{-8}+10^{-7}(1-10^{-8})/0.9\approx1.21\,10^{-7}\). A measured history that levels off there is consistent with this model. A smaller measured value is equally consistent.

11. A filter written in terms of its residual

With \(p(z)=4z^3-3z\), derive a correction formula involving \(r=Ax-\theta x\). Which products would you evaluate accurately if the requested tolerance is much smaller than the filter’s working unit roundoff?

Solution. Polynomial division gives \(s_\theta(z)=4(z^2+\theta z+\theta^2)-3\), hence \(p(A)x=p(\theta)x+[4(A^2+\theta A+\theta^2 I)-3I]r\). Compute the initial residual using the original operator in verification precision and accumulate the correction accurately. Products on the correction may tolerate lower precision since their absolute errors can scale with \(\|r\|\). This conclusion requires bounds on the correction operator, conversion errors and dynamic range. A small \(\|r\|\) does not authorize treating its relative error as small automatically.

12. Design an equal-work comparison

For the case study, compare one degree-three application with three ordinary power steps from the same start. Which conclusion follows before any timing experiment?

Solution. Both use three matrix–block products. The respective largest tangents are \(1/55\approx0.01818\) and \((5/8)^3=125/512\approx0.24414\). The filter gives the smaller angle for this spectrum, block and work metric. Three ordinary outer steps may perform more QR and extraction operations. Timing must specify their frequency, data movement, precision, matrix layout and verification tolerance. Neither theoretical ratio determines the faster implementation on a given machine.

13. Reconstruct the four proof steps behind a filtered solver

Without using the final estimates, (a) deduce inclusion from a spectral expansion, (b) compare the ordered spectra of \(A\) and \(A+E\) using test spaces, (c) turn a block in eigen-coordinates into a graph after filtering, and (d) isolate a single recurrence defect inserted at step \(j\). Which step fails if a computed output is substituted directly for the exact polynomial?

Solution. (a) For a unit vector, the squared residual is a weighted average of \(|\lambda_i-\theta|^2\) with weights \(|u_i^*x|^2\). Its minimum term is at most its average. (b) Every unit-vector quotient changes by an amount between \(-\|E\|\) and \(\|E\|\). Taking the maximum on each \(i\)-plane preserves the bounds; taking the minimum over planes proves both sides for the \(i\)th smallest eigenvalue. (c) With wanted and unwanted blocks \(C,D\), the filtered basis has blocks \(P_1C,P_2D\). Multiplication on the right by \((P_1C)^{-1}\) gives graph \(P_2 DC^{-1}P_1^{-1}\), so submultiplicativity bounds its norm by \((\beta/\alpha)\|DC^{-1}\|\). Invertibility of both wanted factors is essential. (d) Starting from zero error, one defect contributes \(F_j\) at \(j\), \(2BF_j\) at \(j+1\), then \((4B^2-I)F_j\). Induction produces \(U_{d-j}(B)F_j\). Linearity superposes defects. In (c) computed blocks contain additive errors and the exact factorization no longer holds. A lower bound on the smallest singular value of the perturbed wanted block is now necessary.

22.13 Computational laboratory — From one rounded sum to a verified cluster

Run the cells in order. Each experiment poses a question with an analytical reference. The examples use real symmetric matrices so transpose suffices. Matrix products use the installed NumPy backend. All reference residuals and all QR and Ritz operations use binary64 unless explicitly indicated. Reported residuals are absolute, for unit vectors.

import numpy as np
import scipy.linalg as la
import matplotlib.pyplot as plt
from numpy.polynomial.chebyshev import chebval

def orth(block):
    if not np.isfinite(block).all():
        raise FloatingPointError("nonfinite basis input")
    q, r = la.qr(block, mode="economic")
    singular = la.svdvals(r)
    if singular[-1] <= max(block.shape) * np.finfo(block.dtype).eps * singular[0]:
        raise ValueError("block has lost numerical rank")
    return q

def norm2(x):
    return la.norm(x, 2)

def symmetric(a):
    return (a + a.T) * 0.5

def response(z, degree):
    return chebval(z, [0] * degree + [1])

def ritz(a, basis, count):
    compressed = symmetric(basis.T @ (a @ basis))
    values, weights = la.eigh(compressed)
    vectors = basis @ weights[:, -count:]
    values = values[-count:]
    residuals = la.norm(a @ vectors - vectors * values, axis=0)
    return values, vectors, residuals

def plot_history(ax, data, label):
    ax.semilogy(np.arange(len(data)), np.maximum(data, 1e-18), label=label)
    ax.set_xlabel("Iteration")

A. Which digits did cancellation expose?

The sum \(1+2^{-25}\) lies closer to one than to its binary32 successor. The small singular value in the second example is an independent source of lost forward accuracy. We measure both using data whose mathematical answers are known.

one = np.float32(1)
tiny = np.float32(2.0**-25)
print("Rounded increment, exact increment:", (one + tiny) - one, tiny)
small = np.diag([1., 1e-8])
b = np.array([1., 0.])
xhat = np.ones(2)
print("Relative residual, relative forward error, condition:",
      norm2(b - small @ xhat) / norm2(b), norm2(xhat - b), np.linalg.cond(small))
Rounded increment, exact increment: 0.0 2.9802322e-08
Relative residual, relative forward error, condition: 1e-08 1.0 100000000.0

The first result is zero. In the second experiment the residual \(10^{-8}\) and condition number \(10^8\) attain the bound in Session 2. The displayed candidate was chosen deliberately. This tests the sharpness of an estimate and says nothing about the stability of a particular linear solver.

B. Can we move a Hermitian eigenvalue farther than the perturbation?

Rotate a prescribed spectrum and apply a positive rank-one perturbation. The triangle inequality behind Weyl permits the full perturbation norm. Equality would require favorable alignment with an extremal direction.

rng = np.random.default_rng(20261118)
n, p = 32, 3
i, j = np.indices((n, n))
U = np.sqrt(2/n) * np.cos(np.pi * (i + .5) * j / n)
U[:, 0] = 1 / np.sqrt(n)
spectrum = np.r_[np.linspace(1, 5, n-p), [8., 9., 10.]]
A = symmetric((U * spectrum) @ U.T)
target, outside = U[:, -p:], U[:, :-p]
assert norm2(U.T @ U - np.eye(n)) < 1e-12
w = rng.normal(size=n)
w /= norm2(w)
E = 1e-4 * np.outer(w, w)
newvals, newvec = la.eigh(A + E)
change = np.max(abs(newvals - la.eigvalsh(A)))
print("Max shift, perturbation norm:", change, norm2(E))
print("Max residual on original and perturbed matrices:",
      la.norm(A @ newvec - newvec * newvals, axis=0).max(),
      la.norm((A+E) @ newvec - newvec * newvals, axis=0).max())
assert change <= norm2(E) + 1e-12
Max shift, perturbation norm: 1.999035056154952e-05 0.00010000000000000003
Max residual on original and perturbed matrices: 4.4711375986704965e-05 7.625702338003613e-15

The two residuals test different equations. On the original operator the exact residual of a perturbed eigenvector equals \(-Ev\). On the perturbed operator only eigensolve and verification errors remain. The comparison with the eigenvalues of stored \(A\) isolates the applied perturbation from the initial cosine-basis construction.

C. Which changes more, an eigenvector or its cluster?

Apply the same off-diagonal perturbation to gaps decreasing by eight orders of magnitude. The exact angle of the lowest eigenvector to the first coordinate is half an arctangent. The two-dimensional target plane is invariant throughout.

eps = 1e-5
print("gap       measured sine   exact sine     residual/gap*   plane sine")
for gap in [1., 1e-2, 1e-4, 1e-6, 1e-8]:
    base = np.diag([1., 1.+gap, 5.])
    changed = base.copy()
    changed[0, 1] = changed[1, 0] = eps
    vals, vecs = la.eigh(changed)
    v = vecs[:, 0]
    delta = 1 + gap - vals[0]
    posterior = norm2(base @ v - vals[0]*v) / delta
    print(f"{gap:.0e}    {abs(v[1]):.4e}     "
          f"{np.sin(.5*np.arctan2(2*eps,gap)):.4e}    "
          f"{posterior:.4e}      {norm2(vecs[2, :2]):.1e}")
gap       measured sine   exact sine     residual/gap*   plane sine
1e+00    1.0000e-05     1.0000e-05    1.0000e-05      0.0e+00
1e-02    1.0000e-03     1.0000e-03    1.0000e-03      0.0e+00
1e-04    9.8538e-02     9.8538e-02    9.9020e-02      0.0e+00
1e-06    6.8923e-01     6.8923e-01    9.5125e-01      0.0e+00
1e-08    7.0693e-01     7.0693e-01    9.9950e-01      0.0e+00

Here “gap*” is the distance from the perturbed eigenvalue to the original unwanted spectrum. The angle approaches \(\pi/4\) as the internal gap closes. The zero plane error results from the location of the perturbation. A perturbation coupling the plane to the third coordinate would instead test its external gap.

D. What changes when the shift follows the vector?

Target the eigenvalue \(9\) in the diagonal coordinates of \(A_0\). A two-component start makes the predicted power and fixed-shift tangent factors \(1/3\) and \(1/11\) respectively (shift \(8.5\)). RQI cubes the tangent until the accuracy of the quotient or the shifted solve intervenes.

diag = np.diag([1., 3., 9.])
def vector_run(method):
    x = np.array([0., .5, 1.])
    x /= norm2(x)
    fixed = la.lu_factor(diag - 8.5*np.eye(3))
    rows = []
    for k in range(40):
        value = x @ diag @ x
        residual = norm2(diag @ x - value*x)
        rows.append([abs(value-9), residual, norm2(x[:2])])
        if residual < 1e-13:
            break
        if method == "power":
            y = diag @ x
        elif method == "fixed":
            y = la.lu_solve(fixed, x)
        else:
            # At a rounded eigenvalue use an adjacent representable shift.
            shift = np.nextafter(value, np.inf) if value in diag.diagonal() else value
            y = np.linalg.solve(diag - shift*np.eye(3), x)
        if not np.isfinite(y).all() or norm2(y) == 0:
            raise FloatingPointError("invalid vector update")
        x = y / norm2(y)
    return np.array(rows)

fig, axes = plt.subplots(1, 3, figsize=(9, 3), constrained_layout=True)
for method in ["power", "fixed", "RQI"]:
    rows = vector_run(method)
    for col, ax in enumerate(axes):
        plot_history(ax, rows[:, col], method)
for ax, title in zip(axes, ["Value error", "Residual norm", "Sine of angle"]):
    ax.set_title(title)
axes[0].legend()
plt.show()
Figure 22.1: Error in the Ritz value, original residual and angle to the target. Values below the plotting threshold are drawn at the threshold.

A rounded value can appear exact while the residual still decreases. Read the residual and angle panels together. RQI has fewer steps here, but each new shift normally costs another factorization. A diagonal example cannot measure that cost on a sparse matrix.

E. Does block iteration attain the graph bound?

Use the paired start from Session 10. The largest principal angle should be controlled by the \(5,8\) pair even if QR rotates the individual columns. Compare measured sines with the prediction for tangents converted to sines.

paired = (target + outside[:, [-1, 0, 1]]) / np.sqrt(2)
def metrics(basis):
    values, vectors, residuals = ritz(A, basis, p)
    return [max(residuals), norm2(outside.T @ vectors),
            norm2(vectors.T @ vectors - np.eye(p)),
            np.max(abs(values - spectrum[-p:])), values.min()]

Q = paired.copy()
print("step    measured sine   predicted sine   orthogonality")
for step in range(13):
    measured = metrics(Q)
    t = (5/8)**step
    if step % 3 == 0:
        print(f"{step:3}     {measured[1]:.6e}    {t/np.hypot(1,t):.6e}    {measured[2]:.1e}")
    Q = orth(A @ Q)
step    measured sine   predicted sine   orthogonality
  0     7.071068e-01    7.071068e-01    1.6e-15
  3     2.371746e-01    2.371746e-01    4.4e-16
  6     5.949905e-02    5.949905e-02    8.9e-16
  9     1.455037e-02    1.455037e-02    3.0e-16
 12     3.552691e-03    3.552691e-03    6.8e-16

Agreement tests a worst-case construction where the estimate is attained. For a generic start the most persistent graph entry can have a small initial coefficient. A slower or faster transient than this example would then be consistent with the same upper bound.

F. When can the final Krylov coefficient be trusted?

Build Arnoldi using two projection passes. Switch to the three-term recurrence for a Hermitian operator and compare orthogonality with and without a second projection against the entire basis. The rank-one tail is retained explicitly, so the code handles an invariant space without dividing by a zero subdiagonal.

def krylov(a, start, m, lanczos=False, repair=False):
    nloc = len(start)
    V = np.zeros((nloc, m+1))
    H = np.zeros((m+1, m))
    V[:, 0] = start / norm2(start)
    for j in range(m):
        basis = V[:, :j+1]
        w = a @ V[:, j]
        if lanczos:
            if j:
                H[j-1, j] = H[j, j-1]
                w -= H[j-1, j] * V[:, j-1]
            H[j, j] = V[:, j] @ w
            w -= H[j, j] * V[:, j]
            if repair:
                # Keep the correction coefficients in the recorded relation.
                correction = basis.T @ w
                w -= basis @ correction
                H[:j+1, j] += correction
        else:
            for _ in range(2):
                h = basis.T @ w
                w -= basis @ h
                H[:j+1, j] += h
        beta = norm2(w)
        H[j+1, j] = beta
        if beta <= 1e-14 or j+1 == m:
            return basis, H[:j+1, :j+1], w
        V[:, j+1] = w/beta

vstart = rng.normal(size=n)
general = A + .25*np.triu(np.ones_like(A), 1)
print("method            orth defect    relation defect   Ritz check error")
for name, mat, short, repair in [
        ("Arnoldi", general, False, False),
        ("Lanczos", A, True, False),
        ("Lanczos+repair", A, True, True)]:
    V, H, tail = krylov(mat, vstart, 28, short, repair)
    defect = mat @ V - V @ H
    defect[:, -1] -= tail
    vals, Y = la.eig(H)
    lifted = V @ Y
    direct = la.norm(mat @ lifted - lifted*vals, axis=0)
    predicted = norm2(tail)*abs(Y[-1])
    print(f"{name:16}  {norm2(V.T@V-np.eye(V.shape[1])):.2e}       "
          f"{norm2(defect):.2e}         {max(abs(direct-predicted)):.2e}")
method            orth defect    relation defect   Ritz check error
Arnoldi           4.44e-16       2.02e-15         9.36e-15
Lanczos           1.00e+00       2.64e-15         2.80e-14
Lanczos+repair    5.29e-16       1.98e-15         2.75e-14

A small recurrence defect can coexist with a large orthogonality defect. The last column tests the unnormalized lifted residual, as in Exercise 6. Trusting Ritz values as eigenvalues of an orthogonal compression requires the geometric test as well. The repaired variant stores tiny off-tridiagonal correction coefficients. A run showing loss of orthogonality demonstrates a mechanism allowing ghost values, without proving a duplicate occurs in every spectrum.

G. What if the interval misses an unwanted mode?

Choose an upper target at \(8\) and vary the assumed enclosing interval. Degree enlarges the exterior response on both sides. Inspect the entire unwanted spectrum before accepting a filter design.

fig, axes = plt.subplots(1, 2, figsize=(8, 3), constrained_layout=True)
grid = np.linspace(1, 10, 501)
for ax, (lo, hi) in zip(axes, [(1, 5), (3.5, 5)]):
    def mapped(x):
        return (2*x-lo-hi)/(hi-lo)
    for d in [1, 3, 5]:
        scale = abs(response(mapped(8.), d))
        curve = abs(response(mapped(grid), d)) / scale
        ax.semilogy(grid, np.maximum(curve, 1e-5), label=f"d={d}")
        factor = max(abs(response(mapped(spectrum[:-p]), d))) / scale
        print((lo, hi), d, "actual ratio", round(factor, 5))
    ax.axvspan(1, 5, alpha=.12)
    ax.axhline(1, color="gray", lw=.7)
    ax.set(title=f"Design [{lo}, {hi}]", xlabel="Eigenvalue", ylabel="Normalized magnitude")
axes[0].legend()
plt.show()
(1, 5) 1 actual ratio 0.4
(1, 5) 3 actual ratio 0.01818
(1, 5) 5 actual ratio 0.00079
(3.5, 5) 1 actual ratio 0.86667
(3.5, 5) 3 actual ratio 0.64429
(3.5, 5) 5 actual ratio 0.48062
Figure 22.2: Absolute filter response normalized at the weakest target. Shading marks the actual unwanted spectrum’s interval.

The erroneous interval amplifies low unwanted values. In this example the weakest target still wins, so the consequence is slower convergence. For a genuine reversal, change the left endpoint to \(4.5\) while keeping the right endpoint \(5\). The distances from the midpoint \(4.75\) are \(3.75\) for the unwanted \(1\) and \(3.25\) for the wanted \(8\), so the unwanted multiplier exceeds the weakest wanted multiplier at every positive degree.

H. Where does a local filter defect go?

Measure the actual defects of binary32 recurrence steps by replaying their operands in binary64. Propagate each defect in the known cosine eigenbasis. Compare the resulting bound with the error in the unwanted projection and the full relative output error. The reference is spectral evaluation in binary64. Degree 12 keeps the unscaled values in range.

B = symmetric((A - 3*np.eye(n))/2)
z = (spectrum - 3)/2
def second(z, k):
    previous, current = np.zeros_like(z), np.ones_like(z)
    for _ in range(k):
        previous, current = current, 2*z*current-previous
    return current

stored = B.astype(np.float32)
x0 = paired.astype(np.float32)
Y = [x0, stored @ x0]
local = [Y[1].astype(float) - B @ x0.astype(float)]
print("degree  relative error   unwanted error   projected envelope")
for d in range(1, 13):
    if d >= 2:
        y = 2*(stored @ Y[-1])-Y[-2]
        local.append(y.astype(float) - (2*(B @ Y[-1].astype(float))-Y[-2]))
        Y.append(y)
    weights = response(z, d)
    reference = U @ (weights[:, None]*(U.T @ paired))
    err = Y[d].astype(float) - reference
    initial = outside.T @ (x0.astype(float)-paired)
    envelope = norm2(weights[:-p, None]*initial)
    for j, defect in enumerate(local, start=1):
        envelope += norm2(second(z[:-p], d-j)[:, None]*(outside.T @ defect))
    measured = norm2(outside.T @ err)
    print(f"{d:4}    {norm2(err)/norm2(reference):.3e}       {measured:.3e}       {envelope:.3e}")
    # The ideal cosine basis and the stored B differ by binary64 construction error.
    assert measured <= envelope + 5e-13*norm2(reference)
degree  relative error   unwanted error   projected envelope
   1    1.238e-07       3.055e-07       3.276e-07
   2    1.312e-07       2.061e-06       2.384e-06
   3    1.193e-07       1.144e-05       1.366e-05
   4    9.896e-08       5.785e-05       7.546e-05
   5    1.288e-07       6.286e-04       7.140e-04
   6    1.181e-07       3.772e-03       4.198e-03
   7    1.170e-07       2.145e-02       2.576e-02
   8    1.506e-07       1.720e-01       1.908e-01
   9    1.693e-07       1.136e+00       1.352e+00
  10    1.973e-07       1.010e+01       1.131e+01
  11    1.991e-07       5.213e+01       6.343e+01
  12    1.876e-07       2.455e+02       3.016e+02

The first line already includes conversion of the starting block. At higher degree, the stage operands have grown and even late local defects can be large in absolute units. The sum of projected norms discards cancellation. Its comparison is a diagnostic up to reference rounding, whereas the exact-arithmetic identity in Session 8 is a theorem. Relative full-block error and absolute unwanted leakage answer different questions.

I. Which precision limits the final residual?

Hold QR, Rayleigh–Ritz and residual verification fixed at binary64. Change only the filter. The third configuration rounds the mapped matrix and each stage output to binary16 and promotes them for binary64 products and updates. It simulates storage quantization and deliberately avoids any claim about native half-precision accumulation. Degree three fits the exponent range here.

def filter_block(mapped_matrix, X, degree, mode):
    if mode == "FP64":
        dtype = np.float64
    elif mode == "FP32":
        dtype = np.float32
    elif mode == "FP16 storage":
        dtype = np.float16
    else:
        raise ValueError(mode)
    def store_stage(value):
        converted = value.astype(dtype)
        if not np.isfinite(converted).all():
            raise FloatingPointError("filter exceeded storage range")
        return converted.astype(float) if dtype == np.float16 else converted
    matrix, prev = store_stage(mapped_matrix), store_stage(X)
    if degree == 0:
        return prev.astype(float)
    curr = store_stage(matrix @ prev)
    for _ in range(2, degree+1):
        prev, curr = curr, store_stage(2*(matrix @ curr)-prev)
    return curr.astype(float)

# The reference spectral norm is ten in the mathematical construction.
def accepted(row):
    return row[0] <= 1e-10 and row[2] <= 1e-12 and row[4] > 6.5

histories = {}
for mode in ["FP64", "FP32", "FP16 storage"]:
    Q = paired.copy()
    history = [metrics(Q)]
    for _ in range(14):
        Q = orth(filter_block(B, Q, 3, mode))
        history.append(metrics(Q))
    histories[mode] = np.array(history)
    first = next((k for k, row in enumerate(history) if accepted(row)), None)
    print(mode, "first accepted:", first, "last residual, sine, orthogonality:",
          np.array(history[-1][:3]))
FP64 first accepted: 7 last residual, sine, orthogonality: [4.15430599e-15 9.39035302e-15 9.45581769e-16]
FP32 first accepted: None last residual, sine, orthogonality: [8.01954321e-07 1.25260796e-07 4.53344735e-16]
FP16 storage first accepted: None last residual, sine, orthogonality: [1.25977060e-03 2.76888181e-04 7.10140921e-16]
fig, axes = plt.subplots(1, 3, figsize=(9, 3), constrained_layout=True)
for label, history in histories.items():
    for j, ax in enumerate(axes):
        plot_history(ax, history[:, j], label)
t = 55.**(-np.arange(15))
axes[1].semilogy(t/np.hypot(1,t), "k--", label="exact")
for ax, title in zip(axes, ["Max residual", "Largest principal sine", "Orthogonality defect"]):
    ax.set_title(title)
axes[0].legend(fontsize=8)
plt.show()
Figure 22.3: A common binary64 verifier applied to three filter configurations. The dashed line is the exact paired-start sine.

In Figure 22.3 the vertical separation between the residual curves can be large even when the orthogonality curves overlap. QR can restore orthogonality within the range it receives. It cannot undo rotation of that range by a quantized operator. Inspect several late points before calling a plateau. A repeatable nonzero residual with higher-precision verification is evidence about this configuration, not a universal lower bound for a format.

J. Which method reaches the same verified cluster with the least operator work?

Use the same random three-column start for all methods and the same cluster threshold and stopping predicate from I. Block Krylov extends the orthogonal trial space with the latest block action. The final extension may contain fewer than three independent vectors, so an SVD selects the surviving directions. At every extraction we charge one operator action per basis column for projection and three fresh actions for direct verification. This intentionally transparent implementation recomputes the compression. A production implementation can cache earlier products.

start = orth(np.random.default_rng(41).normal(size=(n,p)))
print("method       steps   iteration AVs   assessment AVs   residual   sine      orth      status")
for method in ["ordinary", "Chebyshev", "block Krylov"]:
    Q, front = start.copy(), start.copy()
    iteration_work = assessment_work = 0
    for step in range(101):
        row = metrics(Q)
        assessment_work += Q.shape[1] + p
        if accepted(row) or step == 100:
            break
        if method == "block Krylov":
            W = A @ front
            iteration_work += front.shape[1]
            for _ in range(2):
                W -= Q @ (Q.T @ W)
            uvec, sv, _ = la.svd(W, full_matrices=False)
            keep = sv > 100*np.finfo(float).eps*10
            if not keep.any():
                break
            front = uvec[:, keep]
            Q = np.column_stack((Q, front))
        elif method == "ordinary":
            Q = orth(A @ Q)
            iteration_work += p
        else:
            Q = orth(filter_block(B, Q, 3, "FP64"))
            iteration_work += 3*p
    print(f"{method:12} {step:4}       {iteration_work:4}           {assessment_work:4}       "
          f"{row[0]:.1e}  {row[1]:.1e}  {row[2]:.1e}  "
          f"{'met' if accepted(row) else 'unmet'}")
method       steps   iteration AVs   assessment AVs   residual   sine      orth      status
ordinary       51        153            312       7.6e-11  2.5e-11  4.8e-16  met
Chebyshev       7         63             48       3.8e-12  8.8e-13  6.8e-16  met
block Krylov   10         30            230       1.2e-14  9.4e-15  1.4e-15  met

“AVs” counts single-vector equivalents. One degree-three application to a width-three block costs nine. The scaled dense \(B\) is formed once outside the iteration. Cost columns exclude one-time setup, basis operations, small dense solves and the reference-only angle calculation. The Krylov method can reach the full space on this small example, at which point a projected eigensolve is essentially a dense solve. A sparse production study would limit basis size, count restarts, and measure communication. The table can establish accuracy and work for these particular implementations. It cannot establish a hardware speedup.

22.14 Synthesis — What makes the computation reliable?

Module A’s direct sum provides the coordinates \(\binom{C}{D}\) in which algorithmic convergence becomes a graph contraction. Module B explains both why left eigenvectors measure perturbations and why Ritz tests annihilate the trial-space residual. Module C makes these tests computable through inner products and makes “close” precise through orthogonal projection. Module D diagonalizes a polynomial of a Hermitian operator. Module E uses all four results twice: first to choose the algorithm, then to decide what its output warrants. The hypotheses in the middle column below are as important as the formulas.

Quantity or result Hypotheses Interpretation
\(\gamma_n\lvert A\rvert\lvert x\rvert\) Sequential real matvec, \(nu<1\), normal-range model Componentwise absolute error envelope
\(\min\|E\|=\|r\|\) Unit \(x\), unrestricted matrix perturbation Price of making the approximate pair exact
\(\operatorname{dist}(\theta,\sigma(A))\le\|r\|\) Hermitian or normal \(A\), unit vector Existence of a nearby eigenvalue
\(\|(I-P)x\|\le\|r\|/\delta\) Hermitian \(A\), unwanted spectrum separated from \(\theta\) Target-space angle certificate
\(\tan t_k\le\rho^k\tan t_0\) Self-adjoint filter, full overlap, \(\rho=\beta/\alpha<1\) Block convergence across a cluster boundary
\(X^*(AX-XH)=0\) \(X^*X=I\), \(H=X^*AX\) Galerkin orthogonality
\(\|r_{\mathrm{Ritz}}\|=h_{m+1,m}\lvert e_m^*y\rvert\) Exact Arnoldi relation, normalized projected eigenpair Cheap residual estimate
\(\sum_{j=1}^d U_{d-j}(B)F_j\) Unscaled recurrence, fixed \(B\), exact initialization Total error from local filter defects
\(\|L^{-1}(Kx-\theta Mx)\|\) \(M=LL^*>0\), \(x^*Mx=1\) Residual in the correct variational geometry

Choosing an algorithm from the spectral information available

Method What information and overlap does it need? Main work and likely limitation
Power Unique largest modulus with a nonzero initial coefficient One product per step. Nearly equal moduli make the ratio close to one.
Fixed inverse Unique closest eigenvalue to a shift outside the spectrum Reusable factorization and one solve per step. Fill-in can dominate sparse storage.
RQI Start near a simple Hermitian eigenpair, with solvable shifted systems Local cubic angle convergence. A new factorization may be needed each step.
Block power Full-rank overlap with a dominant cluster and a gap in magnitude across its boundary One block product and QR. A weakly represented wanted direction can disappear.
Arnoldi Krylov start sees the target. A small residual and identification validate extraction Increasing basis, projection and reductions. Nonnormality weakens residual-based forward guarantees.
Lanczos Hermitian action, starting overlap and a suitably informative Krylov space Three-term generation, possible reorthogonalization and restart. Repeated Ritz values need independent checks.
Chebyshev block Outer spectral bounds, full target overlap and \(\beta/\alpha<1\) Several block products per QR. A missed spectral tail or amplified recurrence defects can dominate.

flowchart TD
    A["Filter and orthogonalize"] --> B["Extract and verify Ritz pairs"]
    B --> C{"Target and residual acceptable?"}
    C -->|Yes| D["Report cluster"]
    C -->|No| E["Check rank, bounds and precision"]
    E --> A

Reading the measured evidence

In one run of Experiment J, ordinary iteration reached tolerance after 51 steps, Chebyshev after 7, and block Krylov after 10 extensions. The iteration-only counts were 153, 63 and 30 vector products. Including the explicit recompression and direct checks changed the totals to 465, 111 and 260. The ordering of the last two methods therefore depends on what work is charged. Caching the basis images would especially change the Krylov count. The acceptance threshold, target and directly verified accuracy must travel with any reported speed comparison.

Experiment F illustrates a different accounting mistake. The unrepaired Lanczos relation had defect about \(2.3\times10^{-15}\) while the basis orthogonality defect reached order one. The recurrence residual formula was still numerically accurate for the unnormalized lifted vectors. It could not certify independent directions. In I the FP32 filter showed the opposite combination of diagnostics: orthogonality near \(4\times10^{-16}\) and an original residual near \(3.8\times10^{-7}\). These examples locate two distinct ways a plausible-looking convergence report can fail.

Verification note. A tolerance must name a quantity and a scale. For example, for this matrix an absolute residual of \(10^{-10}\) is a relative matrix backward error of about \(10^{-11}\) for a unit Ritz vector. To request an angle, also specify which cluster and how its separation is known. To request a wall time, specify the operator, storage layout, precision stages, machine and verification rule.

Integrated problem — Write a numerical acceptance report

You seek the three upper modes in the experiment. The other eigenvalues lie in \([1,5]\), your trial block is orthonormal, every Ritz value is at least \(7.9\), and each of its three residuals is at most \(10^{-7}\). Can you certify a largest principal sine below \(10^{-7}\)? Would this certify each direction to the same tolerance? Predict how many ideal degree-three steps suffice for tangent \(10^{-10}\) from the paired start. Then use Experiments I and J to decide whether FP32 filtering and binary64 verification alone achieved the laboratory acceptance criterion.

Worked solution. The excluded spectrum is at distance at least \(2.9\) from every Ritz value. In the Sylvester argument the Frobenius residual is at most \(\sqrt{3}\,10^{-7}\). Hence the largest principal sine is at most \(\sqrt{3}\,10^{-7}/2.9<6.0\times10^{-8}\). This controls the plane. A vector certificate also requires identifying its particular eigenvalue and separating it from the other two wanted eigenvalues. From \(55^{-k}\le10^{-10}\), take \(k=\lceil10\log(10)/\log(55)\rceil=6\). This is a prediction for the angle; acceptance in J also tests the residual. The FP32 run in I retained good orthogonality but missed the residual criterion. Increasing verification precision diagnoses the computed subspace. Changing the filter or improving the iterate is required to change its true residual.

Mastery checklist

Where to go next

For HASC. Read the seminar recurrence with three quantities on paper: the object being multiplied at each step, the norm in which its product error is bounded, and the factor that transfers this error into the unwanted space. Compare an error proportional to the norm of a full iterate with one proportional to a residual correction. Track which steps require access to the higher-precision operator. In an experiment, maintain a separate column for measured time and another for the verified final residual. This lets you judge a performance claim at a stated mathematical accuracy.

For functional analysis. Orthogonal projections, Rayleigh quotients and bounded polynomials of a bounded self-adjoint operator extend to Hilbert space. A compact self-adjoint operator has an eigen-expansion with possible accumulation at zero, so a uniform positive gap cannot be assumed along its whole spectrum. Differential operators can be unbounded and require domains and boundary conditions. A useful next step is to prove spectral convergence of finite-element approximations using compact solution operators, distinguishing discretization error from iteration error.

For structural algebra. The polynomial action \(p\mapsto p(A)\) and the cyclic quotient by an annihilating ideal explain exact Krylov termination independently of the coordinate basis. An inner product, an error norm and a rounding model add information that an algebraic quotient does not encode. Under a badly conditioned nonunitary change of coordinates the abstract operator is isomorphic while measured sensitivity can change substantially.

Foundation established in principle. After reconstructing the proofs and reproducing the experiment, you have the tools to justify selection, contraction, extraction and verification for finite-dimensional Hermitian problems. Further study includes sharper clustered-subspace bounds, implicit restarting and locking, interior filter design, communication-avoiding QR, sparse generalized eigensolvers with inexact solves, and precision-dependent convergence proofs for a specific residual-based recurrence. Each needs assumptions beyond the elementary graph and residual estimates proved here.