QUDA  v1.1.0
A library for QCD on GPUs
llfat_utils.h
Go to the documentation of this file.
1 #pragma once
2 
3 template <typename real> struct su3_matrix {
4  std::complex<real> e[3][3];
5 };
6 template <typename real> struct su3_vector {
7  std::complex<real> e[3];
8 };
9 
10 void llfat_reference(void **fatlink, void **sitelink, QudaPrecision prec, void *act_path_coeff);
11 void llfat_reference_mg(void **fatlink, void **sitelink, void **ghost_sitelink, void **ghost_sitelink_diag,
12  QudaPrecision prec, void *act_path_coeff);
13 
14 template <typename su3_matrix, typename Real> void llfat_scalar_mult_su3_matrix(su3_matrix *a, Real s, su3_matrix *b)
15 {
16  for (int i = 0; i < 3; i++)
17  for (int j = 0; j < 3; j++) { b->e[i][j] = s * a->e[i][j]; }
18 }
19 
20 template <typename su3_matrix, typename Real>
22 {
23  for (int i = 0; i < 3; i++)
24  for (int j = 0; j < 3; j++) { c->e[i][j] = a->e[i][j] + s * b->e[i][j]; }
25 }
26 
27 template <typename su3_matrix> void llfat_mult_su3_na(su3_matrix *a, su3_matrix *b, su3_matrix *c)
28 {
29  typename std::remove_reference<decltype(a->e[0][0])>::type x, y;
30  for (int i = 0; i < 3; i++)
31  for (int j = 0; j < 3; j++) {
32  x = 0.0;
33  for (int k = 0; k < 3; k++) {
34  y = a->e[i][k] * conj(b->e[j][k]);
35  x += y;
36  }
37  c->e[i][j] = x;
38  }
39 }
40 
41 template <typename su3_matrix> void llfat_mult_su3_nn(su3_matrix *a, su3_matrix *b, su3_matrix *c)
42 {
43  typename std::remove_reference<decltype(a->e[0][0])>::type x, y;
44  for (int i = 0; i < 3; i++)
45  for (int j = 0; j < 3; j++) {
46  x = 0.0;
47  for (int k = 0; k < 3; k++) {
48  y = a->e[i][k] * b->e[k][j];
49  x += y;
50  }
51  c->e[i][j] = x;
52  }
53 }
54 
55 template <typename su3_matrix> void llfat_mult_su3_an(su3_matrix *a, su3_matrix *b, su3_matrix *c)
56 {
57  typename std::remove_reference<decltype(a->e[0][0])>::type x, y;
58  for (int i = 0; i < 3; i++)
59  for (int j = 0; j < 3; j++) {
60  x = 0.0;
61  for (int k = 0; k < 3; k++) {
62  y = conj(a->e[k][i]) * b->e[k][j];
63  x += y;
64  }
65  c->e[i][j] = x;
66  }
67 }
68 
69 template <typename su3_matrix> void llfat_add_su3_matrix(su3_matrix *a, su3_matrix *b, su3_matrix *c)
70 {
71  for (int i = 0; i < 3; i++)
72  for (int j = 0; j < 3; j++) { c->e[i][j] = a->e[i][j] + b->e[i][j]; }
73 }
QudaPrecision prec
enum QudaPrecision_s QudaPrecision
Matrix< N, std::complex< T > > conj(const Matrix< N, std::complex< T > > &mat)
void llfat_mult_su3_nn(su3_matrix *a, su3_matrix *b, su3_matrix *c)
Definition: llfat_utils.h:41
void llfat_scalar_mult_su3_matrix(su3_matrix *a, Real s, su3_matrix *b)
Definition: llfat_utils.h:14
void llfat_mult_su3_an(su3_matrix *a, su3_matrix *b, su3_matrix *c)
Definition: llfat_utils.h:55
void llfat_scalar_mult_add_su3_matrix(su3_matrix *a, su3_matrix *b, Real s, su3_matrix *c)
Definition: llfat_utils.h:21
void llfat_add_su3_matrix(su3_matrix *a, su3_matrix *b, su3_matrix *c)
Definition: llfat_utils.h:69
void llfat_reference_mg(void **fatlink, void **sitelink, void **ghost_sitelink, void **ghost_sitelink_diag, QudaPrecision prec, void *act_path_coeff)
void llfat_reference(void **fatlink, void **sitelink, QudaPrecision prec, void *act_path_coeff)
void llfat_mult_su3_na(su3_matrix *a, su3_matrix *b, su3_matrix *c)
Definition: llfat_utils.h:27
std::complex< real > e[3][3]
Definition: llfat_utils.h:4
std::complex< real > e[3]
Definition: llfat_utils.h:7