17 template <
typename sFloat,
typename cFloat>
21 int N =
nColor * nSpin / 2;
22 int chiralBlock = N + 2*(N-1)*N/2;
24 for (
int i=0; i<
Vh; i++) {
25 std::complex<sFloat> *In =
reinterpret_cast<std::complex<sFloat>*
>(&in[i*nSpin*
nColor*2]);
26 std::complex<sFloat> *Out =
reinterpret_cast<std::complex<sFloat>*
>(&out[i*nSpin*
nColor*2]);
28 for (
int chi=0; chi<nSpin/2; chi++) {
29 cFloat *D = &clover[((
parity*
Vh + i)*2 + chi)*chiralBlock];
30 std::complex<cFloat> *L =
reinterpret_cast<std::complex<cFloat>*
>(&D[N]);
32 for (
int s_col=0; s_col<nSpin/2; s_col++) {
33 for (
int c_col=0; c_col<
nColor; c_col++) {
34 const int col = s_col *
nColor + c_col;
35 const int Col = chi*N + col;
38 for (
int s_row=0; s_row<nSpin/2; s_row++) {
39 for (
int c_row=0; c_row<
nColor; c_row++) {
40 const int row = s_row *
nColor + c_row;
41 const int Row = chi*N + row;
44 Out[Col] += D[row] * In[Row];
45 }
else if (col < row) {
46 int k = N*(N-1)/2 - (N-col)*(N-col-1)/2 + row - col - 1;
47 Out[Col] +=
conj(L[k]) * In[Row];
48 }
else if (row < col) {
49 int k = N*(N-1)/2 - (N-row)*(N-row-1)/2 + col - row - 1;
50 Out[Col] += L[k] * In[Row];
68 cloverReference(
static_cast<double*
>(out),
static_cast<double*
>(clover),
static_cast<double*
>(in),
parity);
71 cloverReference(
static_cast<float*
>(out),
static_cast<float*
>(clover),
static_cast<float*
>(in),
parity);
74 errorQuda(
"Unsupported precision %d", precision);
90 void clover_matpc(
void *out,
void **gauge,
void *clover,
void *clover_inv,
void *in,
double kappa,
176 for(
int i = 0; i <
Vh; i++)
177 for(
int s = 0; s < 4; s++) {
178 double a5 = ((s / 2) ? -1.0 : +1.0) * a;
179 for(
int c = 0; c < 3; c++) {
180 ((
double *) out)[i * 24 + s * 6 + c * 2 + 0] = ((
double *) tmpH)[i * 24 + s * 6 + c * 2 + 0] - a5*((
double *) in)[i * 24 + s * 6 + c * 2 + 1];
181 ((
double *) out)[i * 24 + s * 6 + c * 2 + 1] = ((
double *) tmpH)[i * 24 + s * 6 + c * 2 + 1] + a5*((
double *) in)[i * 24 + s * 6 + c * 2 + 0];
186 for(
int i = 0; i <
Vh; i++)
187 for(
int s = 0; s < 4; s++) {
188 float a5 = ((s / 2) ? -1.0 : +1.0) * a;
189 for(
int c = 0; c < 3; c++) {
190 ((
float *) out)[i * 24 + s * 6 + c * 2 + 0] = ((
float *) tmpH)[i * 24 + s * 6 + c * 2 + 0] - a5*((
float *) in)[i * 24 + s * 6 + c * 2 + 1];
191 ((
float *) out)[i * 24 + s * 6 + c * 2 + 1] = ((
float *) tmpH)[i * 24 + s * 6 + c * 2 + 1] + a5*((
float *) in)[i * 24 + s * 6 + c * 2 + 0];
196 errorQuda(
"Unsupported precision %d", precision);
228 a = -2.0 *
kappa *
mu * flavor;
236 printf(
"Twist type %d not defined\n", twist);
250 twistCloverGamma5(tmp1, in, clover, cInv,
dagger,
kappa,
mu, flavor, 1-
parity,
QUDA_TWIST_GAMMA5_INVERSE, precision);
253 twistCloverGamma5(out, tmp2, clover, cInv,
dagger,
kappa,
mu, flavor,
parity,
QUDA_TWIST_GAMMA5_INVERSE, precision);
259 twistCloverGamma5(out, tmp1, clover, cInv,
dagger,
kappa,
mu, flavor,
parity,
QUDA_TWIST_GAMMA5_INVERSE, precision);
267 void tmc_mat(
void *out,
void **gauge,
void *clover,
void *in,
double kappa,
double mu,
281 twistCloverGamma5(tmpOdd, inOdd, clover, NULL,
dagger,
kappa,
mu, flavor, 1,
QUDA_TWIST_GAMMA5_DIRECT, precision);
285 twistCloverGamma5(tmpEven, inEven, clover, NULL,
dagger,
kappa,
mu, flavor, 0,
QUDA_TWIST_GAMMA5_DIRECT, precision);
306 twistCloverGamma5(tmp1, out, clover, cInv,
dagger,
kappa,
mu, flavor, 1,
QUDA_TWIST_GAMMA5_INVERSE, precision);
308 twistCloverGamma5(out, tmp2, clover, cInv,
dagger,
kappa,
mu, flavor, 0,
QUDA_TWIST_GAMMA5_INVERSE, precision);
310 twistCloverGamma5(out, in, clover, cInv,
dagger,
kappa,
mu, flavor, 0,
QUDA_TWIST_GAMMA5_INVERSE, precision);
312 twistCloverGamma5(tmp2, tmp1, clover, cInv,
dagger,
kappa,
mu, flavor, 1,
QUDA_TWIST_GAMMA5_INVERSE, precision);
319 twistCloverGamma5(tmp2, tmp1, clover, cInv,
dagger,
kappa,
mu, flavor, 1,
QUDA_TWIST_GAMMA5_INVERSE, precision);
321 twistCloverGamma5(tmp2, in, clover, cInv,
dagger,
kappa,
mu, flavor, 0,
QUDA_TWIST_GAMMA5_DIRECT, precision);
327 twistCloverGamma5(tmp1, out, clover, cInv,
dagger,
kappa,
mu, flavor, 0,
QUDA_TWIST_GAMMA5_INVERSE, precision);
329 twistCloverGamma5(out, tmp2, clover, cInv,
dagger,
kappa,
mu, flavor, 1,
QUDA_TWIST_GAMMA5_INVERSE, precision);
331 twistCloverGamma5(out, in, clover, cInv,
dagger,
kappa,
mu, flavor, 1,
QUDA_TWIST_GAMMA5_INVERSE, precision);
333 twistCloverGamma5(tmp2, tmp1, clover, cInv,
dagger,
kappa,
mu, flavor, 0,
QUDA_TWIST_GAMMA5_INVERSE, precision);
340 twistCloverGamma5(tmp2, tmp1, clover, cInv,
dagger,
kappa,
mu, flavor, 0,
QUDA_TWIST_GAMMA5_INVERSE, precision);
342 twistCloverGamma5(tmp1, in, clover, cInv,
dagger,
kappa,
mu, flavor, 1,
QUDA_TWIST_GAMMA5_DIRECT, precision);
void applyTwist(void *out, void *in, void *tmpH, double a, QudaPrecision precision)
void twistCloverGamma5(void *out, void *in, void *clover, void *cInv, const int dagger, const double kappa, const double mu, const QudaTwistFlavorType flavor, const int parity, QudaTwistGamma5Type twist, QudaPrecision precision)
void clover_mat(void *out, void **gauge, void *clover, void *in, double kappa, int dagger, QudaPrecision precision, QudaGaugeParam &gauge_param)
void clover_dslash(void *out, void **gauge, void *clover, void *in, int parity, int dagger, QudaPrecision precision, QudaGaugeParam ¶m)
void cloverReference(sFloat *out, cFloat *clover, sFloat *in, int parity)
Apply the clover matrix field.
void tmc_mat(void *out, void **gauge, void *clover, void *in, double kappa, double mu, QudaTwistFlavorType flavor, int dagger, QudaPrecision precision, QudaGaugeParam &gauge_param)
void clover_matpc(void *out, void **gauge, void *clover, void *clover_inv, void *in, double kappa, QudaMatPCType matpc_type, int dagger, QudaPrecision precision, QudaGaugeParam &gauge_param)
void tmc_dslash(void *out, void **gauge, void *in, void *clover, void *cInv, double kappa, double mu, QudaTwistFlavorType flavor, int parity, QudaMatPCType matpc_type, int dagger, QudaPrecision precision, QudaGaugeParam ¶m)
void twistClover(void *out, void *in, void *x, void *clover, const double a, int dagger, int parity, QudaPrecision precision)
void cloverHasenbuschTwist_matpc(void *out, void **gauge, void *in, void *clover, void *cInv, double kappa, double mu, QudaMatPCType matpc_type, int dagger, QudaPrecision precision, QudaGaugeParam &gauge_param)
void cloverHasenbuchTwist_mat(void *out, void **gauge, void *clover, void *in, double kappa, double mu, int dagger, QudaPrecision precision, QudaGaugeParam &gauge_param, QudaMatPCType matpc_type)
void tmc_matpc(void *out, void **gauge, void *in, void *clover, void *cInv, double kappa, double mu, QudaTwistFlavorType flavor, QudaMatPCType matpc_type, int dagger, QudaPrecision precision, QudaGaugeParam &gauge_param)
void apply_clover(void *out, void *clover, void *in, int parity, QudaPrecision precision)
cudaColorSpinorField * tmp
QudaGaugeParam gauge_param
enum QudaPrecision_s QudaPrecision
enum QudaTwistFlavorType_s QudaTwistFlavorType
enum QudaTwistGamma5Type_s QudaTwistGamma5Type
@ QUDA_MATPC_ODD_ODD_ASYMMETRIC
@ QUDA_MATPC_EVEN_EVEN_ASYMMETRIC
enum QudaMatPCType_s QudaMatPCType
@ QUDA_TWIST_GAMMA5_INVERSE
@ QUDA_TWIST_GAMMA5_DIRECT
Matrix< N, std::complex< T > > conj(const Matrix< N, std::complex< T > > &mat)
void xpay(ColorSpinorField &x, double a, ColorSpinorField &y)
void wil_dslash(void *out, void **gauge, void *in, int oddBit, int daggerBit, QudaPrecision precision, QudaGaugeParam &gauge_param)