Givens QR to find Symmetric Tridiagonal Eigenpairs Octave Implementation
John Bryan
- Givens QR to find Symmetric Tridiagonal Eigenpairs.
-
n = number of rows = number of columns
Initial conditions:
$$ \text{initial matrix} = \mathbf{A} $$
$$\mathbf{Q0} = \mathbf{I_n} $$
$$\mathbf{V0} = \mathbf{I_n} $$
$$\mathbf{P} = \mathbf{I_n} $$
$$\mathbf{P0} = \mathbf{A}. $$
-
while any nondiagonal entry absolute value is greater than chosen small number loop
-
for loop from k=1:n-1
-
$$\mathbf{Q0}=\mathbf{I_n} $$
$$\mathbf{P}=\mathbf{I_n} $$
-
$$[c,s]=\text{Givens Rotation}(\mathbf{P0}(k,k),\mathbf{P0}(k+1,k)) $$
$$
\mathbf{P}(k,k) = c $$
$$ \mathbf{P}(k,k+1) = -s $$
$$ \mathbf{P}(k+1,k) = s $$
$$ \mathbf{P}(k+1,k+1) = c $$
-
$$
\mathbf{P0}=\mathbf{P}*\mathbf{A}
$$
-
$$
\mathbf{Q0}=\mathbf{Q0}*\mathbf{P}^\intercal
$$
-
$$
\mathbf{R0}=\mathbf{P0}
$$
-
$$
\mathbf{A}=\mathbf{R0*Q0}
$$
-
$$
\mathbf{V0}=\mathbf{V0*Q0}
$$
end for loop
end while loop
-
Octave implementation.
-
Results.
|
Check of n=5 computed eigenpairs by inserting into eigenvalue equation.
|
| using eigenpair 1 | using eigenpair 2 | using eigenpair 3 |
using eigenpair 4 | using eigenpair 5 |
| -3.45e-14 | 7.76e-14 | -5.56e-14 | -1.25e-14 | 8.88e-16 |
| -6.46e-14 | 6.25e-14 | -4.62e-15 | 1.45e-14 | 5.16e-16 |
| -6.38e-14 | 1.36e-14 | 4.41e-14 | -4.48e-14 | 8.88e-16 |
| -5.60e-14 | -7.64e-14 | 1.77e-15 | 1.20e-14 | 8.88e-16 |
| -3.11e-14 | -6.15e-14 | -5.41e-14 | -1.51e-14 | 1.01e-15 |