32 multi1d<Real>& lambda,
33 multi1d<Complex>& off_diag,
43 multi1d<T> psi_t1(
N5);
44 multi1d<T> psi_t2(
N5);
69 Real tol_sq = tolerance * tolerance;
71 for(
k = 1;
k <= N_max;
k++)
76 for(
j = 1;
j < N_eig;
j++)
78 for(
i = 0;
i <
j;
i++)
80 dd = real(conj(off_diag[ij]) * off_diag[ij]);
81 ftmp = fabs(tol_sq * lambda[
i] * lambda[
j]);
83 if( toBool( dd > ftmp) )
91 diff_l = lambda[
j] - lambda[
i];
94 if( toBool( (ftmp+acc) == ftmp ) )
100 theta = Real(0.5) * diff_l / dd;
101 t = sqrt(Real(1) + theta*theta);
103 t = Real(1) / (ftmp+
t);
104 if( toBool( theta < Real(0) ) ) {
109 if( toBool( diff_l >= Real(0) ) ) {
110 c = Real(1) / sqrt( Real(1) +
t*
t);
115 s = Real(1) / sqrt( Real(1) +
t*
t);
120 al1 = ftmp * lambda[
i];
121 al2 = ftmp * lambda[
j];
123 al1 += ftmp * lambda[
j];
124 al2 += ftmp * lambda[
i];
125 ftmp = Real(2) * dd *
s *
c;
131 v12 = (
s / dd) * off_diag[ij];
133 off_diag[ij] = Real(0);
136 for(
int n=0;
n <
N5;
n++) {
137 psi_t1[
n][sub] =
psi[
i][
n] * v11;
140 psi_t1[
n][sub] -=
psi[
j][
n] * v21;
141 psi_t2[
n][sub] =
psi[
j][
n] * v11;
142 psi_t2[
n][sub] -=
psi[
i][
n] * v12;
143 psi[
i][
n][sub] = psi_t1[
n];
144 psi[
j][
n][sub] = psi_t2[
n];
148 for(
m = 0;
m < N_eig;
m++) {
149 if(
m !=
i &&
m !=
j ) {
153 mi =
i * (
i-1) / 2 +
m;
154 mj =
j * (
j-1) / 2 +
m;
155 ctmp1 = off_diag[mi] * v11;
157 ctmp1 -= off_diag[mj] * v21;
158 ctmp2 = off_diag[mj] * v11;
159 ctmp2 -= off_diag[mi] * v12;
160 off_diag[mi] = ctmp1;
161 off_diag[mj] = ctmp2;
165 mi =
m * (
m-1) / 2 +
i;
166 mj =
j * (
j-1) / 2 +
m;
167 ctmp1 = conj(off_diag[mi]) * v11;
168 ctmp1 -= off_diag[mj] * v21;
169 ctmp2 = off_diag[mj] * v11;
170 ctmp2 -= conj(off_diag[mi]) * v12;
171 off_diag[mi] = conj(ctmp1);
172 off_diag[mj] = ctmp2;
176 mi =
m * (
m-1) / 2 +
i;
177 mj =
m * (
m-1) / 2 +
j;
178 ctmp1 = conj(off_diag[mi]) * v11;
179 ctmp1 -= conj(off_diag[mj]) * v21;
180 ctmp2 = conj(off_diag[mj]) * v11;
181 ctmp2 -= conj(off_diag[mi]) * v12;
182 off_diag[mi] = conj(ctmp1);
183 off_diag[mj] = conj(ctmp2);
196 QDPIO::cout <<
"Jacobi converged after " <<
k <<
" iters" << std::endl;
200 for(
j = 1;
j < N_eig;
j++)
202 for(
i = 0;
i <
j;
i++)
204 ftmp = fabs(lambda[
j]);
205 dd = fabs(lambda[
i]);
208 if( toBool( ftmp < dd ) )
211 lambda[
i] = lambda[
j];
214 for(
int n=0;
n <
N5;
n++)
216 psi_t1[
n][sub] =
psi[
i][
n];
218 psi[
j][
n][sub] = psi_t1[
n];
238 multi1d<Real>& lambda,
239 multi1d<Complex>& off_diag,
Primary include file for CHROMA library code.
int SN_Jacob_Array_t(multi2d< T > &psi, const int N_eig, multi1d< Real > &lambda, multi1d< Complex > &off_diag, Real tolerance, int N_max, const Subset &sub)
Single-node Jacobi rotation.
int SN_Jacob_Array(multi2d< LatticeFermion > &psi, const int N_eig, multi1d< Real > &lambda, multi1d< Complex > &off_diag, Real tolerance, int N_max, const Subset &sub)
Single-node Jacobi rotation.
Asqtad Staggered-Dirac operator.
QDP_error_exit("too many BiCG iterations", n_count, rsd_sq, cp, c, re_rvr, im_rvr, re_a, im_a, re_b, im_b)
multi1d< LatticeFermion > s(Ncb)