23 template <
typename Float,
int Nc,
int Ns>
26 complex<Float>
data[Nc*Ns];
30 for (
int i=0;
i<Nc*Ns;
i++) {
37 for (
int i=0;
i<Nc*Ns;
i++) {
45 for (
int i=0;
i<Nc*Ns;
i++) {
55 for (
int i=0;
i<Nc*Ns;
i++) {
88 __device__ __host__
inline const complex<Float>&
operator()(
int s,
int c)
const {
return data[
s*Nc +
c]; }
110 template <
typename Float,
int Nc>
112 static const int Ns = 4;
117 for (
int i=0;
i<Nc*Ns;
i++) {
124 for (
int i=0;
i<Nc*Ns;
i++) {
132 for (
int i=0;
i<Nc*Ns;
i++) {
142 for (
int i=0;
i<Nc*Ns;
i++) {
156 complex<Float> j(0.0,1.0);
161 for (
int i=0;
i<Nc;
i++) {
162 a(0,
i) = j*(*this)(3,
i);
163 a(1,
i) = j*(*this)(2,
i);
164 a(2,
i) = -j*(*this)(1,
i);
165 a(3,
i) = -j*(*this)(0,
i);
170 for (
int i=0;
i<Nc;
i++) {
171 a(0,
i) = (*this)(3,
i);
172 a(1,
i) = -(*this)(2,
i);
173 a(2,
i) = -(*this)(1,
i);
174 a(3,
i) = (*this)(0,
i);
179 for (
int i=0;
i<Nc;
i++) {
180 a(0,
i) = j*(*this)(2,
i);
181 a(1,
i) = -j*(*this)(3,
i);
182 a(2,
i) = -j*(*this)(0,
i);
183 a(3,
i) = j*(*this)(1,
i);
188 for (
int i=0;
i<Nc;
i++) {
189 a(0,
i) = (*this)(0,
i);
190 a(1,
i) = (*this)(1,
i);
191 a(2,
i) = -(*this)(2,
i);
192 a(3,
i) = -(*this)(3,
i);
197 for (
int i=0;
i<Nc;
i++) {
198 a(0,
i) = (*this)(2,
i);
199 a(1,
i) = (*this)(3,
i);
200 a(2,
i) = (*this)(0,
i);
201 a(3,
i) = (*this)(1,
i);
216 complex<Float> j(0.0,1.0);
221 for (
int i=0;
i<Nc;
i++) {
222 a(0,
i) = -(*this)(3,
i);
223 a(1,
i) = -(*this)(2,
i);
224 a(2,
i) = (*this)(1,
i);
225 a(3,
i) = (*this)(0,
i);
230 for (
int i=0;
i<Nc;
i++) {
231 a(0,
i) = j*(*this)(3,
i);
232 a(1,
i) = -j*(*this)(2,
i);
233 a(2,
i) = -j*(*this)(1,
i);
234 a(3,
i) = j*(*this)(0,
i);
239 for (
int i=0;
i<Nc;
i++) {
240 a(0,
i) = -(*this)(2,
i);
241 a(1,
i) = (*this)(3,
i);
242 a(2,
i) = (*this)(0,
i);
243 a(3,
i) = -(*this)(1,
i);
248 for (
int i=0;
i<Nc;
i++) {
249 a(0,
i) = j*(*this)(0,
i);
250 a(1,
i) = j*(*this)(1,
i);
251 a(2,
i) = -j*(*this)(2,
i);
252 a(3,
i) = -j*(*this)(3,
i);
257 for (
int i=0;
i<Nc;
i++) {
258 a(0,
i) = complex<Float>(-(*this)(2,
i).imag(), (*this)(2,
i).real());
259 a(1,
i) = complex<Float>(-(*this)(3,
i).imag(), (*this)(3,
i).real());
260 a(2,
i) = complex<Float>(-(*this)(0,
i).imag(), (*this)(0,
i).real());
261 a(3,
i) = complex<Float>(-(*this)(1,
i).imag(), (*this)(1,
i).real());
276 for (
int s=0;
s<Ns/2;
s++) {
278 for (
int c=0;
c<Nc;
c++) {
279 proj(
s,
c) = (*this)(chirality*Ns/2+
s,
c);
293 complex<Float> j(0.0,1.0);
300 for (
int i=0;
i<Nc;
i++) {
301 proj(0,
i) = (*this)(0,
i) + j * (*
this)(3,
i);
302 proj(1,
i) = (*this)(1,
i) + j * (*
this)(2,
i);
307 for (
int i=0;
i<Nc;
i++) {
308 proj(0,
i) = (*this)(0,
i) - j * (*
this)(3,
i);
309 proj(1,
i) = (*this)(1,
i) - j * (*
this)(2,
i);
318 for (
int i=0;
i<Nc;
i++) {
319 proj(0,
i) = (*this)(0,
i) + (*
this)(3,
i);
320 proj(1,
i) = (*this)(1,
i) - (*
this)(2,
i);
325 for (
int i=0;
i<Nc;
i++) {
326 proj(0,
i) = (*this)(0,
i) - (*
this)(3,
i);
327 proj(1,
i) = (*this)(1,
i) + (*
this)(2,
i);
336 for (
int i=0;
i<Nc;
i++) {
337 proj(0,
i) = (*this)(0,
i) + j * (*
this)(2,
i);
338 proj(1,
i) = (*this)(1,
i) - j * (*
this)(3,
i);
343 for (
int i=0;
i<Nc;
i++) {
344 proj(0,
i) = (*this)(0,
i) - j * (*
this)(2,
i);
345 proj(1,
i) = (*this)(1,
i) + j * (*
this)(3,
i);
354 for (
int i=0;
i<Nc;
i++) {
355 proj(0,
i) = 2*(*this)(0,
i);
356 proj(1,
i) = 2*(*this)(1,
i);
361 for (
int i=0;
i<Nc;
i++) {
362 proj(0,
i) = 2*(*this)(2,
i);
363 proj(1,
i) = 2*(*this)(3,
i);
411 complex<Float> j(0.0,1.0);
418 for (
int i=0;
i<Nc;
i++) {
427 for (
int i=0;
i<Nc;
i++) {
436 for (
int i=0;
i<Nc;
i++) {
449 for (
int i=0;
i<Nc;
i++) {
458 for (
int i=0;
i<Nc;
i++) {
467 for (
int i=0;
i<Nc;
i++) {
480 for (
int i=0;
i<Nc;
i++) {
489 for (
int i=0;
i<Nc;
i++) {
498 for (
int i=0;
i<Nc;
i++) {
511 for (
int i=0;
i<Nc;
i++) {
520 for (
int i=0;
i<Nc;
i++) {
529 for (
int i=0;
i<Nc;
i++) {
558 __device__ __host__
inline const complex<Float>&
operator()(
int s,
int c)
const {
return data[
s*Nc +
c]; }
593 for (
int c=0;
c<Nc;
c++) {
594 a(0,
c) = (*this)(1,
c)+(*
this)(3,
c);
595 a(1,
c) = -(*this)(2,
c)-(*
this)(0,
c);
596 a(2,
c) = -(*this)(3,
c)+(*
this)(1,
c);
597 a(3,
c) = -(*this)(0,
c)+(*
this)(2,
c);
605 __device__ __host__
inline void toRel() {
608 for (
int c=0;
c<Nc;
c++) {
609 a(0,
c) = -(*this)(1,
c)-(*
this)(3,
c);
610 a(1,
c) = (*this)(2,
c)+(*
this)(0,
c);
611 a(2,
c) = (*this)(3,
c)-(*
this)(1,
c);
612 a(3,
c) = (*this)(0,
c)-(*
this)(2,
c);
618 for (
int s=0;
s<Ns;
s++) {
619 for (
int c=0;
c<Nc;
c++) {
630 template <
typename Float,
int Nc>
632 static const int Ns = 2;
637 for (
int i=0;
i<Nc*Ns;
i++) {
644 for (
int i=0;
i<Nc*Ns;
i++) {
653 for (
int i=0;
i<Nc*Ns;
i++) {
663 for (
int i=0;
i<Nc*Ns;
i++) {
677 for (
int s=0;
s<Ns;
s++) {
679 for (
int c=0;
c<Nc;
c++) {
680 recon(chirality*Ns+
s,
c) = (*this)(
s,
c);
694 complex<Float> j(0.0,1.0);
701 for (
int i=0;
i<Nc;
i++) {
702 recon(0,
i) = (*this)(0,
i);
703 recon(1,
i) = (*this)(1,
i);
704 recon(2,
i) = -j*(*this)(1,
i);
705 recon(3,
i) = -j*(*this)(0,
i);
710 for (
int i=0;
i<Nc;
i++) {
711 recon(0,
i) = (*this)(0,
i);
712 recon(1,
i) = (*this)(1,
i);
713 recon(2,
i) = j*(*this)(1,
i);
714 recon(3,
i) = j*(*this)(0,
i);
723 for (
int i=0;
i<Nc;
i++) {
724 recon(0,
i) = (*this)(0,
i);
725 recon(1,
i) = (*this)(1,
i);
726 recon(2,
i) = -(*this)(1,
i);
727 recon(3,
i) = (*this)(0,
i);
732 for (
int i=0;
i<Nc;
i++) {
733 recon(0,
i) = (*this)(0,
i);
734 recon(1,
i) = (*this)(1,
i);
735 recon(2,
i) = (*this)(1,
i);
736 recon(3,
i) = -(*this)(0,
i);
745 for (
int i=0;
i<Nc;
i++) {
746 recon(0,
i) = (*this)(0,
i);
747 recon(1,
i) = (*this)(1,
i);
748 recon(2,
i) = -j*(*this)(0,
i);
749 recon(3,
i) = j*(*this)(1,
i);
754 for (
int i=0;
i<Nc;
i++) {
755 recon(0,
i) = (*this)(0,
i);
756 recon(1,
i) = (*this)(1,
i);
757 recon(2,
i) = j*(*this)(0,
i);
758 recon(3,
i) = -j*(*this)(1,
i);
767 for (
int i=0;
i<Nc;
i++) {
768 recon(0,
i) = (*this)(0,
i);
769 recon(1,
i) = (*this)(1,
i);
776 for (
int i=0;
i<Nc;
i++) {
779 recon(2,
i) = (*this)(0,
i);
780 recon(3,
i) = (*this)(1,
i);
803 __device__ __host__
inline const complex<Float>&
operator()(
int s,
int c)
const {
return data[
s*Nc +
c]; }
832 for (
int s=0;
s<Ns;
s++) {
833 for (
int c=0;
c<Nc;
c++) {
848 template<
typename Float,
int Nc,
int Ns> __device__ __host__
inline 855 for (
int i=0;
i<Nc;
i++) {
857 for(
int j=0; j<Nc; j++) {
859 out(j,
i).real(
a(0,j).real() *
b(0,
i).real() );
860 out(j,
i).real(
out(j,
i).real() +
a(0,j).imag() *
b(0,
i).imag() );
861 out(j,
i).imag(
a(0,j).imag() *
b(0,
i).real() );
862 out(j,
i).imag(
out(j,
i).imag() -
a(0,j).real() *
b(0,
i).imag() );
866 for (
int s=1;
s<Ns;
s++) {
867 out(j,
i).real(
out(j,
i).real() +
a(
s,j).real() *
b(
s,
i).real() );
868 out(j,
i).real(
out(j,
i).real() +
a(
s,j).imag() *
b(
s,
i).imag() );
869 out(j,
i).imag(
out(j,
i).imag() +
a(
s,j).imag() *
b(
s,
i).real() );
870 out(j,
i).imag(
out(j,
i).imag() -
a(
s,j).real() *
b(
s,
i).imag() );
884 template<
typename Float,
int Nc,
int Ns> __device__ __host__
inline 890 for (
int i=0;
i<Nc;
i++) {
892 for (
int s=0;
s<Ns;
s++) {
893 z.data[
s*Nc +
i] =
x.data[
s*Nc +
i] +
y.data[
s*Nc +
i];
906 template<
typename Float,
int Nc,
int Ns> __device__ __host__
inline 912 for (
int i=0;
i<Nc;
i++) {
914 for (
int s=0;
s<Ns;
s++) {
915 z.data[
s*Nc +
i] =
x.data[
s*Nc +
i] -
y.data[
s*Nc +
i];
928 template<
typename Float,
int Nc,
int Ns,
typename S> __device__ __host__
inline 934 for (
int i=0;
i<Nc;
i++) {
936 for (
int s=0;
s<Ns;
s++) {
937 y.data[
s*Nc +
i] =
a *
x.data[
s*Nc +
i];
950 template<
typename Float,
int Nc,
int Ns> __device__ __host__
inline 956 for (
int i=0;
i<Nc;
i++) {
958 for (
int s=0;
s<Ns;
s++) {
959 y.data[
s*Nc +
i].x = A(
i,0).real() *
x.data[
s*Nc + 0].real();
960 y.data[
s*Nc +
i].x -= A(
i,0).imag() *
x.data[
s*Nc + 0].imag();
961 y.data[
s*Nc +
i].y = A(
i,0).real() *
x.data[
s*Nc + 0].imag();
962 y.data[
s*Nc +
i].y += A(
i,0).imag() *
x.data[
s*Nc + 0].real();
965 for (
int j=1; j<Nc; j++) {
967 for (
int s=0;
s<Ns;
s++) {
968 y.data[
s*Nc +
i].x += A(
i,j).real() *
x.data[
s*Nc + j].real();
969 y.data[
s*Nc +
i].x -= A(
i,j).imag() *
x.data[
s*Nc + j].imag();
970 y.data[
s*Nc +
i].y += A(
i,j).real() *
x.data[
s*Nc + j].imag();
971 y.data[
s*Nc +
i].y += A(
i,j).imag() *
x.data[
s*Nc + j].real();
985 template<
typename Float,
int Nc,
int Ns> __device__ __host__
inline 989 constexpr
int N = Nc*Ns;
992 for (
int i=0;
i<N;
i++) {
994 y.data[
i].x = A(
i,0).real() *
x.data[0].real();
995 y.data[
i].y = A(
i,0).real() *
x.data[0].imag();
997 y.data[
i].x = A(
i,0).real() *
x.data[0].real();
998 y.data[
i].x -= A(
i,0).imag() *
x.data[0].imag();
999 y.data[
i].y = A(
i,0).real() *
x.data[0].imag();
1000 y.data[
i].y += A(
i,0).imag() *
x.data[0].real();
1003 for (
int j=1; j<N; j++) {
1005 y.data[
i].x += A(
i,j).real() *
x.data[j].real();
1006 y.data[
i].y += A(
i,j).real() *
x.data[j].imag();
1008 y.data[
i].x += A(
i,j).real() *
x.data[j].real();
1009 y.data[
i].x -= A(
i,j).imag() *
x.data[j].imag();
1010 y.data[
i].y += A(
i,j).real() *
x.data[j].imag();
1011 y.data[
i].y += A(
i,j).imag() *
x.data[j].real();
__device__ __host__ ColorSpinor< Float, Nc, 2 > & operator=(const ColorSpinor< Float, Nc, 2 > &a)
__device__ __host__ ColorSpinor< Float, Nc, Ns > & operator+=(const ColorSpinor< Float, Nc, Ns > &a)
__device__ __host__ ColorSpinor< Float, Nc, 2 > chiral_project(int chirality) const
Project four-component spinor to either chirality.
__device__ __host__ void toNonRel()
Transform from relativistic into non-relavisitic basis Required normalization factor of 1/2 included ...
__device__ __host__ ColorSpinor< Float, Nc, 2 > & operator+=(const ColorSpinor< Float, Nc, 2 > &a)
__device__ __host__ ColorSpinor< Float, Nc, 4 > gamma(int dim)
colorspinor_wrapper is an internal class that is used to wrap instances of colorspinor accessors...
static __inline__ dim3 dim3 void size_t cudaStream_t int dim
__device__ __host__ ColorSpinor< Float, Nc, 2 > project(int dim, int sign)
__device__ __host__ complex< Float > & operator()(int idx)
1-d accessor functor
__device__ __host__ complex< Float > & operator()(int idx)
1-d accessor functor
__device__ __host__ Matrix< complex< Float >, Nc > outerProdSpinTrace(const ColorSpinor< Float, Nc, Ns > &a, const ColorSpinor< Float, Nc, Ns > &b)
__device__ __host__ const complex< Float > & operator()(int s, int c) const
2-d accessor functor
__device__ __host__ const complex< Float > & operator()(int idx) const
1-d accessor functor
This is just a dummy structure we use for trove to define the required structure size.
__device__ __host__ ColorSpinor< Float, Nc, 4 > & operator=(const ColorSpinor< Float, Nc, 4 > &a)
int printf(const char *,...) __attribute__((__format__(__printf__
__device__ __host__ ColorSpinor< Float, Nc, 4 > sigma(int mu, int nu)
__device__ __host__ ColorSpinor< Float, Nc, Ns > operator-(const ColorSpinor< Float, Nc, Ns > &x, const ColorSpinor< Float, Nc, Ns > &y)
ColorSpinor subtraction operator.
Specialized container for Hermitian matrices (e.g., used for wrapping clover matrices) ...
complex< Float > data[Nc *Ns]
__device__ __host__ const complex< Float > & operator()(int idx) const
1-d accessor functor
__device__ __host__ const complex< Float > & operator()(int idx) const
1-d accessor functor
__device__ __host__ const complex< Float > & operator()(int s, int c) const
2-d accessor functor
__device__ __host__ ColorSpinor< Float, Nc, Ns > & operator=(const ColorSpinor< Float, Nc, Ns > &a)
__device__ __host__ ColorSpinor< Float, Nc, 4 > igamma(int dim)
colorspinor_ghost_wrapper is an internal class that is used to wrap instances of colorspinor accessor...
cpuColorSpinorField * out
__device__ __host__ complex< Float > & operator()(int idx)
1-d accessor functor
__device__ __host__ ColorSpinor< Float, Nc, Ns > operator+(const ColorSpinor< Float, Nc, Ns > &x, const ColorSpinor< Float, Nc, Ns > &y)
ColorSpinor addition operator.
__device__ __host__ void print()
__device__ __host__ void print()
__device__ __host__ ColorSpinor< Float, Nc, 4 > chiral_reconstruct(int chirality) const
Reconstruct twor-component spinor to a four-component spinor.
__device__ __host__ ColorSpinor< Float, Nc, Ns > operator*(const S &a, const ColorSpinor< Float, Nc, Ns > &x)
Compute the scalar-vector product y = a * x.
__device__ __host__ const complex< Float > & operator()(int s, int c) const
2-d accessor functor
__device__ __host__ void toRel()
Transform from non-relativistic into relavisitic basis.
__device__ __host__ ColorSpinor< Float, Nc, 4 > & operator+=(const ColorSpinor< Float, Nc, 4 > &a)
__device__ __host__ ColorSpinor< Float, Nc, 4 > reconstruct(int dim, int sign)
Spin reconstruct the full Spinor from the projected spinor.
__device__ __host__ complex< Float > & operator()(int s, int c)
2-d accessor functor
__device__ __host__ complex< Float > & operator()(int s, int c)
2-d accessor functor
__device__ __host__ complex< Float > & operator()(int s, int c)
2-d accessor functor