QDP++
qdp_primmatrix.h
Go to the documentation of this file.
1// -*- C++ -*-
2
6
7#ifndef QDP_PRIMMATRIX_H
8#define QDP_PRIMMATRIX_H
9
10namespace QDP {
11
12
13//-------------------------------------------------------------------------------------
21
22
24
30template <class T, int N, template<class,int> class C> class PMatrix
31{
32public:
35
36 typedef C<T,N> CC;
37
39
40 template<class T1>
41 inline
42 CC& assign(const PScalar<T1>& rhs)
43 {
44 for(int i=0; i < N; ++i)
45 for(int j=0; j < N; ++j)
46 if (i == j)
47 elem(i,j) = rhs.elem();
48 else
49 zero_rep(elem(i,j));
50
51 return static_cast<CC&>(*this);
52 }
53
55
56 template<class T1>
57 inline
58 CC& assign(const C<T1,N>& rhs)
59 {
60 for(int i=0; i < N; ++i)
61 for(int j=0; j < N; ++j)
62 elem(i,j) = rhs.elem(i,j);
63
64 return static_cast<CC&>(*this);
65 }
66
68 template<class T1>
69 inline
70 CC& operator+=(const C<T1,N>& rhs)
71 {
72 for(int i=0; i < N; ++i)
73 for(int j=0; j < N; ++j)
74 elem(i,j) += rhs.elem(i,j);
75
76 return static_cast<CC&>(*this);
77 }
78
80 template<class T1>
81 inline
82 CC& operator-=(const C<T1,N>& rhs)
83 {
84 for(int i=0; i < N; ++i)
85 for(int j=0; j < N; ++j)
86 elem(i,j) -= rhs.elem(i,j);
87
88 return static_cast<CC&>(*this);
89 }
90
92 template<class T1>
93 inline
95 {
96 for(int i=0; i < N; ++i)
97 elem(i,i) += rhs.elem();
98
99 return static_cast<CC&>(*this);
100 }
101
103 template<class T1>
104 inline
106 {
107 for(int i=0; i < N; ++i)
108 elem(i,i) -= rhs.elem();
109
110 return static_cast<CC&>(*this);
111 }
112
114 template<class T1>
115 inline
117 {
118 for(int i=0; i < N; ++i)
119 for(int j=0; j < N; ++j)
120 elem(i,j) *= rhs.elem();
121
122 return static_cast<CC&>(*this);
123 }
124
126 template<class T1>
127 inline
129 {
130 for(int i=0; i < N; ++i)
131 for(int j=0; j < N; ++j)
132 elem(i,j) /= rhs.elem();
133
134 return static_cast<CC&>(*this);
135 }
136
137#if 0
138 // NOTE: intentially avoid defining a copy constructor - let the compiler
139 // generate one via the bit copy mechanism. This effectively achieves
140 // the first form of the if below (QDP_USE_ARRAY_INITIALIZER) without having
141 // to use that syntax which is not strictly legal in C++.
142
144#if defined(QDP_USE_ARRAY_INITIALIZER)
146 PMatrix(const PMatrix& a) : F(a.F) {}
147#else
149 PMatrix(const PMatrix& a)
150 {
151 for(int i=0; i < N*N; ++i)
152 F[i] = a.F[i];
153 }
154#endif
155#endif
156
157public:
158 T& elem(int i, int j) {return F[j+N*i];}
159 const T& elem(int i, int j) const {return F[j+N*i];}
160
161private:
162 T F[N*N];
163};
164
165
167template<class T, int N, template<class,int> class C>
168inline
170{
171 for(int j=0; j < N; ++j)
172 for(int i=0; i < N; ++i)
173 txt >> d.elem(i,j);
174
175 return txt;
176}
177
179template<class T, int N, template<class,int> class C>
180inline
182{
183 for(int j=0; j < N; ++j)
184 for(int i=0; i < N; ++i)
185 txt << d.elem(i,j);
186
187 return txt;
188}
189
190#ifdef QDP_USE_LIBXML2
192template<class T, int N, template<class,int> class C>
193inline
194XMLWriter& operator<<(XMLWriter& xml, const PMatrix<T,N,C>& d)
195{
196 xml.openTag("Matrix");
197
198 XMLWriterAPI::AttributeList alist;
199
200 for(int i=0; i < N; ++i)
201 {
202 for(int j=0; j < N; ++j)
203 {
204 alist.clear();
205 alist.push_back(XMLWriterAPI::Attribute("row", i));
206 alist.push_back(XMLWriterAPI::Attribute("col", j));
207
208 xml.openTag("elem", alist);
209 xml << d.elem(i,j);
210 xml.closeTag();
211 }
212 }
213
214 xml.closeTag(); // Matrix
215 return xml;
216}
217#endif // end of group primmatrix
219
220//-----------------------------------------------------------------------------
221// Traits classes
222//-----------------------------------------------------------------------------
223
224// Underlying word type
225template<class T1, int N, template<class,int> class C>
226struct WordType<PMatrix<T1,N,C> >
227{
228 typedef typename WordType<T1>::Type_t Type_t;
229};
230
231// Fixed Precision
232template<class T1, int N, template<class,int> class C>
237
238
239// Fixed Precision
240template<class T1, int N, template<class,int> class C>
245
246// Internally used scalars
247template<class T, int N, template<class,int> class C>
251
252// Makes a primitive scalar leaving grid alone
253template<class T, int N, template<class,int> class C>
257
258// Makes a lattice scalar leaving primitive indices alone
259template<class T, int N, template<class,int> class C>
263
264
265//-----------------------------------------------------------------------------
266// Traits classes to support return types
267//-----------------------------------------------------------------------------
268
269/*
270 * NOTE***: no Op defaults - they cause conflicts with specialized versions.
271 * Avoid them.
272 */
273
274
275#if 0
276template<class T1, class T2>
277struct UnaryReturn<PScalar<T2>, OpCast<T1> > {
279// typedef T1 Type_t;
280};
281#endif
282
283template<class T, int N, template<class,int> class C>
287
288
289// Assignment is different
290template<class T1, class T2, int N, template<class,int> class C>
291struct BinaryReturn<PMatrix<T1,N,C>, PMatrix<T2,N,C>, OpAssign > {
292 typedef C<T1,N> &Type_t;
293};
294
295template<class T1, class T2, int N, template<class,int> class C>
296struct BinaryReturn<PMatrix<T1,N,C>, PMatrix<T2,N,C>, OpAddAssign > {
297 typedef C<T1,N> &Type_t;
298};
299
300template<class T1, class T2, int N, template<class,int> class C>
302 typedef C<T1,N> &Type_t;
303};
304
305template<class T1, class T2, int N, template<class,int> class C>
306struct BinaryReturn<PMatrix<T1,N,C>, PScalar<T2>, OpAssign > {
307 typedef C<T1,N> &Type_t;
308};
309
310template<class T1, class T2, int N, template<class,int> class C>
312 typedef C<T1,N> &Type_t;
313};
314
315template<class T1, class T2, int N, template<class,int> class C>
317 typedef C<T1,N> &Type_t;
318};
319
320template<class T1, class T2, int N, template<class,int> class C>
322 typedef C<T1,N> &Type_t;
323};
324
325template<class T1, class T2, int N, template<class,int> class C>
327 typedef C<T1,N> &Type_t;
328};
329
330
331
332//-----------------------------------------------------------------------------
333// Operators
334//-----------------------------------------------------------------------------
337
338// Primitive Matrices
339
340// PMatrix = + PMatrix
341template<class T, int N, template<class,int> class C>
345
346template<class T1, int N, template<class,int> class C>
349{
351
352 for(int i=0; i < N; ++i)
353 for(int j=0; j < N; ++j)
354 d.elem(i,j) = +l.elem(i,j);
355
356 return d;
357}
358
359
360// PMatrix = - PMatrix
361template<class T, int N, template<class,int> class C>
365
366template<class T1, int N, template<class,int> class C>
369{
371
372 for(int i=0; i < N; ++i)
373 for(int j=0; j < N; ++j)
374 d.elem(i,j) = -l.elem(i,j);
375
376 return d;
377}
378
379
380// PMatrix = PMatrix + PMatrix
381template<class T1, class T2, int N, template<class,int> class C>
385
386template<class T1, class T2, int N, template<class,int> class C>
389{
391
392 for(int i=0; i < N; ++i)
393 for(int j=0; j < N; ++j)
394 d.elem(i,j) = l.elem(i,j) + r.elem(i,j);
395
396 return d;
397}
398
399// PMatrix = PMatrix + PScalar
400template<class T1, class T2, int N, template<class,int> class C>
404
405template<class T1, class T2, int N, template<class,int> class C>
408{
410
411 for(int i=0; i < N; ++i)
412 for(int j=0; j < N; ++j)
413 d.elem(i,j) = (i == j) ? l.elem(i,i) + r.elem() : l.elem(i,j);
414
415 return d;
416}
417
418// PMatrix = PScalar + PMatrix
419template<class T1, class T2, int N, template<class,int> class C>
423
424template<class T1, class T2, int N, template<class,int> class C>
427{
429
430 for(int i=0; i < N; ++i)
431 for(int j=0; j < N; ++j)
432 d.elem(i,j) = (i == j) ? l.elem() + r.elem(i,i) : r.elem(i,j);
433
434 return d;
435}
436
437
438// PMatrix = PMatrix - PMatrix
439template<class T1, class T2, int N, template<class,int> class C>
443
444template<class T1, class T2, int N, template<class,int> class C>
447{
449
450 for(int i=0; i < N; ++i)
451 for(int j=0; j < N; ++j)
452 d.elem(i,j) = l.elem(i,j) - r.elem(i,j);
453
454 return d;
455}
456
457// PMatrix = PMatrix - PScalar
458template<class T1, class T2, int N, template<class,int> class C>
462
463template<class T1, class T2, int N, template<class,int> class C>
466{
468
469 for(int i=0; i < N; ++i)
470 for(int j=0; j < N; ++j)
471 d.elem(i,j) = (i == j) ? l.elem(i,i) - r.elem() : l.elem(i,j);
472
473 return d;
474}
475
476// PMatrix = PScalar - PMatrix
477template<class T1, class T2, int N, template<class,int> class C>
481
482template<class T1, class T2, int N, template<class,int> class C>
485{
487
488 for(int i=0; i < N; ++i)
489 for(int j=0; j < N; ++j)
490 d.elem(i,j) = (i == j) ? l.elem() - r.elem(i,i) : -r.elem(i,j);
491
492 return d;
493}
494
495
496// PMatrix = PMatrix * PScalar
497template<class T1, class T2, int N, template<class,int> class C>
501
502template<class T1, class T2, int N, template<class,int> class C>
505{
507
508 for(int i=0; i < N; ++i)
509 for(int j=0; j < N; ++j)
510 d.elem(i,j) = l.elem(i,j) * r.elem();
511 return d;
512}
513
514// Optimized PMatrix = adj(PMatrix)*PScalar
515template<class T1, class T2, int N, template<class,int> class C>
519
520template<class T1, class T2, int N, template<class,int> class C>
523{
525
526 for(int i=0; i < N; ++i)
527 for(int j=0; j < N; ++j)
528 d.elem(i,j) = adjMultiply(l.elem(j,i), r.elem());
529 return d;
530}
531
532// Optimized PMatrix = PMatrix*adj(PScalar)
533template<class T1, class T2, int N, template<class,int> class C>
537
538template<class T1, class T2, int N, template<class,int> class C>
541{
543
544 for(int i=0; i < N; ++i)
545 for(int j=0; j < N; ++j)
546 d.elem(i,j) = multiplyAdj(l.elem(i,j), r.elem());
547 return d;
548}
549
550// Optimized PMatrix = adj(PMatrix)*adj(PScalar)
551template<class T1, class T2, int N, template<class,int> class C>
555
556template<class T1, class T2, int N, template<class,int> class C>
559{
561
562 for(int i=0; i < N; ++i)
563 for(int j=0; j < N; ++j)
564 d.elem(i,j) = adjMultiplyAdj(l.elem(j,i), r.elem());
565 return d;
566}
567
568
569
570// PMatrix = PScalar * PMatrix
571template<class T1, class T2, int N, template<class,int> class C>
575
576template<class T1, class T2, int N, template<class,int> class C>
579{
581
582 for(int i=0; i < N; ++i)
583 for(int j=0; j < N; ++j)
584 d.elem(i,j) = l.elem() * r.elem(i,j);
585 return d;
586}
587
588// Optimized PMatrix = adj(PScalar) * PMatrix
589template<class T1, class T2, int N, template<class,int> class C>
593
594template<class T1, class T2, int N, template<class,int> class C>
597{
599
600 for(int i=0; i < N; ++i)
601 for(int j=0; j < N; ++j)
602 d.elem(i,j) = adjMultiply(l.elem(), r.elem(i,j));
603 return d;
604}
605
606// Optimized PMatrix = PScalar * adj(PMatrix)
607template<class T1, class T2, int N, template<class,int> class C>
611
612template<class T1, class T2, int N, template<class,int> class C>
615{
617
618 for(int i=0; i < N; ++i)
619 for(int j=0; j < N; ++j)
620 d.elem(i,j) = multiplyAdj(l.elem(), r.elem(j,i));
621 return d;
622}
623
624// Optimized PMatrix = adj(PScalar) * adj(PMatrix)
625template<class T1, class T2, int N, template<class,int> class C>
629
630template<class T1, class T2, int N, template<class,int> class C>
633{
635
636 for(int i=0; i < N; ++i)
637 for(int j=0; j < N; ++j)
638 d.elem(i,j) = adjMultiplyAdj(l.elem(), r.elem(j,i));
639 return d;
640}
641
642
643// PMatrix = PMatrix * PMatrix
644template<class T1, class T2, int N, template<class,int> class C>
648
649template<class T1, class T2, int N, template<class,int> class C>
652{
654
655 for(int i=0; i < N; ++i)
656 for(int j=0; j < N; ++j)
657 {
658 d.elem(i,j) = l.elem(i,0) * r.elem(0,j);
659 for(int k=1; k < N; ++k)
660 d.elem(i,j) += l.elem(i,k) * r.elem(k,j);
661 }
662
663 return d;
664}
665
666// Optimized PMatrix = adj(PMatrix)*PMatrix
667template<class T1, class T2, int N, template<class,int> class C>
671
672template<class T1, class T2, int N, template<class,int> class C>
675{
677
678 for(int i=0; i < N; ++i)
679 for(int j=0; j < N; ++j)
680 {
681 d.elem(i,j) = adjMultiply(l.elem(0,i), r.elem(0,j));
682 for(int k=1; k < N; ++k)
683 d.elem(i,j) += adjMultiply(l.elem(k,i), r.elem(k,j));
684 }
685
686 return d;
687}
688
689// Optimized PMatrix = PMatrix*adj(PMatrix)
690template<class T1, class T2, int N, template<class,int> class C>
694
695template<class T1, class T2, int N, template<class,int> class C>
698{
700
701 for(int i=0; i < N; ++i)
702 for(int j=0; j < N; ++j)
703 {
704 d.elem(i,j) = multiplyAdj(l.elem(i,0), r.elem(j,0));
705 for(int k=1; k < N; ++k)
706 d.elem(i,j) += multiplyAdj(l.elem(i,k), r.elem(j,k));
707 }
708
709 return d;
710}
711
712// Optimized PMatrix = adj(PMatrix)*adj(PMatrix)
713template<class T1, class T2, int N, template<class,int> class C>
717
718template<class T1, class T2, int N, template<class,int> class C>
721{
723
724 for(int i=0; i < N; ++i)
725 for(int j=0; j < N; ++j)
726 {
727 d.elem(i,j) = adjMultiplyAdj(l.elem(0,i), r.elem(j,0));
728 for(int k=1; k < N; ++k)
729 d.elem(i,j) += adjMultiplyAdj(l.elem(k,i), r.elem(j,k));
730 }
731
732 return d;
733}
734
735
736// PMatrix = PMatrix / PScalar
737template<class T1, class T2, int N, template<class,int> class C>
741
742template<class T1, class T2, int N, template<class,int> class C>
745{
747
748 for(int i=0; i < N; ++i)
749 for(int j=0; j < N; ++j)
750 d.elem(i,j) = l.elem(i,j) / r.elem();
751 return d;
752}
753
754
755
756//-----------------------------------------------------------------------------
757// These functions always return bool
759template<class T1, int N, template<class,int> class C>
760struct UnaryReturn<PMatrix<T1,N,C>, FnIsNan> {
761 bool Type_t;
762};
763
764template<class T1, int N, template<class,int> class C>
765inline bool
767{
768 bool d = false;
769
770 for(int i=0; i < N; ++i)
771 for(int j=0; j < N; ++j)
772 d |= isnan(l.elem(i,j));
773
774 return d;
775}
776
778template<class T1, int N, template<class,int> class C>
779struct UnaryReturn<PMatrix<T1,N,C>, FnIsInf> {
780 bool Type_t;
781};
782
783template<class T1, int N, template<class,int> class C>
784inline bool
786{
787 bool d = false;
788
789 for(int i=0; i < N; ++i)
790 for(int j=0; j < N; ++j)
791 d |= isinf(l.elem(i,j));
792
793 return d;
794}
795
797template<class T1, int N, template<class,int> class C>
799 bool Type_t;
800};
801
802template<class T1, int N, template<class,int> class C>
803inline bool
805{
806 bool d = true;
807
808 for(int i=0; i < N; ++i)
809 for(int j=0; j < N; ++j)
810 d &= isinf(l.elem(i,j));
811
812 return d;
813}
814
816template<class T1, int N, template<class,int> class C>
818 bool Type_t;
819};
820
821template<class T1, int N, template<class,int> class C>
822inline bool
824{
825 bool d = true;
826
827 for(int i=0; i < N; ++i)
828 for(int j=0; j < N; ++j)
829 d &= isfinite(l.elem(i,j));
830
831 return d;
832}
833
834
835//-----------------------------------------------------------------------------
836// Functions
837
838// Adjoint
839template<class T, int N, template<class,int> class C>
843
844template<class T1, int N, template<class,int> class C>
847{
849
850 for(int i=0; i < N; ++i)
851 for(int j=0; j < N; ++j)
852 d.elem(i,j) = adj(l.elem(j,i));
853
854 return d;
855}
856
857
858// Conjugate
859template<class T, int N, template<class,int> class C>
863
864template<class T1, int N, template<class,int> class C>
867{
869
870 for(int i=0; i < N; ++i)
871 for(int j=0; j < N; ++j)
872 d.elem(i,j) = conj(l.elem(i,j));
873
874 return d;
875}
876
877
878// Transpose
879template<class T, int N, template<class,int> class C>
883
884template<class T1, int N, template<class,int> class C>
887{
889
890 for(int i=0; i < N; ++i)
891 for(int j=0; j < N; ++j)
892 d.elem(i,j) = transpose(l.elem(j,i));
893
894 return d;
895}
896
897
898// TRACE
899// PScalar = Trace(PMatrix)
900template<class T, int N, template<class,int> class C>
904
905template<class T, int N, template<class,int> class C>
908{
910
911 d.elem() = trace(s1.elem(0,0));
912 for(int i=1; i < N; ++i)
913 d.elem() += trace(s1.elem(i,i));
914
915 return d;
916}
917
918
919// PScalar = Re(Trace(PMatrix))
920template<class T, int N, template<class,int> class C>
924
925template<class T1, int N, template<class,int> class C>
928{
930
931 d.elem() = realTrace(s1.elem(0,0));
932 for(int i=1; i < N; ++i)
933 d.elem() += realTrace(s1.elem(i,i));
934
935 return d;
936}
937
938
940template<class T, int N, template<class,int> class C>
944
945template<class T1, int N, template<class,int> class C>
948{
950
951 d.elem() = imagTrace(s1.elem(0,0));
952 for(int i=1; i < N; ++i)
953 d.elem() += imagTrace(s1.elem(i,i));
954
955 return d;
956}
957
958
960template<class T, int N, template<class,int> class C>
964
965template<class T, int N, template<class,int> class C>
968{
970
971 for(int i=0; i < N; ++i)
972 for(int j=0; j < N; ++j)
973 d.elem(i,j) = traceColor(s1.elem(i,j));
974
975 return d;
976}
977
978
980template<class T, int N, template<class,int> class C>
984
985template<class T, int N, template<class,int> class C>
988{
990
991 for(int i=0; i < N; ++i)
992 for(int j=0; j < N; ++j)
993 d.elem(i,j) = traceSpin(s1.elem(i,j));
994
995 return d;
996}
997
998
1000
1001template<class T, int N, template<class,int> class C>
1005
1008template<class T, int N, template<class,int> class C>
1011{
1013 for(int i=0; i < N; ++i) {
1014 for(int j=0; j < N; ++j) {
1015 d.elem(i,j) = transposeColor(s1.elem(i,j));
1016 }
1017 }
1018
1019 return d;
1020}
1021
1022
1024
1025template<class T, int N, template<class,int> class C>
1029
1032template<class T, int N, template<class,int> class C>
1035{
1037 for(int i=0; i < N; ++i) {
1038 for(int j=0; j < N; ++j) {
1039 d.elem(i,j) = transposeSpin(s1.elem(i,j));
1040 }
1041 }
1042
1043 return d;
1044}
1045
1046
1047// PScalar = traceMultiply(PMatrix,PMatrix)
1048template<class T1, class T2, int N, template<class,int> class C>
1052
1053template<class T1, class T2, int N, template<class,int> class C>
1056{
1058
1059 d.elem() = traceMultiply(l.elem(0,0), r.elem(0,0));
1060 for(int k=1; k < N; ++k)
1061 d.elem() += traceMultiply(l.elem(0,k), r.elem(k,0));
1062
1063 for(int j=1; j < N; ++j)
1064 for(int k=0; k < N; ++k)
1065 d.elem() += traceMultiply(l.elem(j,k), r.elem(k,j));
1066
1067 return d;
1068}
1069
1070// PScalar = traceMultiply(PMatrix,PScalar)
1071template<class T1, class T2, int N, template<class,int> class C>
1075
1076template<class T1, class T2, int N, template<class,int> class C>
1079{
1081
1082 d.elem() = traceMultiply(l.elem(0,0), r.elem());
1083 for(int k=1; k < N; ++k)
1084 d.elem() += traceMultiply(l.elem(k,k), r.elem());
1085
1086 return d;
1087}
1088
1089// PScalar = traceMultiply(PScalar,PMatrix)
1090template<class T1, class T2, int N, template<class,int> class C>
1094
1095template<class T1, class T2, int N, template<class,int> class C>
1098{
1100
1101 d.elem() = traceMultiply(l.elem(), r.elem(0,0));
1102 for(int k=1; k < N; ++k)
1103 d.elem() += traceMultiply(l.elem(), r.elem(k,k));
1104
1105 return d;
1106}
1107
1108
1109
1111template<class T1, class T2, int N, template<class,int> class C>
1115
1116template<class T1, class T2, int N, template<class,int> class C>
1119{
1121
1122 for(int i=0; i < N; ++i)
1123 for(int j=0; j < N; ++j)
1124 {
1125 d.elem(i,j) = traceColorMultiply(l.elem(i,0), r.elem(0,j));
1126 for(int k=1; k < N; ++k)
1127 d.elem(i,j) += traceColorMultiply(l.elem(i,k), r.elem(k,j));
1128 }
1129
1130 return d;
1131}
1132
1133// PMatrix = traceColorMultiply(PMatrix,PScalar) [the trace is an identity in general]
1134template<class T1, class T2, int N, template<class,int> class C>
1138
1139template<class T1, class T2, int N, template<class,int> class C>
1142{
1144
1145 for(int i=0; i < N; ++i)
1146 for(int j=0; j < N; ++j)
1147 d.elem(i,j) = traceColorMultiply(l.elem(i,j), r.elem());
1148
1149 return d;
1150}
1151
1152// PMatrix = traceColorMultiply(PScalar,PMatrix) [the trace is an identity in general]
1153template<class T1, class T2, int N, template<class,int> class C>
1157
1158template<class T1, class T2, int N, template<class,int> class C>
1161{
1163
1164 for(int i=0; i < N; ++i)
1165 for(int j=0; j < N; ++j)
1166 d.elem(i,j) = traceColorMultiply(l.elem(), r.elem(i,j));
1167
1168 return d;
1169}
1170
1171
1173template<class T1, class T2, int N, template<class,int> class C>
1177
1178template<class T1, class T2, int N, template<class,int> class C>
1181{
1183
1184 for(int i=0; i < N; ++i)
1185 for(int j=0; j < N; ++j)
1186 {
1187 d.elem(i,j) = traceSpinMultiply(l.elem(i,0), r.elem(0,j));
1188 for(int k=1; k < N; ++k)
1189 d.elem(i,j) += traceSpinMultiply(l.elem(i,k), r.elem(k,j));
1190 }
1191
1192 return d;
1193}
1194
1195// PScalar = traceSpinMultiply(PMatrix,PScalar) [the trace is an identity in general]
1196template<class T1, class T2, int N, template<class,int> class C>
1200
1201template<class T1, class T2, int N, template<class,int> class C>
1204{
1206
1207 for(int i=0; i < N; ++i)
1208 for(int j=0; j < N; ++j)
1209 d.elem(i,j) = traceSpinMultiply(l.elem(i,j), r.elem());
1210
1211 return d;
1212}
1213
1214// PScalar = traceSpinMultiply(PScalar,PMatrix) [the trace is an identity in general]
1215template<class T1, class T2, int N, template<class,int> class C>
1219
1220template<class T1, class T2, int N, template<class,int> class C>
1223{
1225
1226 for(int i=0; i < N; ++i)
1227 for(int j=0; j < N; ++j)
1228 d.elem(i,j) = traceSpinMultiply(l.elem(), r.elem(i,j));
1229
1230 return d;
1231}
1232
1233
1235template<class T, int N, template<class,int> class C>
1239
1240template<class T, int N, template<class,int> class C>
1243{
1245
1246 for(int i=0; i < N; ++i)
1247 for(int j=0; j < N; ++j)
1248 d.elem(i,j) = real(s1.elem(i,j));
1249
1250 return d;
1251}
1252
1253
1255template<class T, int N, template<class,int> class C>
1259
1260template<class T, int N, template<class,int> class C>
1263{
1265
1266 for(int i=0; i < N; ++i)
1267 for(int j=0; j < N; ++j)
1268 d.elem(i,j) = imag(s1.elem(i,j));
1269
1270 return d;
1271}
1272
1273
1275template<class T1, class T2, int N, template<class,int> class C>
1276inline typename BinaryReturn<PMatrix<T1,N,C>, PMatrix<T2,N,C>, FnCmplx>::Type_t
1278{
1280
1281 for(int i=0; i < N; ++i)
1282 for(int j=0; j < N; ++j)
1283 d.elem(i,j) = cmplx(s1.elem(i,j), s2.elem(i,j));
1284
1285 return d;
1286}
1287
1288
1289
1290
1291// Functions
1293template<class T, int N, template<class,int> class C>
1297
1298template<class T, int N, template<class,int> class C>
1301{
1303
1304 for(int i=0; i < N; ++i)
1305 for(int j=0; j < N; ++j)
1306 d.elem(i,j) = timesI(s1.elem(i,j));
1307
1308 return d;
1309}
1310
1312template<class T, int N, template<class,int> class C>
1316
1317template<class T, int N, template<class,int> class C>
1320{
1322
1323 for(int i=0; i < N; ++i)
1324 for(int j=0; j < N; ++j)
1325 d.elem(i,j) = timesMinusI(s1.elem(i,j));
1326
1327 return d;
1328}
1329
1331
1332template<class T, int N, template<class,int> class C>
1336
1337template<class T, int N, template<class,int> class C>
1339getSite(const PMatrix<T,N,C>& s1, int innersite)
1340{
1342
1343 for(int i=0; i < N; ++i)
1344 for(int j=0; j < N; ++j)
1345 d.elem(i,j) = getSite(s1.elem(i,j), innersite);
1346
1347 return d;
1348}
1349
1351
1352template<class T, int N, template<class,int> class C>
1356
1357template<class T, int N, template<class,int> class C>
1359peekColor(const PMatrix<T,N,C>& l, int row)
1360{
1362
1363 for(int i=0; i < N; ++i)
1364 for(int j=0; j < N; ++j)
1365 d.elem(i,j) = peekColor(l.elem(i,j),row);
1366 return d;
1367}
1368
1370
1371template<class T, int N, template<class,int> class C>
1375
1376template<class T, int N, template<class,int> class C>
1378peekColor(const PMatrix<T,N,C>& l, int row, int col)
1379{
1381
1382 for(int i=0; i < N; ++i)
1383 for(int j=0; j < N; ++j)
1384 d.elem(i,j) = peekColor(l.elem(i,j),row,col);
1385 return d;
1386}
1387
1389
1390template<class T, int N, template<class,int> class C>
1394
1395template<class T, int N, template<class,int> class C>
1397peekSpin(const PMatrix<T,N,C>& l, int row)
1398{
1400
1401 for(int i=0; i < N; ++i)
1402 for(int j=0; j < N; ++j)
1403 d.elem(i,j) = peekSpin(l.elem(i,j),row);
1404 return d;
1405}
1406
1408
1409template<class T, int N, template<class,int> class C>
1413
1414template<class T, int N, template<class,int> class C>
1416peekSpin(const PMatrix<T,N,C>& l, int row, int col)
1417{
1419
1420 for(int i=0; i < N; ++i)
1421 for(int j=0; j < N; ++j)
1422 d.elem(i,j) = peekSpin(l.elem(i,j),row,col);
1423 return d;
1424}
1425
1427
1428template<class T, int N, template<class,int> class C>
1432
1433template<class T1, class T2, int N, template<class,int> class C>
1436{
1437 typedef typename UnaryReturn<PMatrix<T1,N,C>, FnPokeColorMatrix>::Type_t Return_t;
1438
1439 for(int i=0; i < N; ++i)
1440 for(int j=0; j < N; ++j)
1441 pokeColor(l.elem(i,j),r.elem(i,j),row);
1442 return static_cast<Return_t&>(l);
1443}
1444
1446
1447template<class T1, class T2, int N, template<class,int> class C>
1448inline typename UnaryReturn<PMatrix<T1,N,C>, FnPokeColorMatrix>::Type_t&
1449pokeColor(PMatrix<T1,N,C>& l, const PMatrix<T2,N,C>& r, int row, int col)
1450{
1451 typedef typename UnaryReturn<PMatrix<T1,N,C>, FnPokeColorMatrix>::Type_t Return_t;
1452
1453 for(int i=0; i < N; ++i)
1454 for(int j=0; j < N; ++j)
1455 pokeColor(l.elem(i,j),r.elem(i,j),row,col);
1456 return static_cast<Return_t&>(l);
1457}
1458
1460
1461template<class T, int N, template<class,int> class C>
1465
1466template<class T1, class T2, int N, template<class,int> class C>
1469{
1470 typedef typename UnaryReturn<PMatrix<T1,N,C>, FnPokeSpinMatrix>::Type_t Return_t;
1471
1472 for(int i=0; i < N; ++i)
1473 for(int j=0; j < N; ++j)
1474 pokeSpin(l.elem(i,j),r.elem(i,j),row);
1475 return static_cast<Return_t&>(l);
1476}
1477
1479
1480template<class T1, class T2, int N, template<class,int> class C>
1481inline typename UnaryReturn<PMatrix<T1,N,C>, FnPokeSpinMatrix>::Type_t&
1482pokeSpin(PMatrix<T1,N,C>& l, const PMatrix<T2,N,C>& r, int row, int col)
1483{
1484 typedef typename UnaryReturn<PMatrix<T1,N,C>, FnPokeSpinMatrix>::Type_t Return_t;
1485
1486 for(int i=0; i < N; ++i)
1487 for(int j=0; j < N; ++j)
1488 pokeSpin(l.elem(i,j),r.elem(i,j),row,col);
1489 return static_cast<Return_t&>(l);
1490}
1491
1492
1493
1495template<class T, int N, template<class,int> class C>
1496inline void
1498{
1499 for(int i=0; i < N; ++i)
1500 for(int j=0; j < N; ++j)
1501 zero_rep(dest.elem(i,j));
1502}
1503
1504
1506template<class T, class T1, int N, template<class,int> class C>
1507inline void
1509{
1510 for(int i=0; i < N; ++i)
1511 for(int j=0; j < N; ++j)
1512 copymask(d.elem(i,j),mask.elem(),s1.elem(i,j));
1513}
1514
1515
1517template<class T, class T1, int N, template<class,int> class C>
1518inline void
1520{
1521 for(int i=0; i < N; ++i)
1522 for(int j=0; j < N; ++j)
1523 copy_site(d.elem(i,j), isite, s1.elem(i,j));
1524}
1525
1527template<class T, class T1, int N, template<class,int> class C>
1528inline void
1529copy_site(PMatrix<T,N,C>& d, int isite, const PScalar<T1>& s1)
1530{
1531 for(int i=0; i < N; ++i)
1532 for(int j=0; j < N; ++j)
1533 copy_site(d.elem(i,j), isite, s1.elem());
1534}
1535
1536
1538template<class T, class T1, int N, template<class,int> class C>
1539inline void
1541 const PMatrix<T1,N,C>& s0, int i0,
1542 const PMatrix<T1,N,C>& s1, int i1,
1543 const PMatrix<T1,N,C>& s2, int i2,
1544 const PMatrix<T1,N,C>& s3, int i3)
1545{
1546 for(int i=0; i < N; ++i)
1547 for(int j=0; j < N; ++j)
1548 gather_sites(d.elem(i,j),
1549 s0.elem(i,j), i0,
1550 s1.elem(i,j), i1,
1551 s2.elem(i,j), i2,
1552 s3.elem(i,j), i3);
1553}
1554
1555
1557template<class T, int N, template<class,int> class C, class T1, class T2>
1558inline void
1559fill_random(PMatrix<T,N,C>& d, T1& seed, T2& skewed_seed, const T1& seed_mult)
1560{
1561 // The skewed_seed is the starting seed to use
1562 for(int i=0; i < N; ++i)
1563 for(int j=0; j < N; ++j)
1564 fill_random(d.elem(i,j), seed, skewed_seed, seed_mult);
1565}
1566
1568template<class T, int N, template<class,int> class C>
1569inline void
1571{
1572 for(int i=0; i < N; ++i)
1573 for(int j=0; j < N; ++j)
1574 fill_gaussian(d.elem(i,j), r1.elem(i,j), r2.elem(i,j));
1575}
1576
1577
1578
1579#if 0
1580// Global sum over site indices only
1581template<class T, int N, template<class,int> class C>
1582struct UnaryReturn<PMatrix<T,N,C>, FnSum> {
1584};
1585
1586template<class T, int N, template<class,int> class C>
1587inline typename UnaryReturn<PMatrix<T,N,C>, FnSum>::Type_t
1588sum(const PMatrix<T,N,C>& s1)
1589{
1590 typename UnaryReturn<PMatrix<T,N,C>, FnSum>::Type_t d;
1591
1592 for(int i=0; i < N; ++i)
1593 for(int j=0; j < N; ++j)
1594 d.elem(i,j) = sum(s1.elem(i,j));
1595
1596 return d;
1597}
1598#endif
1599
1600
1601// InnerProduct (norm-seq) global sum = sum(tr(adj(s1)*s1))
1602template<class T, int N, template<class,int> class C>
1606
1607template<class T, int N, template<class,int> class C>
1611
1612template<class T, int N, template<class,int> class C>
1615{
1617
1618 d.elem() = localNorm2(s1.elem(0,0));
1619 for(int j=1; j < N; ++j)
1620 d.elem() += localNorm2(s1.elem(0,j));
1621
1622 for(int i=1; i < N; ++i)
1623 for(int j=0; j < N; ++j)
1624 d.elem() += localNorm2(s1.elem(i,j));
1625
1626 return d;
1627}
1628
1629
1631template<class T1, class T2, int N, template<class,int> class C>
1635
1637template<class T1, class T2, int N, template<class,int> class C>
1641
1642template<class T1, class T2, int N, template<class,int> class C>
1645{
1647
1648 d.elem() = localInnerProduct(s1.elem(0,0), s2.elem(0,0));
1649 for(int k=1; k < N; ++k)
1650 d.elem() += localInnerProduct(s1.elem(k,0), s2.elem(k,0));
1651
1652 for(int j=1; j < N; ++j)
1653 for(int k=0; k < N; ++k)
1654 d.elem() += localInnerProduct(s1.elem(k,j), s2.elem(k,j));
1655
1656 return d;
1657}
1658
1660template<class T1, class T2, int N, template<class,int> class C>
1664
1665template<class T1, class T2, int N, template<class,int> class C>
1668{
1670
1671 d.elem() = localInnerProduct(s1.elem(0,0), s2.elem());
1672 for(int k=1; k < N; ++k)
1673 d.elem() += localInnerProduct(s1.elem(k,k), s2.elem());
1674
1675 return d;
1676}
1677
1679template<class T1, class T2, int N, template<class,int> class C>
1683
1684template<class T1, class T2, int N, template<class,int> class C>
1687{
1689
1690 d.elem() = localInnerProduct(s1.elem(), s2.elem(0,0));
1691 for(int k=1; k < N; ++k)
1692 d.elem() += localInnerProduct(s1.elem(), s2.elem(k,k));
1693
1694 return d;
1695}
1696
1697
1699
1702template<class T1, class T2, int N, template<class,int> class C>
1706
1708template<class T1, class T2, int N, template<class,int> class C>
1712
1713template<class T1, class T2, int N, template<class,int> class C>
1716{
1718
1719 d.elem() = localInnerProductReal(s1.elem(0,0), s2.elem(0,0));
1720 for(int k=1; k < N; ++k)
1721 d.elem() += localInnerProductReal(s1.elem(k,0), s2.elem(k,0));
1722
1723 for(int j=1; j < N; ++j)
1724 for(int k=0; k < N; ++k)
1725 d.elem() += localInnerProductReal(s1.elem(k,j), s2.elem(k,j));
1726
1727 return d;
1728}
1729
1731template<class T1, class T2, int N, template<class,int> class C>
1735
1736template<class T1, class T2, int N, template<class,int> class C>
1739{
1741
1742 d.elem() = localInnerProductReal(s1.elem(0,0), s2.elem());
1743 for(int k=1; k < N; ++k)
1744 d.elem() += localInnerProductReal(s1.elem(k,0), s2.elem(k,k));
1745
1746 return d;
1747}
1748
1750template<class T1, class T2, int N, template<class,int> class C>
1754
1755template<class T1, class T2, int N, template<class,int> class C>
1758{
1760
1761 d.elem() = localInnerProductReal(s1.elem(), s2.elem(0,0));
1762 for(int k=1; k < N; ++k)
1763 d.elem() += localInnerProductReal(s1.elem(), s2.elem(k,k));
1764
1765 return d;
1766}
1767
1768
1770
1774template<class T1, class T2, class T3, int N, template<class,int> class C>
1778
1779template<class T1, class T2, class T3, int N, template<class,int> class C>
1782{
1784
1785 // Not optimal - want to have where outside assignment
1786 for(int i=0; i < N; ++i)
1787 for(int j=0; j < N; ++j)
1788 d.elem(i,j) = where(a.elem(), b.elem(i,j), c.elem(i,j));
1789
1790 return d;
1791}
1792 // end of group primmatrix
1794
1795} // namespace QDP
1796
1797#endif
T & elem(int i)
Definition qdp_outer.h:400
Primitive Matrix class.
CC & operator*=(const PScalar< T1 > &rhs)
PMatrix *= PScalar.
CC & assign(const PScalar< T1 > &rhs)
PMatrix = PScalar.
CC & operator-=(const PScalar< T1 > &rhs)
PMatrix -= PScalar.
CC & operator-=(const C< T1, N > &rhs)
PMatrix -= PMatrix.
T & elem(int i, int j)
CC & operator+=(const PScalar< T1 > &rhs)
PMatrix += PScalar.
CC & operator+=(const C< T1, N > &rhs)
PMatrix += PMatrix.
CC & assign(const C< T1, N > &rhs)
PMatrix = PMatrix.
const T & elem(int i, int j) const
CC & operator/=(const PScalar< T1 > &rhs)
PMatrix /= PScalar.
Primitive Scalar.
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 >, OpAdjMultiplyAdj >::Type_t adjMultiplyAdj(const IScalar< T1 > &l, const IScalar< T2 > &r)
Definition qdp_inner.h:1198
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
OLattice< PScalar< PColorMatrix< RComplexFloat, 3 > > > C
BinaryReturn< PColorMatrix< T1, N >, PColorMatrix< T2, N >, FnTraceColorMultiply >::Type_t traceColorMultiply(const PColorMatrix< T1, N > &l, const PColorMatrix< T2, N > &r)
BinaryReturn< PMatrix< T1, N, C >, PMatrix< T2, N, C >, FnTraceMultiply >::Type_t traceMultiply(const PMatrix< T1, N, C > &l, const PMatrix< T2, N, C > &r)
BinaryReturn< PMatrix< T1, N, C >, PMatrix< T2, N, C >, FnTraceSpinMultiply >::Type_t traceSpinMultiply(const PMatrix< T1, N, C > &l, const PMatrix< T2, N, C > &r)
Yet another random number generator.
MakeReturn< UnaryNode< FnTraceSpin, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnTraceSpin >::Type_t >::Expression_t traceSpin(const QDPExpr< T1, C1 > &l)
Definition qdp.h:4959
MakeReturn< UnaryNode< FnAdjoint, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnAdjoint >::Type_t >::Expression_t adj(const QDPExpr< T1, C1 > &l)
Definition qdp.h:4842
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< 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< 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< FnRealTrace, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnRealTrace >::Type_t >::Expression_t realTrace(const QDPExpr< T1, C1 > &l)
Definition qdp.h:4920
MakeReturn< UnaryNode< FnTrace, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnTrace >::Type_t >::Expression_t trace(const QDPExpr< T1, C1 > &l)
Definition qdp.h:4907
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< 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< FnTraceColor, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnTraceColor >::Type_t >::Expression_t traceColor(const QDPExpr< T1, C1 > &l)
Definition qdp.h:4946
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< FnTransposeColor, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnTransposeColor >::Type_t >::Expression_t transposeColor(const QDPExpr< T1, C1 > &l)
Definition qdp.h:4881
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< FnTransposeSpin, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnTransposeSpin >::Type_t >::Expression_t transposeSpin(const QDPExpr< T1, C1 > &l)
Definition qdp.h:4894
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< FnTranspose, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnTranspose >::Type_t >::Expression_t transpose(const QDPExpr< T1, C1 > &l)
Definition qdp.h:4868
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< FnImagTrace, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnImagTrace >::Type_t >::Expression_t imagTrace(const QDPExpr< T1, C1 > &l)
Definition qdp.h:4933
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
OLattice< PScalar< PColorMatrix< RComplexFloat, 3 > > > C
C< typename BinaryReturn< T1, T2, FnTraceSpinMultiply >::Type_t, N > Type_t
PScalar< typename BinaryReturn< T1, T2, FnInnerProductReal >::Type_t > Type_t
PScalar< typename BinaryReturn< T1, T2, FnTraceMultiply >::Type_t > Type_t
PScalar< typename BinaryReturn< T1, T2, FnLocalInnerProductReal >::Type_t > Type_t
C< typename BinaryReturn< T1, T2, FnTraceColorMultiply >::Type_t, N > Type_t
PScalar< typename BinaryReturn< T1, T2, FnInnerProduct >::Type_t > Type_t
C< typename BinaryReturn< T1, T2, OpAdd >::Type_t, N > Type_t
C< typename BinaryReturn< T1, T2, OpAdjMultiply >::Type_t, N > Type_t
C< typename BinaryReturn< T1, T2, OpMultiplyAdj >::Type_t, N > Type_t
C< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, N > Type_t
C< typename BinaryReturn< T1, T2, OpSubtract >::Type_t, N > Type_t
C< typename BinaryReturn< T1, T2, OpAdjMultiplyAdj >::Type_t, N > Type_t
PScalar< typename BinaryReturn< T1, T2, FnLocalInnerProduct >::Type_t > Type_t
PScalar< typename BinaryReturn< T1, T2, FnLocalInnerProductReal >::Type_t > Type_t
PScalar< typename BinaryReturn< T1, T2, FnLocalInnerProduct >::Type_t > Type_t
C< typename BinaryReturn< T1, T2, FnTraceColorMultiply >::Type_t, N > Type_t
PScalar< typename BinaryReturn< T1, T2, FnTraceMultiply >::Type_t > Type_t
C< typename BinaryReturn< T1, T2, FnTraceSpinMultiply >::Type_t, N > Type_t
C< typename BinaryReturn< T1, T2, OpAdd >::Type_t, N > Type_t
C< typename BinaryReturn< T1, T2, OpAdjMultiplyAdj >::Type_t, N > Type_t
C< typename BinaryReturn< T1, T2, OpAdjMultiply >::Type_t, N > Type_t
C< typename BinaryReturn< T1, T2, OpDivide >::Type_t, N > Type_t
C< typename BinaryReturn< T1, T2, OpMultiplyAdj >::Type_t, N > Type_t
C< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, N > Type_t
C< typename BinaryReturn< T1, T2, OpSubtract >::Type_t, N > Type_t
PScalar< typename BinaryReturn< T1, T2, FnLocalInnerProductReal >::Type_t > Type_t
PScalar< typename BinaryReturn< T1, T2, FnLocalInnerProduct >::Type_t > Type_t
C< typename BinaryReturn< T1, T2, FnTraceColorMultiply >::Type_t, N > Type_t
PScalar< typename BinaryReturn< T1, T2, FnTraceMultiply >::Type_t > Type_t
C< typename BinaryReturn< T1, T2, FnTraceSpinMultiply >::Type_t, N > Type_t
C< typename BinaryReturn< T1, T2, OpAdd >::Type_t, N > Type_t
C< typename BinaryReturn< T1, T2, OpAdjMultiplyAdj >::Type_t, N > Type_t
C< typename BinaryReturn< T1, T2, OpAdjMultiply >::Type_t, N > Type_t
C< typename BinaryReturn< T1, T2, OpMultiplyAdj >::Type_t, N > Type_t
C< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, N > Type_t
C< typename BinaryReturn< T1, T2, OpSubtract >::Type_t, N > Type_t
PMatrix< typename DoublePrecType< T1 >::Type_t, N, C > 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 matrix components.
Definition qdp_newops.h:321
Structure for inserting spin matrix components.
Definition qdp_newops.h:472
PScalar< typename InternalScalar< T >::Type_t > Type_t
Construct simple word type used at some level within primitives.
Definition qdp_traits.h:98
C< 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
PMatrix< typename SinglePrecType< T1 >::Type_t, N, C > Type_t
C< typename TrinaryReturn< T1, T2, T3, FnWhere >::Type_t, N > Type_t
C< typename UnaryReturn< T, FnAdjoint >::Type_t, N > Type_t
C< typename UnaryReturn< T, FnConjugate >::Type_t, N > Type_t
C< typename UnaryReturn< T, FnGetSite >::Type_t, N > Type_t
PScalar< typename UnaryReturn< T, FnImagTrace >::Type_t > Type_t
C< typename UnaryReturn< T, FnImag >::Type_t, N > Type_t
PScalar< typename UnaryReturn< T, FnLocalNorm2 >::Type_t > Type_t
PScalar< typename UnaryReturn< T, FnNorm2 >::Type_t > Type_t
C< typename UnaryReturn< T, FnPeekColorMatrix >::Type_t, N > Type_t
C< typename UnaryReturn< T, FnPeekColorVector >::Type_t, N > Type_t
C< typename UnaryReturn< T, FnPeekSpinMatrix >::Type_t, N > Type_t
C< typename UnaryReturn< T, FnPeekSpinVector >::Type_t, N > Type_t
C< typename UnaryReturn< T, FnPokeColorMatrix >::Type_t, N > Type_t
C< typename UnaryReturn< T, FnPokeSpinMatrix >::Type_t, N > Type_t
PScalar< typename UnaryReturn< T, FnRealTrace >::Type_t > Type_t
C< typename UnaryReturn< T, FnReal >::Type_t, N > Type_t
C< typename UnaryReturn< T, FnTimesI >::Type_t, N > Type_t
C< typename UnaryReturn< T, FnTimesMinusI >::Type_t, N > Type_t
C< typename UnaryReturn< T, FnTraceColor >::Type_t, N > Type_t
C< typename UnaryReturn< T, FnTraceSpin >::Type_t, N > Type_t
PScalar< typename UnaryReturn< T, FnTrace >::Type_t > Type_t
C< typename UnaryReturn< T, FnTransposeColor >::Type_t, N > Type_t
C< typename UnaryReturn< T, FnTransposeSpin >::Type_t, N > Type_t
C< typename UnaryReturn< T, FnTranspose >::Type_t, N > Type_t
C< typename UnaryReturn< T, OpIdentity >::Type_t, N > Type_t
C< typename UnaryReturn< T, OpUnaryMinus >::Type_t, N > Type_t
C< typename UnaryReturn< T, OpUnaryPlus >::Type_t, N > Type_t
Find the underlying word type of a field.
Definition qdp_traits.h:29