30 multi1d<Real>& lambda,
31 multi1d<Complex>& off_diag,
65 Real tol_sq = tolerance * tolerance;
67 for(
k = 1;
k <= N_max;
k++)
72 for(
j = 1;
j < N_eig;
j++)
74 for(
i = 0;
i <
j;
i++)
76 dd = real(conj(off_diag[ij]) * off_diag[ij]);
77 ftmp = fabs(tol_sq * lambda[
i] * lambda[
j]);
79 if( toBool( dd > ftmp) )
87 diff_l = lambda[
j] - lambda[
i];
91 if( toBool( (ftmp+acc) == ftmp ) ) {
96 theta = Real(0.5) * diff_l / dd;
97 t = sqrt(Real(1) + theta*theta);
99 t = Real(1) / (ftmp+
t);
100 if( toBool( theta < Real(0) ) ) {
105 if( toBool( diff_l >= Real(0) ) ) {
106 c = Real(1) / sqrt( Real(1) +
t*
t);
111 s = Real(1) / sqrt( Real(1) +
t*
t);
116 al1 = ftmp * lambda[
i];
117 al2 = ftmp * lambda[
j];
119 al1 += ftmp * lambda[
j];
120 al2 += ftmp * lambda[
i];
121 ftmp = Real(2) * dd *
s *
c;
127 v12 = (
s / dd) * off_diag[ij];
129 off_diag[ij] = Real(0);
132 psi_t1[sub] =
psi[
i] * v11;
134 psi_t1[sub] -=
psi[
j] * v21;
135 psi_t2[sub] =
psi[
j] * v11;
136 psi_t2[sub] -=
psi[
i] * v12;
137 psi[
i][sub] = psi_t1;
138 psi[
j][sub] = psi_t2;
142 for(
m = 0;
m < N_eig;
m++) {
143 if(
m !=
i &&
m !=
j ) {
147 mi =
i * (
i-1) / 2 +
m;
148 mj =
j * (
j-1) / 2 +
m;
149 ctmp1 = off_diag[mi] * v11;
151 ctmp1 -= off_diag[mj] * v21;
152 ctmp2 = off_diag[mj] * v11;
153 ctmp2 -= off_diag[mi] * v12;
154 off_diag[mi] = ctmp1;
155 off_diag[mj] = ctmp2;
159 mi =
m * (
m-1) / 2 +
i;
160 mj =
j * (
j-1) / 2 +
m;
161 ctmp1 = conj(off_diag[mi]) * v11;
162 ctmp1 -= off_diag[mj] * v21;
163 ctmp2 = off_diag[mj] * v11;
164 ctmp2 -= conj(off_diag[mi]) * v12;
165 off_diag[mi] = conj(ctmp1);
166 off_diag[mj] = ctmp2;
170 mi =
m * (
m-1) / 2 +
i;
171 mj =
m * (
m-1) / 2 +
j;
172 ctmp1 = conj(off_diag[mi]) * v11;
173 ctmp1 -= conj(off_diag[mj]) * v21;
174 ctmp2 = conj(off_diag[mj]) * v11;
175 ctmp2 -= conj(off_diag[mi]) * v12;
176 off_diag[mi] = conj(ctmp1);
177 off_diag[mj] = conj(ctmp2);
190 QDPIO::cout <<
"Jacobi converged after " <<
k <<
" iters" << std::endl;
194 for(
j = 1;
j < N_eig;
j++) {
195 for(
i = 0;
i <
j;
i++) {
197 ftmp = fabs(lambda[
j]);
198 dd = fabs(lambda[
i]);
201 if( toBool( ftmp < dd ) ) {
204 lambda[
i] = lambda[
j];
208 psi_t1[sub] =
psi[
i];
210 psi[
j][sub] = psi_t1;
228 multi1d<Real>& lambda,
229 multi1d<Complex>& off_diag,
234 return SN_Jacob_t(
psi, N_eig, lambda, off_diag, tolerance, N_max, sub);
Primary include file for CHROMA library code.
int SN_Jacob(multi1d< 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.
int SN_Jacob_t(multi1d< 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.
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)
LinOpSysSolverMGProtoClover::T T
multi1d< LatticeFermion > s(Ncb)