QDP++
qdp_primspinvec.h
Go to the documentation of this file.
1// -*- C++ -*-
2
6
7
8#ifndef QDP_PRIMSPINVEC_H
9#define QDP_PRIMSPINVEC_H
10
11namespace QDP {
12
13
14//-------------------------------------------------------------------------------------
22
24
31
32template <class T, int N> class PSpinVector
33{
34public:
37
38 template<class T1>
39 inline
41 {
42 for(int i=0; i < N; i++)
43 elem(i) = rhs.elem(i);
44
45 return *this;
46 }
47
48 template<class T1>
49 inline
51 {
52 return assign(rhs);
53 }
54
56 template<class T1>
57 inline
59 {
60 for(int i=0; i < N; ++i)
61 elem(i) += rhs.elem(i);
62
63 return *this;
64 }
65
66
67 template<class T1>
68 inline
70 {
71 for(int i=0; i < N; ++i)
72 elem(i) *= rhs.elem();
73
74 return *this;
75 }
76
77 template<class T1>
78 inline
80 {
81 for(int i=0; i < N; ++i)
82 elem(i) -= rhs.elem(i);
83
84 return *this;
85 }
86
88 template<class T1>
89 inline
91 {
92 for(int i=0; i < N; ++i)
93 elem(i) /= rhs.elem();
94
95 return *this;
96 }
97
98 T& elem(int i) {return F[i];}
99 const T& elem(int i) const {return F[i];}
100private:
101 T F[N] QDP_ALIGN16;
102};
103
105template<class T, int N>
106inline
107std::istream& operator>>(std::istream& s, PSpinVector<T,N>& d)
108{
109 for(int i=0; i < N; ++i)
110 s >> d.elem(i);
111
112 return s;
113}
114
115template<class T, int N>
116inline
118{
119 for(int i=0; i < N; ++i)
120 s >> d.elem(i);
121
122 return s;
123}
124
125template<class T, int N>
126inline
127std::ostream& operator<<(std::ostream& s, const PSpinVector<T,N>& d)
128{
129 for(int i=0; i < N; ++i)
130 s << d.elem(i);
131
132 return s;
133}
134
136template<class T, int N>
137inline
139{
140 for(int i=0; i < N; ++i)
141 s << d.elem(i);
142
143 return s;
144}
145
146
148template<class T, int N>
149inline
151{
152 for(int i=0; i < N; ++i)
153 txt >> d.elem(i);
154
155 return txt;
156}
157
159template<class T, int N>
160inline
162{
163 for(int i=0; i < N; ++i)
164 txt << d.elem(i);
165
166 return txt;
167}
168
169#ifdef QDP_USE_LIBXML2
171template<class T, int N>
172inline
173XMLWriter& operator<<(XMLWriter& xml, const PSpinVector<T,N>& d)
174{
175 xml.openTag("SpinVector");
176
177 XMLWriterAPI::AttributeList alist;
178
179 // Copy into another array first
180 for(int i=0; i < N; ++i)
181 {
182 alist.clear();
183 alist.push_back(XMLWriterAPI::Attribute("row", i));
184
185 xml.openTag("elem", alist);
186 xml << d.elem(i);
187 xml.closeTag();
188 }
189
190 xml.closeTag(); // Vector
191 return xml;
192}
193#endif
194
195
196
197
198
199
200// Primitive Vectors
201template<class T1, int N>
202inline typename UnaryReturn<PSpinVector<T1,N>, OpUnaryPlus>::Type_t
204{
206
207 for(int i=0; i < N; ++i)
208 d.elem(i) = +l.elem(i);
209 return d;
210}
211
212
213template<class T1, int N>
216{
218
219 for(int i=0; i < N; ++i)
220 d.elem(i) = -l.elem(i);
221 return d;
222}
223
224
225template<class T1, class T2, int N>
226inline typename BinaryReturn<PSpinVector<T1,N>, PSpinVector<T2,N>, OpAdd>::Type_t
228{
230
231 for(int i=0; i < N; ++i)
232 d.elem(i) = l.elem(i) + r.elem(i);
233 return d;
234}
235
236
237template<class T1, class T2, int N>
238inline typename BinaryReturn<PSpinVector<T1,N>, PSpinVector<T2,N>, OpSubtract>::Type_t
240{
242
243 for(int i=0; i < N; ++i)
244 d.elem(i) = l.elem(i) - r.elem(i);
245 return d;
246}
247
248
249// PSpinVector * PScalar
250template<class T1, class T2, int N>
251inline typename BinaryReturn<PSpinVector<T1,N>, PScalar<T2>, OpMultiply>::Type_t
253{
255
256 for(int i=0; i < N; ++i)
257 d.elem(i) = l.elem(i) * r.elem();
258 return d;
259}
260
261// Optimized PSpinVector * adj(PScalar)
262template<class T1, class T2, int N>
263inline typename BinaryReturn<PSpinVector<T1,N>, PScalar<T2>, OpMultiplyAdj>::Type_t
265{
267
268 for(int i=0; i < N; ++i)
269 d.elem(i) = multiplyAdj(l.elem(i), r.elem());
270 return d;
271}
272
273
274// PScalar * PSpinVector
275template<class T1, class T2, int N>
276inline typename BinaryReturn<PScalar<T1>, PSpinVector<T2,N>, OpMultiply>::Type_t
278{
280
281 for(int i=0; i < N; ++i)
282 d.elem(i) = l.elem() * r.elem(i);
283 return d;
284}
285
286// Optimized adj(PScalar) * PSpinVector
287template<class T1, class T2, int N>
288inline typename BinaryReturn<PScalar<T1>, PSpinVector<T2,N>, OpAdjMultiply>::Type_t
290{
292
293 for(int i=0; i < N; ++i)
294 d.elem(i) = adjMultiply(l.elem(), r.elem(i));
295 return d;
296}
297
298
299// PMatrix * PSpinVector
300template<class T1, class T2, int N>
301inline typename BinaryReturn<PSpinMatrix<T1,N>, PSpinVector<T2,N>, OpMultiply>::Type_t
303{
305
306 for(int i=0; i < N; ++i)
307 {
308 d.elem(i) = l.elem(i,0) * r.elem(0);
309 for(int j=1; j < N; ++j)
310 d.elem(i) += l.elem(i,j) * r.elem(j);
311 }
312
313 return d;
314}
315
316
317// PMatrix * PSpinVector
318template<class T1, class T2, template<class,int> class C, int N>
319inline typename BinaryReturn<PMatrix<T1,N,C>, PSpinVector<T2,N>, OpMultiply>::Type_t
321{
323
324 for(int i=0; i < N; ++i)
325 {
326 d.elem(i) = l.elem(i,0) * r.elem(0);
327 for(int j=1; j < N; ++j)
328 d.elem(i) += l.elem(i,j) * r.elem(j);
329 }
330
331 return d;
332}
333
334// Optimized adj(PMatrix)*PSpinVector
335template<class T1, class T2, int N>
336inline typename BinaryReturn<PSpinMatrix<T1,N>, PSpinVector<T2,N>, OpAdjMultiply>::Type_t
338{
340
341 for(int i=0; i < N; ++i)
342 {
343 d.elem(i) = adjMultiply(l.elem(0,i), r.elem(0));
344 for(int j=1; j < N; ++j)
345 d.elem(i) += adjMultiply(l.elem(j,i), r.elem(j));
346 }
347
348 return d;
349}
350
351// Optimized adj(PMatrix)*PVector
352template<class T1, class T2, int N, template<class,int> class C1>
353inline typename BinaryReturn<PMatrix<T1,N,C1>, PSpinVector<T2,N>, OpAdjMultiply>::Type_t
355{
357
358 for(int i=0; i < N; ++i)
359 {
360 d.elem(i) = adjMultiply(l.elem(0,i), r.elem(0));
361 for(int j=1; j < N; ++j)
362 d.elem(i) += adjMultiply(l.elem(j,i), r.elem(j));
363 }
364
365 return d;
366}
367
368template<class T1, class T2, int N>
369inline typename BinaryReturn<PSpinVector<T1,N>, PScalar<T2>, OpDivide>::Type_t
371{
373
374 for(int i=0; i < N; ++i)
375 d.elem(i) = l.elem(i) / r.elem();
376 return d;
377}
378
379
380
382template<class T, int N>
385{
387
388 for(int i=0; i < N; ++i)
389 d.elem(i) = real(s1.elem(i));
390
391 return d;
392}
393
394
396template<class T, int N>
399{
401
402 for(int i=0; i < N; ++i)
403 d.elem(i) = imag(s1.elem(i));
404
405 return d;
406}
407
408
410template<class T1, class T2, int N>
411inline typename BinaryReturn<PSpinVector<T1,N>, PSpinVector<T2,N>, FnCmplx>::Type_t
413{
415
416 for(int i=0; i < N; ++i)
417 d.elem(i) = cmplx(s1.elem(i), s2.elem(i));
418
419 return d;
420}
421
422
423//-----------------------------------------------------------------------------
424// These functions always return bool
426template<class T1, int N>
428 bool Type_t;
429};
430
431template<class T1, int N>
432inline bool
434{
435 bool d = false;
436
437 for(int i=0; i < N; ++i)
438 d |= isnan(l.elem(i));
439
440 return d;
441}
442
444template<class T1, int N>
446 bool Type_t;
447};
448
449template<class T1, int N>
450inline bool
452{
453 bool d = false;
454
455 for(int i=0; i < N; ++i)
456 d |= isinf(l.elem(i));
457
458 return d;
459}
460
462template<class T1, int N>
464 bool Type_t;
465};
466
467template<class T1, int N>
468inline bool
470{
471 bool d = true;
472
473 for(int i=0; i < N; ++i)
474 d &= isnormal(l.elem(i));
475
476 return d;
477}
478
480template<class T1, int N>
482 bool Type_t;
483};
484
485template<class T1, int N>
486inline bool
488{
489 bool d = true;
490
491 for(int i=0; i < N; ++i)
492 d &= isfinite(l.elem(i));
493
494 return d;
495}
496
497
498//-----------------------------------------------------------------------------
499// Functions
500// Conjugate
501template<class T1, int N>
504{
506
507 for(int i=0; i < N; ++i)
508 d.elem(i) = conj(l.elem(i));
509
510 return d;
511}
512
514template<class T, int N>
517{
519
520 for(int i=0; i < N; ++i)
521 d.elem(i) = timesI(s1.elem(i));
522
523 return d;
524}
525
527template<class T, int N>
530{
532
533 for(int i=0; i < N; ++i)
534 d.elem(i) = timesMinusI(s1.elem(i));
535
536 return d;
537}
538
539
541
542template<class T, int N>
543inline typename UnaryReturn<PSpinVector<T,N>, FnGetSite>::Type_t
544getSite(const PSpinVector<T,N>& s1, int innersite)
545{
547
548 for(int i=0; i < N; ++i)
549 d.elem(i) = getSite(s1.elem(i), innersite);
550
551 return d;
552}
553
555
556template<class T, int N>
557inline typename UnaryReturn<PSpinVector<T,N>, FnPeekColorVector>::Type_t
558peekColor(const PSpinVector<T,N>& l, int row)
559{
561
562 for(int i=0; i < N; ++i)
563 d.elem(i) = peekColor(l.elem(i),row);
564 return d;
565}
566
568
569template<class T, int N>
570inline typename UnaryReturn<PSpinVector<T,N>, FnPeekColorMatrix>::Type_t
571peekColor(const PSpinVector<T,N>& l, int row, int col)
572{
574
575 for(int i=0; i < N; ++i)
576 d.elem(i) = peekColor(l.elem(i),row,col);
577 return d;
578}
579
580
582
583template<class T, int N>
584inline typename UnaryReturn<PSpinVector<T,N>, FnPeekSpinMatrix>::Type_t
585peekSpin(const PSpinVector<T,N>& l, int row, int col)
586{
588
589 for(int i=0; i < N; ++i)
590 d.elem(i) = peekSpin(l.elem(i),row,col);
591 return d;
592}
593
595
596template<class T1, class T2, int N>
597inline typename UnaryReturn<PSpinVector<T1,N>, FnPokeColorVector>::Type_t&
599{
601
602 for(int i=0; i < N; ++i)
603 pokeColor(l.elem(i),r.elem(i),row);
604 return static_cast<Return_t&>(l);
605}
606
608
609template<class T1, class T2, int N>
610inline typename UnaryReturn<PSpinVector<T1,N>, FnPokeColorVector>::Type_t&
611pokeColor(PSpinVector<T1,N>& l, const PSpinVector<T2,N>& r, int row, int col)
612{
614
615 for(int i=0; i < N; ++i)
616 pokeColor(l.elem(i),r.elem(i),row,col);
617 return static_cast<Return_t&>(l);
618}
619
621
622template<class T1, class T2, int N>
623inline typename UnaryReturn<PSpinVector<T1,N>, FnPokeSpinVector>::Type_t&
625{
627
628 for(int i=0; i < N; ++i)
629 pokeSpin(l.elem(i),r.elem(i),row);
630 return static_cast<Return_t&>(l);
631}
632
634
635template<class T1, class T2, int N>
636inline typename UnaryReturn<PSpinVector<T1,N>, FnPokeSpinVector>::Type_t&
637pokeSpin(PSpinVector<T1,N>& l, const PSpinVector<T2,N>& r, int row, int col)
638{
640
641 for(int i=0; i < N; ++i)
642 pokeSpin(l.elem(i),r.elem(i),row,col);
643 return static_cast<Return_t&>(l);
644}
645
646
648template<class T, int N>
649inline void
651{
652 for(int i=0; i < N; ++i)
653 zero_rep(dest.elem(i));
654}
655
657template<class T, class T1, int N>
658inline void
660{
661 for(int i=0; i < N; ++i)
662 copymask(d.elem(i),mask.elem(),s1.elem(i));
663}
664
665
667template<class T, class T1, int N>
668inline void
670{
671 for(int i=0; i < N; ++i)
672 copy_site(d.elem(i), isite, s1.elem(i));
673}
674
676template<class T, class T1, int N>
677inline void
678copy_site(PSpinVector<T,N>& d, int isite, const PScalar<T1>& s1)
679{
680 for(int i=0; i < N; ++i)
681 copy_site(d.elem(i), isite, s1.elem());
682}
683
684
686template<class T, class T1, int N>
687inline void
689 const PSpinVector<T1,N>& s0, int i0,
690 const PSpinVector<T1,N>& s1, int i1,
691 const PSpinVector<T1,N>& s2, int i2,
692 const PSpinVector<T1,N>& s3, int i3)
693{
694 for(int i=0; i < N; ++i)
695 gather_sites(d.elem(i),
696 s0.elem(i), i0,
697 s1.elem(i), i1,
698 s2.elem(i), i2,
699 s3.elem(i), i3);
700}
701
702
703
704#if 0
705// Global sum over site indices only
706template<class T, int N>
707struct UnaryReturn<PSpinVector<T,N>, FnSum > {
708 typedef PSpinVectortypename UnaryReturn<T, FnSum>::Type_t, N> Type_t;
709};
710
711template<class T, int N>
712inline typename UnaryReturn<PSpinVector<T,N>, FnSum>::Type_t
713sum(const PSpinVector<T,N>& s1)
714{
715 typename UnaryReturn<PSpinVector<T,N>, FnSum>::Type_t d;
716
717 for(int i=0; i < N; ++i)
718 d.elem(i) = sum(s1.elem(i));
719
720 return d;
721}
722#endif
723
724
725
726
727template<class T, int N>
728inline typename UnaryReturn<PSpinVector<T,N>, FnLocalNorm2>::Type_t
730{
732
733 d.elem() = localNorm2(s1.elem(0));
734 for(int i=1; i < N; ++i)
735 d.elem() += localNorm2(s1.elem(i));
736
737 return d;
738}
739
740
741
742
744
748template<class T1, class T2, class T3, int N>
752
753template<class T1, class T2, class T3, int N>
756{
758
759 // Not optimal - want to have where outside assignment
760 for(int i=0; i < N; ++i)
761 d.elem(i) = where(a.elem(), b.elem(i), c.elem(i));
762
763 return d;
764}
765
766
768
771
772
774
779
780 // end of group primspinvec
782
783//-----------------------------------------------------------------------------
784// Traits classes
785//-----------------------------------------------------------------------------
786
787// Underlying word type
788template<class T1, int N>
789struct WordType<PSpinVector<T1,N> >
790{
791 typedef typename WordType<T1>::Type_t Type_t;
792};
793
794// Fixed Precision
795template<class T1, int N>
800
801template<class T1, int N>
806
807// Internally used scalars
808template<class T, int N>
812
813// Makes a primitive into a scalar leaving grid alone
814template<class T, int N>
818
819// Makes a lattice scalar leaving primitive indices alone
820template<class T, int N>
824
825//-----------------------------------------------------------------------------
826// Traits classes to support return types
827//-----------------------------------------------------------------------------
828
829// Default unary(PSpinVector) -> PSpinVector
830template<class T1, int N, class Op>
834// Default binary(PScalar,PSpinVector) -> PSpinVector
835template<class T1, class T2, int N, class Op>
839
840// Default binary(PSpinMatrix,PSpinVector) -> PSpinVector
841template<class T1, class T2, int N, class Op>
845
846
847// Default binary(PMatrix,PSpinVector) -> PSpinVector
848template<class T1, class T2, int N, template <class,int> class C1, class Op>
852
853
854// Default binary(PSpinVector,PScalar) -> PSpinVector
855template<class T1, class T2, int N, class Op>
859
860// Default binary(PSpinVector,PSpinVector) -> PSpinVector
861template<class T1, class T2, int N, class Op>
865
866
867#if 0
868template<class T1, class T2>
869struct UnaryReturn<PScalar<T2>, OpCast<T1> > {
871// typedef T1 Type_t;
872};
873#endif
874
875
876// Assignment is different
877template<class T1, class T2, int N>
881
882template<class T1, class T2, int N>
886
887template<class T1, class T2, int N>
891
892template<class T1, class T2, int N>
896
897template<class T1, class T2, int N>
901
902
903
904// SpinVector
905template<class T, int N>
909
910template<class T, int N>
914
915template<class T, int N>
919
920template<class T1, class T2, int N>
924
925template<class T1, class T2, int N>
929
930template<class T1, class T2, int N>
934
935template<class T1, class T2, int N>
939
940
941template<class T1, class T2, int N>
944{
946
947 d.elem() = localInnerProduct(s1.elem(0), s2.elem(0));
948 for(int i=1; i < N; ++i)
949 d.elem() += localInnerProduct(s1.elem(i), s2.elem(i));
950
951 return d;
952}
953
954template<class T1, class T2, int N>
955inline PScalar<typename BinaryReturn<T1, T2, FnLocalInnerProductReal>::Type_t>
957{
959
960 d.elem() = localInnerProductReal(s1.elem(0), s2.elem(0));
961 for(int i=1; i < N; ++i)
962 d.elem() += localInnerProductReal(s1.elem(i), s2.elem(i));
963
964 return d;
965}
966
967// Gamma algebra
968template<int m, class T2, int N>
972
973template<class T2, int N>
977
978// Gamma algebra
979template<int m, class T2, int N>
983
984template<class T2, int N>
988
989// Generic Spin projection
990template<class T, int N>
994
995// spin projection for each direction
996template<class T, int N>
1000
1001template<class T, int N>
1005
1006template<class T, int N>
1010
1011template<class T, int N>
1015
1016template<class T, int N>
1020
1021template<class T, int N>
1025
1026template<class T, int N>
1030
1031template<class T, int N>
1035
1036
1037// Generic Spin reconstruction
1038template<class T, int N>
1042
1043// spin reconstruction for each direction
1044template<class T, int N>
1048
1049template<class T, int N>
1053
1054template<class T, int N>
1058
1059template<class T, int N>
1063
1064template<class T, int N>
1068
1069template<class T, int N>
1073
1074template<class T, int N>
1078
1079template<class T, int N>
1083
1084
1085
1086
1088template<class T, int N, class T1, class T2>
1089inline void
1090fill_random(PSpinVector<T,N>& d, T1& seed, T2& skewed_seed, const T1& seed_mult)
1091{
1092 // Loop over rows the slowest
1093 for(int i=0; i < N; ++i)
1094 fill_random(d.elem(i), seed, skewed_seed, seed_mult);
1095}
1096
1097
1099template<class T, int N>
1100inline void
1102{
1103 for(int i=0; i < N; ++i)
1104 fill_gaussian(d.elem(i), r1.elem(i), r2.elem(i));
1105}
1106
1107//-----------------------------------------------------------------------------
1108// Operators
1109//-----------------------------------------------------------------------------
1110
1113
1114// Peeking and poking
1116template<class T, int N>
1120
1121template<class T, int N>
1123peekSpin(const PSpinVector<T,N>& l, int row)
1124{
1126
1127 // Note, do not need to propagate down since the function is eaten at this level
1128 d.elem() = l.elem(row);
1129 return d;
1130}
1131
1133template<class T1, class T2, int N>
1134inline PSpinVector<T1,N>&
1136{
1137 // Note, do not need to propagate down since the function is eaten at this level
1138 l.elem(row) = r.elem();
1139 return l;
1140}
1141
1142
1143
1144// SpinVector<4> = Gamma<4,m> * SpinVector<4>
1145// There are 16 cases here for Nd=4
1146template<class T2>
1147inline typename BinaryReturn<GammaConst<4,0>, PSpinVector<T2,4>, OpGammaConstMultiply>::Type_t
1149{
1151
1152 d.elem(0) = r.elem(0);
1153 d.elem(1) = r.elem(1);
1154 d.elem(2) = r.elem(2);
1155 d.elem(3) = r.elem(3);
1156
1157 return d;
1158}
1159
1160template<class T2>
1161inline typename BinaryReturn<GammaConst<4,1>, PSpinVector<T2,4>, OpGammaConstMultiply>::Type_t
1163{
1165
1166 d.elem(0) = timesI(r.elem(3));
1167 d.elem(1) = timesI(r.elem(2));
1168 d.elem(2) = timesMinusI(r.elem(1));
1169 d.elem(3) = timesMinusI(r.elem(0));
1170
1171 return d;
1172}
1173
1174template<class T2>
1175inline typename BinaryReturn<GammaConst<4,2>, PSpinVector<T2,4>, OpGammaConstMultiply>::Type_t
1177{
1179
1180 d.elem(0) = -r.elem(3);
1181 d.elem(1) = r.elem(2);
1182 d.elem(2) = r.elem(1);
1183 d.elem(3) = -r.elem(0);
1184
1185 return d;
1186}
1187
1188template<class T2>
1189inline typename BinaryReturn<GammaConst<4,3>, PSpinVector<T2,4>, OpGammaConstMultiply>::Type_t
1191{
1193
1194 d.elem(0) = timesMinusI(r.elem(0));
1195 d.elem(1) = timesI(r.elem(1));
1196 d.elem(2) = timesMinusI(r.elem(2));
1197 d.elem(3) = timesI(r.elem(3));
1198
1199 return d;
1200}
1201
1202template<class T2>
1203inline typename BinaryReturn<GammaConst<4,4>, PSpinVector<T2,4>, OpGammaConstMultiply>::Type_t
1205{
1207
1208 d.elem(0) = timesI(r.elem(2));
1209 d.elem(1) = timesMinusI(r.elem(3));
1210 d.elem(2) = timesMinusI(r.elem(0));
1211 d.elem(3) = timesI(r.elem(1));
1212
1213 return d;
1214}
1215
1216template<class T2>
1217inline typename BinaryReturn<GammaConst<4,5>, PSpinVector<T2,4>, OpGammaConstMultiply>::Type_t
1219{
1221
1222 d.elem(0) = -r.elem(1);
1223 d.elem(1) = r.elem(0);
1224 d.elem(2) = -r.elem(3);
1225 d.elem(3) = r.elem(2);
1226
1227 return d;
1228}
1229
1230template<class T2>
1231inline typename BinaryReturn<GammaConst<4,6>, PSpinVector<T2,4>, OpGammaConstMultiply>::Type_t
1233{
1235
1236 d.elem(0) = timesMinusI(r.elem(1));
1237 d.elem(1) = timesMinusI(r.elem(0));
1238 d.elem(2) = timesMinusI(r.elem(3));
1239 d.elem(3) = timesMinusI(r.elem(2));
1240
1241 return d;
1242}
1243
1244template<class T2>
1245inline typename BinaryReturn<GammaConst<4,7>, PSpinVector<T2,4>, OpGammaConstMultiply>::Type_t
1247{
1249
1250 d.elem(0) = r.elem(2);
1251 d.elem(1) = r.elem(3);
1252 d.elem(2) = -r.elem(0);
1253 d.elem(3) = -r.elem(1);
1254
1255 return d;
1256}
1257
1258template<class T2>
1259inline typename BinaryReturn<GammaConst<4,8>, PSpinVector<T2,4>, OpGammaConstMultiply>::Type_t
1261{
1263
1264 d.elem(0) = r.elem(2);
1265 d.elem(1) = r.elem(3);
1266 d.elem(2) = r.elem(0);
1267 d.elem(3) = r.elem(1);
1268
1269 return d;
1270}
1271
1272template<class T2>
1273inline typename BinaryReturn<GammaConst<4,9>, PSpinVector<T2,4>, OpGammaConstMultiply>::Type_t
1275{
1277
1278 d.elem(0) = timesI(r.elem(1));
1279 d.elem(1) = timesI(r.elem(0));
1280 d.elem(2) = timesMinusI(r.elem(3));
1281 d.elem(3) = timesMinusI(r.elem(2));
1282
1283 return d;
1284}
1285
1286template<class T2>
1287inline typename BinaryReturn<GammaConst<4,10>, PSpinVector<T2,4>, OpGammaConstMultiply>::Type_t
1289{
1291
1292 d.elem(0) = -r.elem(1);
1293 d.elem(1) = r.elem(0);
1294 d.elem(2) = r.elem(3);
1295 d.elem(3) = -r.elem(2);
1296
1297 return d;
1298}
1299
1300template<class T2>
1301inline typename BinaryReturn<GammaConst<4,11>, PSpinVector<T2,4>, OpGammaConstMultiply>::Type_t
1303{
1305
1306 d.elem(0) = timesMinusI(r.elem(2));
1307 d.elem(1) = timesI(r.elem(3));
1308 d.elem(2) = timesMinusI(r.elem(0));
1309 d.elem(3) = timesI(r.elem(1));
1310
1311 return d;
1312}
1313
1314template<class T2>
1315inline typename BinaryReturn<GammaConst<4,12>, PSpinVector<T2,4>, OpGammaConstMultiply>::Type_t
1317{
1319
1320 d.elem(0) = timesI(r.elem(0));
1321 d.elem(1) = timesMinusI(r.elem(1));
1322 d.elem(2) = timesMinusI(r.elem(2));
1323 d.elem(3) = timesI(r.elem(3));
1324
1325 return d;
1326}
1327
1328template<class T2>
1329inline typename BinaryReturn<GammaConst<4,13>, PSpinVector<T2,4>, OpGammaConstMultiply>::Type_t
1331{
1333
1334 d.elem(0) = -r.elem(3);
1335 d.elem(1) = r.elem(2);
1336 d.elem(2) = -r.elem(1);
1337 d.elem(3) = r.elem(0);
1338
1339 return d;
1340}
1341
1342template<class T2>
1343inline typename BinaryReturn<GammaConst<4,14>, PSpinVector<T2,4>, OpGammaConstMultiply>::Type_t
1345{
1347
1348 d.elem(0) = timesMinusI(r.elem(3));
1349 d.elem(1) = timesMinusI(r.elem(2));
1350 d.elem(2) = timesMinusI(r.elem(1));
1351 d.elem(3) = timesMinusI(r.elem(0));
1352
1353 return d;
1354}
1355
1356template<class T2>
1357inline typename BinaryReturn<GammaConst<4,15>, PSpinVector<T2,4>, OpGammaConstMultiply>::Type_t
1359{
1361
1362 d.elem(0) = r.elem(0);
1363 d.elem(1) = r.elem(1);
1364 d.elem(2) = -r.elem(2);
1365 d.elem(3) = -r.elem(3);
1366
1367 return d;
1368}
1369
1370
1371// SpinVector<2> = SpinProject(SpinVector<4>)
1372// There are 4 cases here for Nd=4 for each forward/backward direction
1373template<class T>
1376{
1378
1379 /* ( 1 0 0 -i) ( a0 ) ( a0 - i a3 )
1380 * B := ( 1 - Gamma ) A = ( 0 1 -i 0) ( a1 ) = ( a1 - i a2 )
1381 * 0 ( 0 i 1 0) ( a2 ) ( a2 + i a1 )
1382 * ( i 0 0 1) ( a3 ) ( a3 + i a0 )
1383
1384 * Therefore the top components are
1385
1386 * ( b0r + i b0i ) = ( {a0r + a3i} + i{a0i - a3r} )
1387 * ( b1r + i b1i ) ( {a1r + a2i} + i{a1i - a2r} )
1388
1389 * The bottom components of be may be reconstructed using the formula
1390
1391 * ( b2r + i b2i ) = ( {a2r - a1i} + i{a2i + a1r} ) = ( - b1i + i b1r )
1392 * ( b3r + i b3i ) ( {a3r - a0i} + i{a3i + a0r} ) ( - b0i + i b0r )
1393 */
1394 d.elem(0) = s1.elem(0) - timesI(s1.elem(3));
1395 d.elem(1) = s1.elem(1) - timesI(s1.elem(2));
1396
1397 return d;
1398}
1399
1400template<class T>
1403{
1405
1406 /* ( 1 0 0 1) ( a0 ) ( a0 + a3 )
1407 * B := ( 1 - Gamma ) A = ( 0 1 -1 0) ( a1 ) = ( a1 - a2 )
1408 * 1 ( 0 -1 1 0) ( a2 ) ( a2 - a1 )
1409 * ( 1 0 0 1) ( a3 ) ( a3 + a0 )
1410
1411 * Therefore the top components are
1412
1413 * ( b0r + i b0i ) = ( {a0r + a3r} + i{a0i + a3i} )
1414 * ( b1r + i b1i ) ( {a1r - a2r} + i{a1i - a2i} )
1415
1416 * The bottom components of be may be reconstructed using the formula
1417
1418 * ( b2r + i b2i ) = ( {a2r - a1r} + i{a2i - a1i} ) = ( - b1r - i b1i )
1419 * ( b3r + i b3i ) ( {a3r + a0r} + i{a3i + a0i} ) ( b0r + i b0i )
1420 */
1421 d.elem(0) = s1.elem(0) + s1.elem(3);
1422 d.elem(1) = s1.elem(1) - s1.elem(2);
1423
1424 return d;
1425}
1426
1427template<class T>
1430{
1432
1433 /* ( 1 0 -i 0) ( a0 ) ( a0 - i a2 )
1434 * B := ( 1 - Gamma ) A = ( 0 1 0 i) ( a1 ) = ( a1 + i a3 )
1435 * 2 ( i 0 1 0) ( a2 ) ( a2 + i a0 )
1436 * ( 0 -i 0 1) ( a3 ) ( a3 - i a1 )
1437
1438 * Therefore the top components are
1439
1440 * ( b0r + i b0i ) = ( {a0r + a2i} + i{a0i - a2r} )
1441 * ( b1r + i b1i ) ( {a1r - a3i} + i{a1i + a3r} )
1442
1443 * The bottom components of be may be reconstructed using the formula
1444
1445 * ( b2r + i b2i ) = ( {a2r - a0i} + i{a2i + a0r} ) = ( - b0i + i b0r )
1446 * ( b3r + i b3i ) ( {a3r + a1i} + i{a3i - a1r} ) ( b1i - i b1r )
1447 */
1448 d.elem(0) = s1.elem(0) - timesI(s1.elem(2));
1449 d.elem(1) = s1.elem(1) + timesI(s1.elem(3));
1450
1451 return d;
1452}
1453
1454template<class T>
1457{
1459
1460 /* ( 1 0 -1 0) ( a0 ) ( a0 - a2 )
1461 * B := ( 1 - Gamma ) A = ( 0 1 0 -1) ( a1 ) = ( a1 - a3 )
1462 * 3 (-1 0 1 0) ( a2 ) ( a2 - a0 )
1463 * ( 0 -1 0 1) ( a3 ) ( a3 - a1 )
1464
1465 * Therefore the top components are
1466
1467 * ( b0r + i b0i ) = ( {a0r - a2r} + i{a0i - a2i} )
1468 * ( b1r + i b1i ) ( {a1r - a3r} + i{a1i - a3i} )
1469
1470 * The bottom components of be may be reconstructed using the formula
1471
1472 * ( b2r + i b2i ) = ( {a2r - a0r} + i{a2i - a0i} ) = ( - b0r - i b0i )
1473 * ( b3r + i b3i ) ( {a3r - a1r} + i{a3i - a1i} ) ( - b1r - i b1i )
1474 */
1475 d.elem(0) = s1.elem(0) - s1.elem(2);
1476 d.elem(1) = s1.elem(1) - s1.elem(3);
1477
1478 return d;
1479}
1480
1481template<class T>
1484{
1486
1487 /* ( 1 0 0 +i) ( a0 ) ( a0 + i a3 )
1488 * B := ( 1 + Gamma ) A = ( 0 1 +i 0) ( a1 ) = ( a1 + i a2 )
1489 * 0 ( 0 -i 1 0) ( a2 ) ( a2 - i a1 )
1490 * (-i 0 0 1) ( a3 ) ( a3 - i a0 )
1491
1492 * Therefore the top components are
1493
1494 * ( b0r + i b0i ) = ( {a0r - a3i} + i{a0i + a3r} )
1495 * ( b1r + i b1i ) ( {a1r - a2i} + i{a1i + a2r} )
1496
1497 * The bottom components of be may be reconstructed using the formula
1498
1499 * ( b2r + i b2i ) = ( {a2r + a1i} + i{a2i - a1r} ) = ( b1i - i b1r )
1500 * ( b3r + i b3i ) ( {a3r + a0i} + i{a3i - a0r} ) ( b0i - i b0r )
1501 */
1502 d.elem(0) = s1.elem(0) + timesI(s1.elem(3));
1503 d.elem(1) = s1.elem(1) + timesI(s1.elem(2));
1504
1505 return d;
1506}
1507
1508template<class T>
1511{
1513
1514 /* ( 1 0 0 -1) ( a0 ) ( a0 - a3 )
1515 * B := ( 1 + Gamma ) A = ( 0 1 1 0) ( a1 ) = ( a1 + a2 )
1516 * 1 ( 0 1 1 0) ( a2 ) ( a2 + a1 )
1517 * (-1 0 0 1) ( a3 ) ( a3 - a0 )
1518
1519 * Therefore the top components are
1520
1521 * ( b0r + i b0i ) = ( {a0r - a3r} + i{a0i - a3i} )
1522 * ( b1r + i b1i ) ( {a1r + a2r} + i{a1i + a2i} )
1523
1524 * The bottom components of be may be reconstructed using the formula
1525
1526 * ( b2r + i b2i ) = ( {a2r + a1r} + i{a2i + a1i} ) = ( b1r + i b1i )
1527 * ( b3r + i b3i ) ( {a3r - a0r} + i{a3i - a0i} ) ( - b0r - i b0i )
1528 */
1529 d.elem(0) = s1.elem(0) - s1.elem(3);
1530 d.elem(1) = s1.elem(1) + s1.elem(2);
1531
1532 return d;
1533}
1534
1535template<class T>
1538{
1540
1541 /* ( 1 0 i 0) ( a0 ) ( a0 + i a2 )
1542 * B := ( 1 + Gamma ) A = ( 0 1 0 -i) ( a1 ) = ( a1 - i a3 )
1543 * 2 (-i 0 1 0) ( a2 ) ( a2 - i a0 )
1544 * ( 0 i 0 1) ( a3 ) ( a3 + i a1 )
1545
1546 * Therefore the top components are
1547
1548 * ( b0r + i b0i ) = ( {a0r - a2i} + i{a0i + a2r} )
1549 * ( b1r + i b1i ) ( {a1r + a3i} + i{a1i - a3r} )
1550
1551 * The bottom components of be may be reconstructed using the formula
1552
1553 * ( b2r + i b2i ) = ( {a2r + a0i} + i{a2i - a0r} ) = ( b0i - i b0r )
1554 * ( b3r + i b3i ) ( {a3r - a1i} + i{a3i + a1r} ) ( - b1i + i b1r )
1555 */
1556 d.elem(0) = s1.elem(0) + timesI(s1.elem(2));
1557 d.elem(1) = s1.elem(1) - timesI(s1.elem(3));
1558
1559 return d;
1560}
1561
1562template<class T>
1565{
1567
1568 /* ( 1 0 1 0) ( a0 ) ( a0 + a2 )
1569 * B := ( 1 + Gamma ) A = ( 0 1 0 1) ( a1 ) = ( a1 + a3 )
1570 * 3 ( 1 0 1 0) ( a2 ) ( a2 + a0 )
1571 * ( 0 1 0 1) ( a3 ) ( a3 + a1 )
1572
1573 * Therefore the top components are
1574
1575 * ( b0r + i b0i ) = ( {a0r + a2r} + i{a0i + a2i} )
1576 * ( b1r + i b1i ) ( {a1r + a3r} + i{a1i + a3i} )
1577
1578 * The bottom components of be may be reconstructed using the formula
1579
1580 * ( b2r + i b2i ) = ( {a2r + a0r} + i{a2i + a0i} ) = ( b0r + i b0i )
1581 * ( b3r + i b3i ) ( {a3r + a1r} + i{a3i + a1i} ) ( b1r + i b1i )
1582 */
1583 d.elem(0) = s1.elem(0) + s1.elem(2);
1584 d.elem(1) = s1.elem(1) + s1.elem(3);
1585
1586 return d;
1587}
1588
1589
1590// SpinVector<4> = SpinReconstruct(SpinVector<2>)
1591// There are 4 cases here for Nd=4 for each forward/backward direction
1592template<class T>
1595{
1597
1598 d.elem(0) = s1.elem(0);
1599 d.elem(1) = s1.elem(1);
1600 d.elem(2) = timesI(s1.elem(1));
1601 d.elem(3) = timesI(s1.elem(0));
1602
1603 return d;
1604}
1605
1606template<class T>
1609{
1611
1612 d.elem(0) = s1.elem(0);
1613 d.elem(1) = s1.elem(1);
1614 d.elem(2) = -s1.elem(1);
1615 d.elem(3) = s1.elem(0);
1616
1617 return d;
1618}
1619
1620
1621template<class T>
1624{
1626
1627 d.elem(0) = s1.elem(0);
1628 d.elem(1) = s1.elem(1);
1629 d.elem(2) = timesI(s1.elem(0));
1630 d.elem(3) = timesMinusI(s1.elem(1));
1631
1632 return d;
1633}
1634
1635template<class T>
1638{
1640
1641 d.elem(0) = s1.elem(0);
1642 d.elem(1) = s1.elem(1);
1643 d.elem(2) = -s1.elem(0);
1644 d.elem(3) = -s1.elem(1);
1645
1646 return d;
1647}
1648
1649template<class T>
1652{
1654
1655 d.elem(0) = s1.elem(0);
1656 d.elem(1) = s1.elem(1);
1657 d.elem(2) = timesMinusI(s1.elem(1));
1658 d.elem(3) = timesMinusI(s1.elem(0));
1659
1660 return d;
1661}
1662
1663template<class T>
1666{
1668
1669 d.elem(0) = s1.elem(0);
1670 d.elem(1) = s1.elem(1);
1671 d.elem(2) = s1.elem(1);
1672 d.elem(3) = -s1.elem(0);
1673
1674 return d;
1675}
1676
1677template<class T>
1680{
1682
1683 d.elem(0) = s1.elem(0);
1684 d.elem(1) = s1.elem(1);
1685 d.elem(2) = timesMinusI(s1.elem(0));
1686 d.elem(3) = timesI(s1.elem(1));
1687
1688 return d;
1689}
1690
1691template<class T>
1694{
1696
1697 d.elem(0) = s1.elem(0);
1698 d.elem(1) = s1.elem(1);
1699 d.elem(2) = s1.elem(0);
1700 d.elem(3) = s1.elem(1);
1701
1702 return d;
1703}
1704
1705//-----------------------------------------------
1706
1707// SpinVector<4> = GammaDP<4,m> * SpinVector<4>
1708// There are 16 cases here for Nd=4
1709template<class T2>
1710inline typename BinaryReturn<GammaConstDP<4,0>, PSpinVector<T2,4>, OpGammaConstDPMultiply>::Type_t
1712{
1714
1715 d.elem(0) = r.elem(0);
1716 d.elem(1) = r.elem(1);
1717 d.elem(2) = r.elem(2);
1718 d.elem(3) = r.elem(3);
1719
1720 return d;
1721}
1722
1723template<class T2>
1724inline typename BinaryReturn<GammaConstDP<4,1>, PSpinVector<T2,4>, OpGammaConstDPMultiply>::Type_t
1726{
1728
1729 d.elem(0) = timesMinusI(r.elem(3));
1730 d.elem(1) = timesMinusI(r.elem(2));
1731 d.elem(2) = timesI(r.elem(1));
1732 d.elem(3) = timesI(r.elem(0));
1733
1734 return d;
1735}
1736
1737template<class T2>
1738inline typename BinaryReturn<GammaConstDP<4,2>, PSpinVector<T2,4>, OpGammaConstDPMultiply>::Type_t
1740{
1742
1743 d.elem(0) = -r.elem(3);
1744 d.elem(1) = r.elem(2);
1745 d.elem(2) = r.elem(1);
1746 d.elem(3) = -r.elem(0);
1747
1748 return d;
1749}
1750
1751template<class T2>
1752inline typename BinaryReturn<GammaConstDP<4,3>, PSpinVector<T2,4>, OpGammaConstDPMultiply>::Type_t
1754{
1756
1757 d.elem(0) = timesI(r.elem(0));
1758 d.elem(1) = timesMinusI(r.elem(1));
1759 d.elem(2) = timesI(r.elem(2));
1760 d.elem(3) = timesMinusI(r.elem(3));
1761
1762 return d;
1763}
1764
1765template<class T2>
1766inline typename BinaryReturn<GammaConstDP<4,4>, PSpinVector<T2,4>, OpGammaConstDPMultiply>::Type_t
1768{
1770
1771 d.elem(0) = timesMinusI(r.elem(2));
1772 d.elem(1) = timesI(r.elem(3));
1773 d.elem(2) = timesI(r.elem(0));
1774 d.elem(3) = timesMinusI(r.elem(1));
1775
1776 return d;
1777}
1778
1779template<class T2>
1780inline typename BinaryReturn<GammaConstDP<4,5>, PSpinVector<T2,4>, OpGammaConstDPMultiply>::Type_t
1782{
1784
1785 d.elem(0) = -r.elem(1);
1786 d.elem(1) = r.elem(0);
1787 d.elem(2) = -r.elem(3);
1788 d.elem(3) = r.elem(2);
1789
1790 return d;
1791}
1792
1793template<class T2>
1794inline typename BinaryReturn<GammaConstDP<4,6>, PSpinVector<T2,4>, OpGammaConstDPMultiply>::Type_t
1796{
1798
1799 d.elem(0) = timesI(r.elem(1));
1800 d.elem(1) = timesI(r.elem(0));
1801 d.elem(2) = timesI(r.elem(3));
1802 d.elem(3) = timesI(r.elem(2));
1803
1804 return d;
1805}
1806
1807template<class T2>
1808inline typename BinaryReturn<GammaConstDP<4,7>, PSpinVector<T2,4>, OpGammaConstDPMultiply>::Type_t
1810{
1812
1813 d.elem(0) = r.elem(2);
1814 d.elem(1) = r.elem(3);
1815 d.elem(2) = -r.elem(0);
1816 d.elem(3) = -r.elem(1);
1817
1818 return d;
1819}
1820
1821template<class T2>
1822inline typename BinaryReturn<GammaConstDP<4,8>, PSpinVector<T2,4>, OpGammaConstDPMultiply>::Type_t
1824{
1826
1827 d.elem(0) = r.elem(0);
1828 d.elem(1) = r.elem(1);
1829 d.elem(2) = -r.elem(2);
1830 d.elem(3) = -r.elem(3);
1831
1832 return d;
1833}
1834
1835template<class T2>
1836inline typename BinaryReturn<GammaConstDP<4,9>, PSpinVector<T2,4>, OpGammaConstDPMultiply>::Type_t
1838{
1840
1841 d.elem(0) = timesI(r.elem(3));
1842 d.elem(1) = timesI(r.elem(2));
1843 d.elem(2) = timesI(r.elem(1));
1844 d.elem(3) = timesI(r.elem(0));
1845
1846 return d;
1847}
1848
1849template<class T2>
1850inline typename BinaryReturn<GammaConstDP<4,10>, PSpinVector<T2,4>, OpGammaConstDPMultiply>::Type_t
1852{
1854
1855 d.elem(0) = r.elem(3);
1856 d.elem(1) = -r.elem(2);
1857 d.elem(2) = r.elem(1);
1858 d.elem(3) = -r.elem(0);
1859
1860 return d;
1861}
1862
1863template<class T2>
1864inline typename BinaryReturn<GammaConstDP<4,11>, PSpinVector<T2,4>, OpGammaConstDPMultiply>::Type_t
1866{
1868
1869 d.elem(0) = timesI(r.elem(0));
1870 d.elem(1) = timesMinusI(r.elem(1));
1871 d.elem(2) = timesMinusI(r.elem(2));
1872 d.elem(3) = timesI(r.elem(3));
1873
1874 return d;
1875}
1876
1877template<class T2>
1878inline typename BinaryReturn<GammaConstDP<4,12>, PSpinVector<T2,4>, OpGammaConstDPMultiply>::Type_t
1880{
1882
1883 d.elem(0) = timesI(r.elem(2));
1884 d.elem(1) = timesMinusI(r.elem(3));
1885 d.elem(2) = timesI(r.elem(0));
1886 d.elem(3) = timesMinusI(r.elem(1));
1887
1888 return d;
1889}
1890
1891template<class T2>
1892inline typename BinaryReturn<GammaConstDP<4,13>, PSpinVector<T2,4>, OpGammaConstDPMultiply>::Type_t
1894{
1896
1897 d.elem(0) = -r.elem(1);
1898 d.elem(1) = r.elem(0);
1899 d.elem(2) = r.elem(3);
1900 d.elem(3) = -r.elem(2);
1901
1902 return d;
1903}
1904
1905template<class T2>
1906inline typename BinaryReturn<GammaConstDP<4,14>, PSpinVector<T2,4>, OpGammaConstDPMultiply>::Type_t
1908{
1910
1911 d.elem(0) = timesI(r.elem(1));
1912 d.elem(1) = timesI(r.elem(0));
1913 d.elem(2) = timesMinusI(r.elem(3));
1914 d.elem(3) = timesMinusI(r.elem(2));
1915
1916 return d;
1917}
1918
1919template<class T2>
1920inline typename BinaryReturn<GammaConstDP<4,15>, PSpinVector<T2,4>, OpGammaConstDPMultiply>::Type_t
1922{
1924
1925 d.elem(0) = -r.elem(2);
1926 d.elem(1) = -r.elem(3);
1927 d.elem(2) = -r.elem(0);
1928 d.elem(3) = -r.elem(1);
1929
1930 return d;
1931}
1932
1933
1934//-----------------------------------------------------------------------------
1936template<class T>
1939{
1941
1942 d.elem(0) = s1.elem(0);
1943 d.elem(1) = s1.elem(1);
1944 zero_rep(d.elem(2));
1945 zero_rep(d.elem(3));
1946
1947 return d;
1948}
1949
1951template<class T>
1954{
1956
1957 zero_rep(d.elem(0));
1958 zero_rep(d.elem(1));
1959 d.elem(2) = s1.elem(2);
1960 d.elem(3) = s1.elem(3);
1961
1962 return d;
1963}
1964
1965 // end of group primspinvector
1967
1968} // namespace QDP
1969
1970#endif
Primitive Matrix class.
T & elem(int i, int j)
Primitive Scalar.
Primitive Spin Matrix class.
Primitive spin Vector class.
PSpinVector & operator-=(const PSpinVector< T1, N > &rhs)
PSpinVector & operator*=(const PScalar< T1 > &rhs)
PSpinVector & operator/=(const PScalar< T1 > &rhs)
PSpinVector /= PScalar.
const T & elem(int i) const
PSpinVector & operator=(const PSpinVector< T1, N > &rhs)
PSpinVector & assign(const PSpinVector< T1, N > &rhs)
PSpinVector & operator+=(const PSpinVector< T1, N > &rhs)
PSpinVector += PSpinVector.
StandardInputStream class.
Definition qdp_stdio.h:33
StandardOutputStream class.
Definition qdp_stdio.h:106
Text input class.
Definition qdp_io.h:42
Text output base class.
Definition qdp_io.h:203
bool isnan(const QDPExpr< T, C > &s1)
bool = isnan(source)
bool isfinite(const QDPExpr< T, C > &s1)
bool = isfinite(source)
bool isnormal(const QDPExpr< T, C > &s1)
bool = isnormal(source)
bool isinf(const QDPExpr< T, C > &s1)
bool = isinf(source)
UnaryReturn< C, FnSum >::Type_t sum(const QDPType< T, C > &s1)
OScalar = sum(source).
void gather_sites(ILattice< T, 2 > &d, const ILattice< T1, 2 > &s0, int i0, const ILattice< T1, 2 > &s1, int i1)
gather several inner sites together
Definition qdp_inner.h:3307
TextWriter & operator<<(TextWriter &txt, const std::string &output)
Definition qdp_io.cc:283
TextReader & operator>>(TextReader &txt, std::string &input)
Definition qdp_io.cc:121
void fill_gaussian(IScalar< T > &d, IScalar< T > &r1, IScalar< T > &r2)
dest = gaussian
Definition qdp_inner.h:1861
void copy_site(IScalar< T > &d, int isite, const IScalar< T1 > &s1)
dest [some type] = source [some type]
Definition qdp_inner.h:1682
void zero_rep(IScalar< T > &dest)
dest = 0
Definition qdp_inner.h:1841
void copymask(IScalar< T > &d, const IScalar< T1 > &mask, const IScalar< T > &s1)
dest = (mask) ? s1 : dest
Definition qdp_inner.h:1656
BinaryReturn< IScalar< T1 >, IScalar< T2 >, OpMultiplyAdj >::Type_t multiplyAdj(const IScalar< T1 > &l, const IScalar< T2 > &r)
Definition qdp_inner.h:1189
BinaryReturn< IScalar< T1 >, IScalar< T2 >, OpAdjMultiply >::Type_t adjMultiply(const IScalar< T1 > &l, const IScalar< T2 > &r)
Definition qdp_inner.h:1180
UnaryReturn< IScalar< T >, FnGetSite >::Type_t getSite(const IScalar< T > &s1, int innersite)
Definition qdp_inner.h:1605
Yet another random number generator.
MakeReturn< UnaryNode< FnReal, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnReal >::Type_t >::Expression_t real(const QDPExpr< T1, C1 > &l)
Definition qdp.h:4972
MakeReturn< UnaryNode< FnTimesMinusI, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnTimesMinusI >::Type_t >::Expression_t timesMinusI(const QDPExpr< T1, C1 > &l)
Definition qdp.h:5024
MakeReturn< UnaryNode< FnSpinProjectDir2Minus, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnSpinProjectDir2Minus >::Type_t >::Expression_t spinProjectDir2Minus(const QDPExpr< T1, C1 > &l)
Definition qdp.h:5128
MakeReturn< TrinaryNode< FnWhere, typenameCreateLeaf< QDPType< T1, C1 > >::Leaf_t, typenameCreateLeaf< QDPType< T2, C2 > >::Leaf_t, typenameCreateLeaf< typenameSimpleScalar< typenameWordType< C1 >::Type_t >::Type_t >::Leaf_t >, typenameTrinaryReturn< C1, C2, typenameSimpleScalar< typenameWordType< C1 >::Type_t >::Type_t, FnWhere >::Type_t >::Expression_t where(const QDPType< T1, C1 > &a, const QDPType< T2, C2 > &b, const typename WordType< C1 >::Type_t &c)
Definition qdp.h:4576
MakeReturn< UnaryNode< FnPeekColorMatrix, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, C1 >::Expression_t peekColor(const QDPExpr< T1, C1 > &l, int row, int col)
Definition qdp_newops.h:161
MakeReturn< UnaryNode< FnSpinProjectDir1Minus, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnSpinProjectDir1Minus >::Type_t >::Expression_t spinProjectDir1Minus(const QDPExpr< T1, C1 > &l)
Definition qdp.h:5115
MakeReturn< UnaryNode< FnTimesI, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnTimesI >::Type_t >::Expression_t timesI(const QDPExpr< T1, C1 > &l)
Definition qdp.h:5011
MakeReturn< UnaryNode< FnSpinProjectDir0Plus, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnSpinProjectDir0Plus >::Type_t >::Expression_t spinProjectDir0Plus(const QDPExpr< T1, C1 > &l)
Definition qdp.h:5050
MakeReturn< UnaryNode< FnSpinReconstructDir2Minus, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnSpinReconstructDir2Minus >::Type_t >::Expression_t spinReconstructDir2Minus(const QDPExpr< T1, C1 > &l)
Definition qdp.h:5232
MakeReturn< BinaryNode< OpMultiply, typenameCreateLeaf< QDPType< T1, C1 > >::Leaf_t, typenameCreateLeaf< QDPExpr< T2, C2 > >::Leaf_t >, typenameBinaryReturn< C1, C2, OpMultiply >::Type_t >::Expression_t operator*(const QDPType< T1, C1 > &l, const QDPExpr< T2, C2 > &r)
Definition qdp.h:2588
MakeReturn< BinaryNode< FnLocalInnerProductReal, typenameCreateLeaf< QDPType< T1, C1 > >::Leaf_t, typenameCreateLeaf< QDPExpr< T2, C2 > >::Leaf_t >, typenameBinaryReturn< C1, C2, FnLocalInnerProductReal >::Type_t >::Expression_t localInnerProductReal(const QDPType< T1, C1 > &l, const QDPExpr< T2, C2 > &r)
Definition qdp.h:2428
MakeReturn< BinaryNode< OpAdd, typenameCreateLeaf< QDPType< T1, C1 > >::Leaf_t, typenameCreateLeaf< QDPExpr< T2, C2 > >::Leaf_t >, typenameBinaryReturn< C1, C2, OpAdd >::Type_t >::Expression_t operator+(const QDPType< T1, C1 > &l, const QDPExpr< T2, C2 > &r)
Definition qdp.h:2556
MakeReturn< UnaryNode< FnSpinReconstructDir2Plus, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnSpinReconstructDir2Plus >::Type_t >::Expression_t spinReconstructDir2Plus(const QDPExpr< T1, C1 > &l)
Definition qdp.h:5180
MakeReturn< UnaryNode< FnSpinProjectDir3Minus, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnSpinProjectDir3Minus >::Type_t >::Expression_t spinProjectDir3Minus(const QDPExpr< T1, C1 > &l)
Definition qdp.h:5141
MakeReturn< BinaryNode< OpSubtract, typenameCreateLeaf< QDPType< T1, C1 > >::Leaf_t, typenameCreateLeaf< QDPExpr< T2, C2 > >::Leaf_t >, typenameBinaryReturn< C1, C2, OpSubtract >::Type_t >::Expression_t operator-(const QDPType< T1, C1 > &l, const QDPExpr< T2, C2 > &r)
Definition qdp.h:2572
MakeReturn< UnaryNode< FnSpinReconstructDir0Plus, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnSpinReconstructDir0Plus >::Type_t >::Expression_t spinReconstructDir0Plus(const QDPExpr< T1, C1 > &l)
Definition qdp.h:5154
MakeReturn< UnaryNode< FnConjugate, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnConjugate >::Type_t >::Expression_t conj(const QDPExpr< T1, C1 > &l)
Definition qdp.h:4855
MakeReturn< UnaryNode< FnSpinReconstructDir1Plus, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnSpinReconstructDir1Plus >::Type_t >::Expression_t spinReconstructDir1Plus(const QDPExpr< T1, C1 > &l)
Definition qdp.h:5167
MakeReturn< UnaryNode< FnSpinReconstructDir1Minus, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnSpinReconstructDir1Minus >::Type_t >::Expression_t spinReconstructDir1Minus(const QDPExpr< T1, C1 > &l)
Definition qdp.h:5219
MakeReturn< UnaryNode< FnSpinProjectDir2Plus, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnSpinProjectDir2Plus >::Type_t >::Expression_t spinProjectDir2Plus(const QDPExpr< T1, C1 > &l)
Definition qdp.h:5076
MakeReturn< BinaryNode< FnLocalInnerProduct, typenameCreateLeaf< QDPType< T1, C1 > >::Leaf_t, typenameCreateLeaf< QDPExpr< T2, C2 > >::Leaf_t >, typenameBinaryReturn< C1, C2, FnLocalInnerProduct >::Type_t >::Expression_t localInnerProduct(const QDPType< T1, C1 > &l, const QDPExpr< T2, C2 > &r)
Definition qdp.h:2412
C1 & pokeColor(QDPType< T1, C1 > &l, const QDPExpr< T2, C2 > &r, int row, int col)
Definition qdp_newops.h:360
MakeReturn< UnaryNode< FnPeekSpinMatrix, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, C1 >::Expression_t peekSpin(const QDPExpr< T1, C1 > &l, int row, int col)
Definition qdp_newops.h:258
MakeReturn< UnaryNode< FnSpinProjectDir3Plus, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnSpinProjectDir3Plus >::Type_t >::Expression_t spinProjectDir3Plus(const QDPExpr< T1, C1 > &l)
Definition qdp.h:5089
MakeReturn< UnaryNode< FnSpinReconstructDir3Minus, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnSpinReconstructDir3Minus >::Type_t >::Expression_t spinReconstructDir3Minus(const QDPExpr< T1, C1 > &l)
Definition qdp.h:5245
MakeReturn< BinaryNode< FnCmplx, typenameCreateLeaf< QDPType< T1, C1 > >::Leaf_t, typenameCreateLeaf< QDPExpr< T2, C2 > >::Leaf_t >, typenameBinaryReturn< C1, C2, FnCmplx >::Type_t >::Expression_t cmplx(const QDPType< T1, C1 > &l, const QDPExpr< T2, C2 > &r)
Definition qdp.h:2348
MakeReturn< BinaryNode< OpDivide, typenameCreateLeaf< QDPType< T1, C1 > >::Leaf_t, typenameCreateLeaf< QDPExpr< T2, C2 > >::Leaf_t >, typenameBinaryReturn< C1, C2, OpDivide >::Type_t >::Expression_t operator/(const QDPType< T1, C1 > &l, const QDPExpr< T2, C2 > &r)
Definition qdp.h:2604
MakeReturn< UnaryNode< FnSpinReconstructDir0Minus, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnSpinReconstructDir0Minus >::Type_t >::Expression_t spinReconstructDir0Minus(const QDPExpr< T1, C1 > &l)
Definition qdp.h:5206
MakeReturn< UnaryNode< FnImag, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnImag >::Type_t >::Expression_t imag(const QDPExpr< T1, C1 > &l)
Definition qdp.h:4985
MakeReturn< UnaryNode< FnChiralProjectMinus, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnChiralProjectMinus >::Type_t >::Expression_t chiralProjectMinus(const QDPExpr< T1, C1 > &l)
Definition qdp.h:5271
MakeReturn< UnaryNode< FnChiralProjectPlus, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnChiralProjectPlus >::Type_t >::Expression_t chiralProjectPlus(const QDPExpr< T1, C1 > &l)
Definition qdp.h:5258
MakeReturn< UnaryNode< FnSpinProjectDir0Minus, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnSpinProjectDir0Minus >::Type_t >::Expression_t spinProjectDir0Minus(const QDPExpr< T1, C1 > &l)
Definition qdp.h:5102
void fill_random(float &d, T1 &seed, T2 &skewed_seed, const T1 &seed_mult)
dest = random
Definition qdp_random.h:54
MakeReturn< UnaryNode< FnLocalNorm2, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnLocalNorm2 >::Type_t >::Expression_t localNorm2(const QDPExpr< T1, C1 > &l)
Definition qdp.h:4998
C1 & pokeSpin(QDPType< T1, C1 > &l, const QDPExpr< T2, C2 > &r, int row, int col)
Definition qdp_newops.h:509
MakeReturn< UnaryNode< FnSpinReconstructDir3Plus, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnSpinReconstructDir3Plus >::Type_t >::Expression_t spinReconstructDir3Plus(const QDPExpr< T1, C1 > &l)
Definition qdp.h:5193
MakeReturn< UnaryNode< FnSpinProjectDir1Plus, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnSpinProjectDir1Plus >::Type_t >::Expression_t spinProjectDir1Plus(const QDPExpr< T1, C1 > &l)
Definition qdp.h:5063
#define QDP_ALIGN16
Definition qdp.h:61
OLattice< PScalar< PColorMatrix< RComplexFloat, 3 > > > C
PSpinVector< typename UnaryReturn< T2, OpUnaryPlus >::Type_t, N > Type_t
PSpinVector< typename UnaryReturn< T2, OpUnaryPlus >::Type_t, N > Type_t
PSpinVector< typename UnaryReturn< T2, OpUnaryPlus >::Type_t, N > Type_t
PSpinVector< typename UnaryReturn< T2, OpUnaryPlus >::Type_t, N > Type_t
PSpinVector< typename BinaryReturn< T1, T2, Op >::Type_t, N > Type_t
PSpinVector< typename BinaryReturn< T1, T2, Op >::Type_t, N > Type_t
PSpinVector< typename BinaryReturn< T1, T2, Op >::Type_t, N > Type_t
PSpinVector< typename BinaryReturn< T1, T2, Op >::Type_t, N > Type_t
PScalar< typename BinaryReturn< T1, T2, FnLocalInnerProductReal >::Type_t > Type_t
PScalar< typename BinaryReturn< T1, T2, FnInnerProductReal >::Type_t > Type_t
PScalar< typename BinaryReturn< T1, T2, FnInnerProduct >::Type_t > Type_t
PScalar< typename BinaryReturn< T1, T2, FnLocalInnerProduct >::Type_t > Type_t
PSpinVector< typename BinaryReturn< T1, T2, Op >::Type_t, N > Type_t
PSpinVector< typename DoublePrecType< T1 >::Type_t, N > Type_t
Structure for extracting color matrix components.
Definition qdp_newops.h:124
Structure for extracting color vector components.
Definition qdp_newops.h:173
Structure for extracting spin matrix components.
Definition qdp_newops.h:222
Structure for extracting spin vector components.
Definition qdp_newops.h:270
Structure for inserting color vector components.
Definition qdp_newops.h:396
Structure for inserting spin vector components.
Definition qdp_newops.h:548
PScalar< typename InternalScalar< T >::Type_t > Type_t
Construct simple word type used at some level within primitives.
Definition qdp_traits.h:98
PSpinVector< typename LatticeScalar< T >::Type_t, N > Type_t
Makes a lattice scalar leaving primitive indices alone.
Definition qdp_traits.h:108
PScalar< typename PrimitiveScalar< T >::Type_t > Type_t
Makes a primitive scalar leaving grid alone.
Definition qdp_traits.h:103
PSpinVector< typename SinglePrecType< T1 >::Type_t, N > Type_t
PSpinVector< typename TrinaryReturn< T1, T2, T3, FnWhere >::Type_t, N > Type_t
PSpinVector< typename UnaryReturn< T1, Op >::Type_t, N > Type_t
PScalar< typename UnaryReturn< T, FnLocalNorm2 >::Type_t > Type_t
PScalar< typename UnaryReturn< T, FnNorm2 >::Type_t > Type_t
PScalar< typename UnaryReturn< T, FnPeekSpinVector >::Type_t > Type_t
PSpinVector< typename UnaryReturn< T, FnSpinProjectDir0Minus >::Type_t,(N > >1) > Type_t
PSpinVector< typename UnaryReturn< T, FnSpinProjectDir0Plus >::Type_t,(N > >1) > Type_t
PSpinVector< typename UnaryReturn< T, FnSpinProjectDir1Minus >::Type_t,(N > >1) > Type_t
PSpinVector< typename UnaryReturn< T, FnSpinProjectDir1Plus >::Type_t,(N > >1) > Type_t
PSpinVector< typename UnaryReturn< T, FnSpinProjectDir2Minus >::Type_t,(N > >1) > Type_t
PSpinVector< typename UnaryReturn< T, FnSpinProjectDir2Plus >::Type_t,(N > >1) > Type_t
PSpinVector< typename UnaryReturn< T, FnSpinProjectDir3Minus >::Type_t,(N > >1) > Type_t
PSpinVector< typename UnaryReturn< T, FnSpinProjectDir3Plus >::Type_t,(N > >1) > Type_t
PSpinVector< typename UnaryReturn< T, FnSpinProject >::Type_t,(N > >1) > Type_t
PSpinVector< typename UnaryReturn< T, FnSpinReconstructDir0Minus >::Type_t,(N<< 1) > Type_t
PSpinVector< typename UnaryReturn< T, FnSpinReconstructDir0Plus >::Type_t,(N<< 1) > Type_t
PSpinVector< typename UnaryReturn< T, FnSpinReconstructDir1Minus >::Type_t,(N<< 1) > Type_t
PSpinVector< typename UnaryReturn< T, FnSpinReconstructDir1Plus >::Type_t,(N<< 1) > Type_t
PSpinVector< typename UnaryReturn< T, FnSpinReconstructDir2Minus >::Type_t,(N<< 1) > Type_t
PSpinVector< typename UnaryReturn< T, FnSpinReconstructDir2Plus >::Type_t,(N<< 1) > Type_t
PSpinVector< typename UnaryReturn< T, FnSpinReconstructDir3Minus >::Type_t,(N<< 1) > Type_t
PSpinVector< typename UnaryReturn< T, FnSpinReconstructDir3Plus >::Type_t,(N<< 1) > Type_t
PSpinVector< typename UnaryReturn< T, FnSpinReconstruct >::Type_t,(N<< 1) > Type_t
PSpinVector< typename UnaryReturn< T, FnSumMulti >::Type_t, N > Type_t
Find the underlying word type of a field.
Definition qdp_traits.h:29