Computational Physics - Department of Physics

(Axel Boer) #1

220 7 Eigensystems


}
doublea_kk, a_ll, a_ik, a_il, r_ik, r_il;
a_kk = A[k][k];
a_ll = A[l][l];
// changing the matrix elements with indices k and l
A[k][k] = cca_kk - 2.0csA[k][l] + ssa_ll;
A[l][l] = s
sa_kk + 2.0csA[k][l] + cca_ll;
A[k][l] = 0.0;// hard-coding of the zeros
A[l][k] = 0.0;
// and then we change the remaining elements
for(inti = 0; i < n; i++ ){
if( i != k && i != l ){
a_ik = A[i][k];
a_il = A[i][l];
A[i][k] = ca_ik - sa_il;
A[k][i] = A[i][k];
A[i][l] = ca_il + sa_ik;
A[l][i] = A[i][l];
}
// Finally, we compute the new eigenvectors
r_ik = R[i][k];
r_il = R[i][l];
R[i][k] = cr_ik - sr_il;
R[i][l] = cr_il + sr_ik;
}
return;
}


7.5 Similarity Transformations with Householder’s method.


In this case the diagonalization is performed in two steps: First, the matrix is transformed
into tridiagonal form by the Householder similarity transformation. Secondly, the tridiago-
nal matrix is then diagonalized. The reason for this two-step process is that diagonalizing a
tridiagonal matrix is computational much faster than the corresponding diagonalization of a
general symmetric matrix. Let us discuss the two steps in more detail.


7.5.1 The Householder’s method for tridiagonalization


The first step consists in finding an orthogonal matrixSwhich is the product of(n− 2 )orthog-
onal matrices
S=S 1 S 2 ...Sn− 2 ,


each of which successively transforms one row and one columnofAinto the required tridi-
agonal form. Onlyn− 2 transformations are required, since the last two elements are already
in tridiagonal form. In order to determine eachSilet us see what happens after the first
multiplication, namely,


ST 1 AS 1 =







a 11 e 1 0 0 ... 0 0
e 1 a′ 22 a′ 23 ... ... ...a′ 2 n
0 a′ 32 a′ 33 ... ... ...a′ 3 n
0 ... ... ... ... ...
0 a′n 2 a′n 3 ... ... ...a′nn






Free download pdf