|
11 | 11 | #include "start.h"
|
12 | 12 | #include "linalg_eo.h"
|
13 | 13 | #include "tm_operators.h"
|
| 14 | +#include "boundary.h" |
| 15 | +#include "D_psi.h" |
14 | 16 | #include "chebyshev_polynomial.h"
|
15 | 17 |
|
16 | 18 |
|
@@ -161,3 +163,80 @@ void poly_precon(spinor * const R, spinor * const S, const double prec, const in
|
161 | 163 | }
|
162 | 164 |
|
163 | 165 |
|
| 166 | +void poly_nonherm_precon(spinor * const R, spinor * const S, |
| 167 | + const double e, const int n) { |
| 168 | + int j; |
| 169 | + double a1, a2; |
| 170 | + double fact1, fact2, temp1, temp2, temp3, temp4, auxnorm; |
| 171 | + static spinor *sv_, *sv, *d_, *d, *dd_, *dd, *aux_, *aux, *aux3_, *aux3; |
| 172 | + static int initpnH = 0; |
| 173 | + static double * c; |
| 174 | + const int N = VOLUME; |
| 175 | + spinor * psi, * chi, *tmp; |
| 176 | + |
| 177 | + |
| 178 | + if(initpnH == 0) { |
| 179 | + c = (double*)calloc(1000, sizeof(double)); |
| 180 | +#if (defined SSE || defined SSE2 || defined SSE3) |
| 181 | + sv_ = calloc(VOLUMEPLUSRAND+1, sizeof(spinor)); |
| 182 | + sv = (spinor *)(((unsigned long int)(sv_)+ALIGN_BASE)&~ALIGN_BASE); |
| 183 | + d_ = calloc(VOLUMEPLUSRAND+1, sizeof(spinor)); |
| 184 | + d = (spinor *)(((unsigned long int)(d_)+ALIGN_BASE)&~ALIGN_BASE); |
| 185 | + dd_ = calloc(VOLUMEPLUSRAND+1, sizeof(spinor)); |
| 186 | + dd = (spinor *)(((unsigned long int)(dd_)+ALIGN_BASE)&~ALIGN_BASE); |
| 187 | + aux_ = calloc(VOLUMEPLUSRAND+1, sizeof(spinor)); |
| 188 | + aux = (spinor *)(((unsigned long int)(aux_)+ALIGN_BASE)&~ALIGN_BASE); |
| 189 | + aux3_= calloc(VOLUMEPLUSRAND+1, sizeof(spinor)); |
| 190 | + aux3 = (spinor *)(((unsigned long int)(aux3_)+ALIGN_BASE)&~ALIGN_BASE); |
| 191 | +#else |
| 192 | + sv_ = calloc(VOLUMEPLUSRAND+1, sizeof(spinor)); |
| 193 | + sv = sv_; |
| 194 | + d_ = calloc(VOLUMEPLUSRAND+1, sizeof(spinor)); |
| 195 | + d = d_; |
| 196 | + dd_ = calloc(VOLUMEPLUSRAND+1, sizeof(spinor)); |
| 197 | + dd = dd_; |
| 198 | + aux_ = calloc(VOLUMEPLUSRAND+1, sizeof(spinor)); |
| 199 | + aux = aux_; |
| 200 | + aux3_= calloc(VOLUMEPLUSRAND+1, sizeof(spinor)); |
| 201 | + aux3 = aux3_; |
| 202 | +#endif |
| 203 | + initpnH = 1; |
| 204 | + } |
| 205 | + |
| 206 | + |
| 207 | + /* P_0 * S */ |
| 208 | + assign(d, S, N); |
| 209 | + /* P_1 * S = a_1(1+kappa*H) * S */ |
| 210 | + a1 = 1./(1.-e*e/2.); |
| 211 | + boundary(-g_kappa); |
| 212 | + g_mu = -g_mu; |
| 213 | + D_psi(dd, d); |
| 214 | + mul_r(dd, a1, dd, N); |
| 215 | + psi = d; |
| 216 | + chi = dd; |
| 217 | +/* assign(chi, d, N); */ |
| 218 | + for(j = 2; j < n+1; j++) { |
| 219 | + /* a_n */ |
| 220 | + a2 = 1./(1.-a1*e*e/4.); |
| 221 | + /* 1-a_n */ |
| 222 | + a1 = 1.-a2; |
| 223 | + /* aux = a_n*S + (1-a_n) psi */ |
| 224 | + mul_add_mul_r(aux, S, psi, a2, a1, N); |
| 225 | + /* sv = kappa H chi = (D_psi(-kappa, -2kappamu) - 1) chi */ |
| 226 | + D_psi(sv, chi); |
| 227 | + diff(sv, sv, chi, N); |
| 228 | + /* psi = aux + a_n * sv */ |
| 229 | + mul_add_mul_r(psi, aux, sv, 1., a2, N); |
| 230 | + tmp = psi; |
| 231 | + psi = chi; |
| 232 | + chi = tmp; |
| 233 | + a1 = a2; |
| 234 | + } |
| 235 | + assign(R, chi, N); |
| 236 | + boundary(-g_kappa); |
| 237 | + g_mu = -g_mu; |
| 238 | + |
| 239 | + return; |
| 240 | +} |
| 241 | + |
| 242 | + |
0 commit comments