# Harmonic Ritz values visualized

A hopefully insightful visualizion of harmonic Ritz values versus ordinary Ritz values.

June 7, 2017 - 11 minute read -

I thought it would be nice to clarify the previous post with some plots. Take a simple Poisson matrix $A$ of size $n \times n$ with entries $\begin{bmatrix}-1 & 2 & -1\end{bmatrix}$ on the diagonals. We know its eigenvalues are all concentrated in the interval $[0, 4]$ on the real line.

As a preliminary note: I’m not exploiting the symmetry of the matrix in my code. I want to test it on general matrices as well.

At any rate, in Julia we generate this Poisson matrix as

Sometimes Jacobi-Davidson’s search space is initialized with the search space of Arnoldi’s method, namely a Krylov subspace with a random initial vector $v_0$:

$\mathcal{V} = \mathcal{K}_k(A, v_0) = span\{v_0, Av_0, \cdots, A^{k-1}v_0\}.$

The well-known Arnoldi decomposition $AV_k = V_{k+1}H_{k+1,k}$ gives us an orthonormal matrix $V_k$ whose $k$ columns span the search space, and a Hessenberg matrix of size $(k + 1) \times k$. In Julia we can generate these using

Now the ordinary Ritz values $\theta$ are obtained by solving the small eigenvalue problem

$V_k^TAV_ky = H_{k,k}y = \theta y.$

Here the square matrix $H_{k,k}$ is $H_{k+1,k}$ with its last row removed. We can compute and plot the Ritz values for each iteration as follows:

What we get is something like

On the vertical axis we have the iteration (or size of our search space), and horizontally we have the real line. The black stars are the actual eigenvalues, while the green crosses the Ritz values. Now if we were to target interior eigenvalues near $\tau = 3$, we can clearly see that many Ritz values start out near this target, but actually converge away from it. This is undesirable for restarts.

Enter harmonic Ritz values. As shown in the previous post harmonic Ritz values satisfy the Petrov-Galerkin condition

$(A - \tau I)z - \theta z \perp (A - \tau I)V_k \text{ for } z = V_k y.$

Now it’s not hard to verify we can write $(A - \tau I)V_k = V_{k+1}H_{k+1,k}^\tau$ for $H_{k+1,k}^\tau := H_{k+1,k} - \tau I$. Note that the Hessenberg matrix is not square, but by abuse of notation I mean that $\tau$ must be substracted from the diagonal of the Hessenberg matrix. Some more work shows that the Petrov-Galerkin condition is equivalent to solving the generalized eigenvalue problem

$(H^\tau_{k+1,k})^* H^\tau_{k+1,k} y = \theta (H^\tau_{k,k})^* y.$

This can be implemented using:

And produces harmonic Ritz values like this

The point is that harmonic Ritz values come close to our target $\tau$ only when they converge to an eigenvalue near $\tau$.

For restarts this means that retaining harmonic Ritz vectors with harmonic Ritz values close to $\tau$ will be a good strategy. In sharp contrast with ordinary Ritz values, where lots of Ritz values near our target are useless to retain, since they are on their way converging to exterior eigenvalues.