Power iteration eigenpair diagnostics (source code)

= Power iteration eigenpair diagnostics
{title2=$\rho_k=x_k^*Ax_k,\quad r_k=Ax_k-\rho_kx_k$}

For each <unit vector> iterate compute the <Rayleigh quotient> $\rho_k=x_k^*Ax_k$ and the <eigenpair residual> $r_k=Ax_k-\rho_kx_k$. Use the same multiplication $Ax_k$ for both diagnostics and the next normalized iterate. For any complex <matrix>, this <Rayleigh quotient> minimizes $\|Ax_k-\mu x_k\|_2$ over complex <scalars> $\mu$, because $x_k^*r_k=0$. Under <power iteration convergence for a diagonalizable matrix>, $\rho_k\to\lambda_1$ and $\|r_k\|_2\to0$, even when the <vectors> alternate signs or phases.<Numerical Analysis, Spring 2022/Power iteration (2022-03-07 lecture notes)>[§3, PDF p. 3: approximate eigenvector equation and Rayleigh quotient]{ref}

A dimensionless stopping quantity is
$$
\eta_k=\frac{\|r_k\|_2}{\|A\|_2+|\rho_k|},
$$
when the denominator is positive; $\|A\|_2$ is the <operator norm>, and a known upper bound may replace it if computing it is costly. A small <eigenpair residual> certifies a small <backward error of an approximate eigenpair>, but does not establish that the <eigenvalue> found is dominant.

For a <Hermitian matrix> with <orthonormal eigenbasis> $u_j$, write $x_k=\sum_j a_ju_j$. Then the independently useful identity
$$
\|r_k\|_2^2=\sum_j|a_j|^2|\lambda_j-\rho_k|^2
$$
shows that some <eigenvalue> lies within $\|r_k\|_2$ of $\rho_k$. If a specific target <eigenvalue> $\lambda_1$ is separated from all the others by $\delta_k=\min_{j>1}|\lambda_j-\rho_k|>0$, it also gives $\varepsilon_k\le\|r_k\|_2/\delta_k$. This separation is measured from the computed <Rayleigh quotient>; it differs from the dominant-<modulus> <spectral gap>. For a <nonnormal matrix>, the same <orthogonal> expansion is unavailable and a small <eigenpair residual> alone need not imply a comparably small distance to the <spectrum>.