CHROMA
twoquark_contract_ops.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Contraction operators for two quarks
3  */
4 
6 
7 namespace Chroma
8 {
9  //----------------------------------------------------------------------------
10  //! Take transpose of a matrix in (explicit) spin space
11  void transpose(multi2d<LatticeColorVector>& dist_rep,
12  const multi2d<LatticeColorVector>& prop_rep)
13  {
14  // Sanity check
15  if (prop_rep.nrows() != Ns || prop_rep.ncols() != Ns)
16  {
17  QDPIO::cerr << __func__ << ": invalid size of prop_rep\n";
18  QDP_abort(1);
19  }
20 
21  dist_rep.resize(Ns,Ns);
22 
23  // spin row
24  for(int sl = 0; sl < Ns; ++sl)
25  {
26  // spin col
27  for(int sr = 0; sr < Ns; ++sr)
28  {
29  dist_rep(sl,sr) = prop_rep(sr,sl); // WHAT ABOUT adj() ??
30  } // sr
31  } // sl
32  } // void
33 
34 
35  //----------------------------------------------------------------------------
36  // Use gamma_5 hermiticity on a prop
37  void gamma5Herm(multi2d<LatticeColorVector>& prop_time)
38  {
39  // Convert Gamma(15) into a representation of a spin matrix
40  // NOTE: here, I'm use DP basis
41  std::vector<MatrixSpinRep_t> g5(convertTwoQuarkSpinDP(15));
42 
43  // Load it
44  // Form a temporary that holds the adjoint of the prop, but only for a time-slice.
45  // Otherwise, we need several temporaries that blows up the storage
46  multi2d<LatticeColorVector> tmp1_rep;
47  transpose(tmp1_rep, prop_time);
48 
49  // Use gamma_5 hermiticity.
50  // Need to form Gamma(15) * adj(prop) * Gamma(15) = Gamma(15)*tmp1*Gamma(15);
51  multi2d<LatticeColorVector> tmp2_rep;
52  multiplyRep(tmp2_rep, g5, tmp1_rep);
53  multiplyRep(prop_time, tmp2_rep, g5);
54  }
55 
56 
57  //----------------------------------------------------------------------------
58  // Dist(t2) = SpinMatrix*Prop(t2)
59  void multiplyRep(multi2d<LatticeColorVector>& dist_rep,
60  const std::vector<MatrixSpinRep_t>& spin, const multi2d<LatticeColorVector>& prop_rep)
61  {
62  // Sanity check
63  if (prop_rep.nrows() != Ns || prop_rep.ncols() != Ns)
64  {
65  QDPIO::cerr << __func__ << ": invalid size of prop_rep\n";
66  QDP_abort(1);
67  }
68 
69  // Set the size and initialize
70  dist_rep.resize(Ns,Ns);
71  dist_rep = zero;
72 
73 // for(int sr = 0; sr < Ns; ++sr)
74 // {
75 // for(int sl = 0; sl < Ns; ++sl)
76 // {
77 // dist_rep(sl,sr) = zero;
78 // }
79 // }
80 
81  // sparse version of the row and intermediate
82  for(int aks = 0; aks < spin.size(); ++aks)
83  {
84  int left = spin[aks].left;
85  int right = spin[aks].right;
86  ComplexD spin_weight(spin[aks].op);
87 
88  // Target will be initialize upon reference
89  // spin column
90  for(int sr = 0; sr < Ns; ++sr)
91  {
92  dist_rep(left,sr) += spin_weight * prop_rep(right,sr);
93  } // sr
94  } // aks
95  } // void
96 
97 
98  //----------------------------------------------------------------------------
99  // Dist(t2) = Prop(t2)*SpinMatrix
100  void multiplyRep(multi2d<LatticeColorVector>& dist_rep,
101  const multi2d<LatticeColorVector>& prop_rep, const std::vector<MatrixSpinRep_t>& spin)
102  {
103  // Sanity check
104  if (prop_rep.nrows() != Ns || prop_rep.ncols() != Ns)
105  {
106  QDPIO::cerr << __func__ << ": invalid size of prop_rep\n";
107  QDP_abort(1);
108  }
109 
110  // Set the size
111  dist_rep.resize(Ns,Ns);
112  dist_rep = zero;
113 
114 // for(int sr = 0; sr < Ns; ++sr)
115 // {
116 // for(int sl = 0; sl < Ns; ++sl)
117 // {
118 // dist_rep(sl,sr) = zero;
119 // }
120 // }
121 
122  // sparse version of the column and intermediate
123  for(int bks = 0; bks < spin.size(); ++bks)
124  {
125  int left = spin[bks].left;
126  int right = spin[bks].right;
127  ComplexD spin_weight(spin[bks].op);
128 
129  // spin row
130  for(int sl = 0; sl < Ns; ++sl)
131  {
132  dist_rep(sl,right) += prop_rep(sl,left) * spin_weight;
133  }
134  } // bks
135  } // void
136 
137 } // namespace Chroma
LatticePropagator gamma5Herm(const LatticePropagator &source_prop)
Return gamma_5*adj(source)*gamma_f.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
void transpose(multi2d< LatticeColorVector > &dist_rep, const multi2d< LatticeColorVector > &prop_rep)
Take transpose of a matrix in (explicit) spin space.
std::vector< MatrixSpinRep_t > convertTwoQuarkSpinDP(int gamma)
Convert a DP gamma matrix indexed by gamma into a sparse spin representation.
Definition: spin_rep.cc:102
Double zero
Definition: invbicg.cc:106
void multiplyRep(multi2d< LatticeColorVector > &dist_rep, const std::vector< MatrixSpinRep_t > &spin, const multi2d< LatticeColorVector > &prop_rep)
Dist(t2) = SpinMatrix*Prop(t2)
Contraction operators for two quarks.