QDP++
qdp_primvector.h
Go to the documentation of this file.
1// -*- C++ -*-
2
6
7
8#ifndef QDP_PRIMVECTOR_H
9#define QDP_PRIMVECTOR_H
10
11namespace QDP {
12
13
14//-------------------------------------------------------------------------------------
22
24
30template <class T, int N, template<class,int> class C> class PVector
31{
32public:
33 PVector() { }
35
36 typedef C<T,N> CC;
37
39
40 template<class T1>
41 inline
42 CC& assign(const C<T1,N>& rhs)
43 {
44 for(int i=0; i < N; ++i)
45 elem(i) = rhs.elem(i);
46
47 return static_cast<CC&>(*this);
48 }
49
51
52 template<class T1>
53 inline
54 CC& operator=(const C<T1,N>& rhs)
55 {
56 return assign(rhs);
57 }
58
60 template<class T1>
61 inline
62 CC& operator+=(const C<T1,N>& rhs)
63 {
64 for(int i=0; i < N; ++i)
65 elem(i) += rhs.elem(i);
66
67 return static_cast<CC&>(*this);
68 }
69
71 template<class T1>
72 inline
73 CC& operator-=(const C<T1,N>& rhs)
74 {
75 for(int i=0; i < N; ++i)
76 elem(i) -= rhs.elem(i);
77
78 return static_cast<CC&>(*this);
79 }
80
82 template<class T1>
83 inline
85 {
86 for(int i=0; i < N; ++i)
87 elem(i) *= rhs.elem();
88
89 return static_cast<CC&>(*this);
90 }
91
93 template<class T1>
94 inline
96 {
97 for(int i=0; i < N; ++i)
98 elem(i) /= rhs.elem();
99
100 return static_cast<CC&>(*this);
101 }
102
103
104#if 0
105 // NOTE: intentially avoid defining a copy constructor - let the compiler
106 // generate one via the bit copy mechanism. This effectively achieves
107 // the first form of the if below (QDP_USE_ARRAY_INITIALIZER) without having
108 // to use that syntax which is not strictly legal in C++.
109
111#if defined(QDP_USE_ARRAY_INITIALIZER)
112 PVector(const PVector& a) : F(a.F) {}
113#else
115 PVector(const PVector& a)
116 {
117
118 for(int i=0; i < N; ++i)
119 F[i] = a.F[i];
120 }
121#endif
122#endif
123
124
125public:
126 T& elem(int i) {return F[i];}
127 const T& elem(int i) const {return F[i];}
128
129private:
130 T F[N];
131
132};
133
134
136template<class T, int N, template<class,int> class C>
137inline
138std::istream& operator>>(std::istream& s, PVector<T,N,C>& d)
139{
140 for(int i=0; i < N; ++i)
141 s >> d.elem(i);
142
143 return s;
144}
145
146template<class T, int N, template<class,int> class C>
147inline
149{
150 for(int i=0; i < N; ++i)
151 s >> d.elem(i);
152
153 return s;
154}
155
157template<class T, int N, template<class,int> class C>
158inline
159std::ostream& operator<<(std::ostream& s, const PVector<T,N,C>& d)
160{
161 for(int i=0; i < N; ++i)
162 s << d.elem(i);
163
164 return s;
165}
166
168template<class T, int N, template<class,int> class C>
169inline
171{
172 for(int i=0; i < N; ++i)
173 s << d.elem(i);
174
175 return s;
176}
177
178
180template<class T, int N, template<class,int> class C>
181inline
183{
184 for(int i=0; i < N; ++i)
185 txt >> d.elem(i);
186
187 return txt;
188}
189
191template<class T, int N, template<class,int> class C>
192inline
194{
195 for(int i=0; i < N; ++i)
196 txt << d.elem(i);
197
198 return txt;
199}
200
201#ifdef QDP_USE_LIBXML2
203template<class T, int N, template<class,int> class C>
204inline
205XMLWriter& operator<<(XMLWriter& xml, const PVector<T,N,C>& d)
206{
207 xml.openTag("Vector");
208
209 XMLWriterAPI::AttributeList alist;
210
211 // Copy into another array first
212 for(int i=0; i < N; ++i)
213 {
214 alist.clear();
215 alist.push_back(XMLWriterAPI::Attribute("row", i));
216
217 xml.openTag("elem", alist);
218 xml << d.elem(i);
219 xml.closeTag();
220 }
221
222 xml.closeTag(); // Vector
223 return xml;
224}
225#endif // end of group primvector
227
228
229//-----------------------------------------------------------------------------
230// Traits classes
231//-----------------------------------------------------------------------------
232
233// Underlying word type
234template<class T1, int N, template<class,int> class C>
235struct WordType<PVector<T1,N,C> >
236{
237 typedef typename WordType<T1>::Type_t Type_t;
238};
239
240template<class T1, int N, template<class, int> class C>
245
246template<class T1, int N, template<class, int> class C>
251
252// Internally used scalars
253template<class T, int N, template<class,int> class C>
257
258// Makes a primitive scalar leaving grid alone
259template<class T, int N, template<class,int> class C>
263
264// Makes a lattice scalar leaving primitive indices alone
265template<class T, int N, template<class,int> class C>
269
270//-----------------------------------------------------------------------------
271// Traits classes to support return types
272//-----------------------------------------------------------------------------
273
274// Default unary(PVector) -> PVector
275template<class T1, int N, template<class,int> class C, class Op>
279// Default binary(PScalar,PVector) -> PVector
280template<class T1, class T2, int N, template<class,int> class C, class Op>
284
285// Default binary(PMatrix,PVector) -> PVector
286template<class T1, class T2, int N, template<class,int> class C1,
287 template<class,int> class C2, class Op>
288struct BinaryReturn<PMatrix<T1,N,C1>, PVector<T2,N,C2>, Op> {
289 typedef C2<typename BinaryReturn<T1, T2, Op>::Type_t, N> Type_t;
290};
291
292// Default binary(PVector,PScalar) -> PVector
293template<class T1, class T2, int N, template<class,int> class C, class Op>
297
298// Default binary(PVector,PVector) -> PVector
299template<class T1, class T2, int N, template<class,int> class C, class Op>
303
304
305#if 0
306template<class T1, class T2>
307struct UnaryReturn<PScalar<T2>, OpCast<T1> > {
309// typedef T1 Type_t;
310};
311#endif
312
313
314// Assignment is different
315template<class T1, class T2, int N, template<class,int> class C>
316struct BinaryReturn<PVector<T1,N,C>, PVector<T2,N,C>, OpAssign > {
317 typedef C<T1,N> &Type_t;
318};
319
320template<class T1, class T2, int N, template<class,int> class C>
321struct BinaryReturn<PVector<T1,N,C>, PVector<T2,N,C>, OpAddAssign > {
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
330template<class T1, class T2, int N, template<class,int> class C>
332 typedef C<T1,N> &Type_t;
333};
334
335template<class T1, class T2, int N, template<class,int> class C>
337 typedef C<T1,N> &Type_t;
338};
339
340
341
342
343//-----------------------------------------------------------------------------
344// Operators
345//-----------------------------------------------------------------------------
346
349
350// Primitive Vectors
351
352template<class T1, int N, template<class,int> class C>
355{
357
358 for(int i=0; i < N; ++i)
359 d.elem(i) = +l.elem(i);
360 return d;
361}
362
363
364template<class T1, int N, template<class,int> class C>
367{
369
370 for(int i=0; i < N; ++i)
371 d.elem(i) = -l.elem(i);
372 return d;
373}
374
375
376template<class T1, class T2, int N, template<class,int> class C>
377inline typename BinaryReturn<PVector<T1,N,C>, PVector<T2,N,C>, OpAdd>::Type_t
379{
381
382 for(int i=0; i < N; ++i)
383 d.elem(i) = l.elem(i) + r.elem(i);
384 return d;
385}
386
387
388template<class T1, class T2, int N, template<class,int> class C>
389inline typename BinaryReturn<PVector<T1,N,C>, PVector<T2,N,C>, OpSubtract>::Type_t
391{
393
394 for(int i=0; i < N; ++i)
395 d.elem(i) = l.elem(i) - r.elem(i);
396 return d;
397}
398
399
400// PVector * PScalar
401template<class T1, class T2, int N, template<class,int> class C>
402inline typename BinaryReturn<PVector<T1,N,C>, PScalar<T2>, OpMultiply>::Type_t
404{
406
407 for(int i=0; i < N; ++i)
408 d.elem(i) = l.elem(i) * r.elem();
409 return d;
410}
411
412// Optimized PVector * adj(PScalar)
413template<class T1, class T2, int N, template<class,int> class C>
414inline typename BinaryReturn<PVector<T1,N,C>, PScalar<T2>, OpMultiplyAdj>::Type_t
416{
418
419 for(int i=0; i < N; ++i)
420 d.elem(i) = multiplyAdj(l.elem(i), r.elem());
421 return d;
422}
423
424
425// PScalar * PVector
426template<class T1, class T2, int N, template<class,int> class C>
427inline typename BinaryReturn<PScalar<T1>, PVector<T2,N,C>, OpMultiply>::Type_t
429{
431
432 for(int i=0; i < N; ++i)
433 d.elem(i) = l.elem() * r.elem(i);
434 return d;
435}
436
437// Optimized adj(PScalar) * PVector
438template<class T1, class T2, int N, template<class,int> class C>
439inline typename BinaryReturn<PScalar<T1>, PVector<T2,N,C>, OpAdjMultiply>::Type_t
441{
443
444 for(int i=0; i < N; ++i)
445 d.elem(i) = adjMultiply(l.elem(), r.elem(i));
446 return d;
447}
448
449
450// PMatrix * PVector
451template<class T1, class T2, int N, template<class,int> class C1, template<class,int> class C2>
452inline typename BinaryReturn<PMatrix<T1,N,C1>, PVector<T2,N,C2>, OpMultiply>::Type_t
454{
456
457 for(int i=0; i < N; ++i)
458 {
459 d.elem(i) = l.elem(i,0) * r.elem(0);
460 for(int j=1; j < N; ++j)
461 d.elem(i) += l.elem(i,j) * r.elem(j);
462 }
463
464 return d;
465}
466
467// Optimized adj(PMatrix)*PVector
468template<class T1, class T2, int N, template<class,int> class C1, template<class,int> class C2>
469inline typename BinaryReturn<PMatrix<T1,N,C1>, PVector<T2,N,C2>, OpAdjMultiply>::Type_t
471{
473
474 for(int i=0; i < N; ++i)
475 {
476 d.elem(i) = adjMultiply(l.elem(0,i), r.elem(0));
477 for(int j=1; j < N; ++j)
478 d.elem(i) += adjMultiply(l.elem(j,i), r.elem(j));
479 }
480
481 return d;
482}
483
484
485template<class T1, class T2, int N, template<class,int> class C>
486inline typename BinaryReturn<PVector<T1,N,C>, PScalar<T2>, OpDivide>::Type_t
488{
490
491 for(int i=0; i < N; ++i)
492 d.elem(i) = l.elem(i) / r.elem();
493 return d;
494}
495
496
497
499template<class T, int N, template<class,int> class C>
502{
504
505 for(int i=0; i < N; ++i)
506 d.elem(i) = real(s1.elem(i));
507
508 return d;
509}
510
511
513template<class T, int N, template<class,int> class C>
516{
518
519 for(int i=0; i < N; ++i)
520 d.elem(i) = imag(s1.elem(i));
521
522 return d;
523}
524
525
527template<class T1, class T2, int N, template<class,int> class C>
528inline typename BinaryReturn<PVector<T1,N,C>, PVector<T2,N,C>, FnCmplx>::Type_t
530{
532
533 for(int i=0; i < N; ++i)
534 d.elem(i) = cmplx(s1.elem(i), s2.elem(i));
535
536 return d;
537}
538
539
540//-----------------------------------------------------------------------------
541// These functions always return bool
543template<class T1, int N, template<class,int> class C>
544struct UnaryReturn<PVector<T1,N,C>, FnIsNan> {
545 bool Type_t;
546};
547
548template<class T1, int N, template<class,int> class C>
549inline bool
551{
552 bool d = false;
553
554 for(int i=0; i < N; ++i)
555 d |= isnan(l.elem(i));
556
557 return d;
558}
559
561template<class T1, int N, template<class,int> class C>
562struct UnaryReturn<PVector<T1,N,C>, FnIsInf> {
563 bool Type_t;
564};
565
566template<class T1, int N, template<class,int> class C>
567inline bool
569{
570 bool d = false;
571
572 for(int i=0; i < N; ++i)
573 d |= isinf(l.elem(i));
574
575 return d;
576}
577
579template<class T1, int N, template<class,int> class C>
581 bool Type_t;
582};
583
584template<class T1, int N, template<class,int> class C>
585inline bool
587{
588 bool d = true;
589
590 for(int i=0; i < N; ++i)
591 d &= isnormal(l.elem(i));
592
593 return d;
594}
595
597template<class T1, int N, template<class,int> class C>
599 bool Type_t;
600};
601
602template<class T1, int N, template<class,int> class C>
603inline bool
605{
606 bool d = true;
607
608 for(int i=0; i < N; ++i)
609 d &= isfinite(l.elem(i));
610
611 return d;
612}
613
614
615//-----------------------------------------------------------------------------
616// Functions
617// Conjugate
618template<class T1, int N, template<class,int> class C>
621{
623
624 for(int i=0; i < N; ++i)
625 d.elem(i) = conj(l.elem(i));
626
627 return d;
628}
629
631template<class T, int N, template<class,int> class C>
634{
636
637 for(int i=0; i < N; ++i)
638 d.elem(i) = timesI(s1.elem(i));
639
640 return d;
641}
642
644template<class T, int N, template<class,int> class C>
647{
649
650 for(int i=0; i < N; ++i)
651 d.elem(i) = timesMinusI(s1.elem(i));
652
653 return d;
654}
655
656
658
659template<class T, int N, template<class,int> class C>
660inline typename UnaryReturn<PVector<T,N,C>, FnGetSite>::Type_t
661getSite(const PVector<T,N,C>& s1, int innersite)
662{
664
665 for(int i=0; i < N; ++i)
666 d.elem(i) = getSite(s1.elem(i), innersite);
667
668 return d;
669}
670
672
673template<class T, int N, template<class,int> class C>
674inline typename UnaryReturn<PVector<T,N,C>, FnPeekColorVector>::Type_t
675peekColor(const PVector<T,N,C>& l, int row)
676{
678
679 for(int i=0; i < N; ++i)
680 d.elem(i) = peekColor(l.elem(i),row);
681 return d;
682}
683
685
686template<class T, int N, template<class,int> class C>
687inline typename UnaryReturn<PVector<T,N,C>, FnPeekColorMatrix>::Type_t
688peekColor(const PVector<T,N,C>& l, int row, int col)
689{
691
692 for(int i=0; i < N; ++i)
693 d.elem(i) = peekColor(l.elem(i),row,col);
694 return d;
695}
696
698
699template<class T, int N, template<class,int> class C>
700inline typename UnaryReturn<PVector<T,N,C>, FnPeekSpinVector>::Type_t
701peekSpin(const PVector<T,N,C>& l, int row)
702{
704
705 for(int i=0; i < N; ++i)
706 d.elem(i) = peekSpin(l.elem(i),row);
707 return d;
708}
709
711
712template<class T, int N, template<class,int> class C>
713inline typename UnaryReturn<PVector<T,N,C>, FnPeekSpinMatrix>::Type_t
714peekSpin(const PVector<T,N,C>& l, int row, int col)
715{
717
718 for(int i=0; i < N; ++i)
719 d.elem(i) = peekSpin(l.elem(i),row,col);
720 return d;
721}
722
724
725template<class T1, class T2, int N, template<class,int> class C>
726inline typename UnaryReturn<PVector<T1,N,C>, FnPokeColorVector>::Type_t&
728{
729 typedef typename UnaryReturn<PVector<T1,N,C>, FnPokeColorVector>::Type_t Return_t;
730
731 for(int i=0; i < N; ++i)
732 pokeColor(l.elem(i),r.elem(i),row);
733 return static_cast<Return_t&>(l);
734}
735
737
738template<class T1, class T2, int N, template<class,int> class C>
739inline typename UnaryReturn<PVector<T1,N,C>, FnPokeColorVector>::Type_t&
740pokeColor(PVector<T1,N,C>& l, const PVector<T2,N,C>& r, int row, int col)
741{
742 typedef typename UnaryReturn<PVector<T1,N,C>, FnPokeColorVector>::Type_t Return_t;
743
744 for(int i=0; i < N; ++i)
745 pokeColor(l.elem(i),r.elem(i),row,col);
746 return static_cast<Return_t&>(l);
747}
748
750
751template<class T1, class T2, int N, template<class,int> class C>
752inline typename UnaryReturn<PVector<T1,N,C>, FnPokeSpinVector>::Type_t&
754{
755 typedef typename UnaryReturn<PVector<T1,N,C>, FnPokeSpinVector>::Type_t Return_t;
756
757 for(int i=0; i < N; ++i)
758 pokeSpin(l.elem(i),r.elem(i),row);
759 return static_cast<Return_t&>(l);
760}
761
763
764template<class T1, class T2, int N, template<class,int> class C>
765inline typename UnaryReturn<PVector<T1,N,C>, FnPokeSpinVector>::Type_t&
766pokeSpin(PVector<T1,N,C>& l, const PVector<T2,N,C>& r, int row, int col)
767{
768 typedef typename UnaryReturn<PVector<T1,N,C>, FnPokeSpinVector>::Type_t Return_t;
769
770 for(int i=0; i < N; ++i)
771 pokeSpin(l.elem(i),r.elem(i),row,col);
772 return static_cast<Return_t&>(l);
773}
774
775
777template<class T, int N, template<class,int> class C>
778inline void
780{
781 for(int i=0; i < N; ++i)
782 zero_rep(dest.elem(i));
783}
784
786template<class T, class T1, int N, template<class,int> class C>
787inline void
789{
790 for(int i=0; i < N; ++i)
791 copymask(d.elem(i),mask.elem(),s1.elem(i));
792}
793
794
796template<class T, class T1, int N, template<class,int> class C>
797inline void
798copy_site(PVector<T,N,C>& d, int isite, const PVector<T1,N,C>& s1)
799{
800 for(int i=0; i < N; ++i)
801 copy_site(d.elem(i), isite, s1.elem(i));
802}
803
805template<class T, class T1, int N, template<class,int> class C>
806inline void
807copy_site(PVector<T,N,C>& d, int isite, const PScalar<T1>& s1)
808{
809 for(int i=0; i < N; ++i)
810 copy_site(d.elem(i), isite, s1.elem());
811}
812
813
815template<class T, class T1, int N, template<class,int> class C>
816inline void
818 const PVector<T1,N,C>& s0, int i0,
819 const PVector<T1,N,C>& s1, int i1,
820 const PVector<T1,N,C>& s2, int i2,
821 const PVector<T1,N,C>& s3, int i3)
822{
823 for(int i=0; i < N; ++i)
824 gather_sites(d.elem(i),
825 s0.elem(i), i0,
826 s1.elem(i), i1,
827 s2.elem(i), i2,
828 s3.elem(i), i3);
829}
830
831
833template<class T, int N, template<class,int> class C, class T1, class T2>
834inline void
835fill_random(PVector<T,N,C>& d, T1& seed, T2& skewed_seed, const T1& seed_mult)
836{
837 // Loop over rows the slowest
838 for(int i=0; i < N; ++i)
839 fill_random(d.elem(i), seed, skewed_seed, seed_mult);
840}
841
842
844template<class T, int N, template<class,int> class C>
845inline void
847{
848 for(int i=0; i < N; ++i)
849 fill_gaussian(d.elem(i), r1.elem(i), r2.elem(i));
850}
851
852
853#if 0
854// Global sum over site indices only
855template<class T, int N, template<class,int> class C>
856struct UnaryReturn<PVector<T,N,C>, FnSum > {
858};
859
860template<class T, int N, template<class,int> class C>
861inline typename UnaryReturn<PVector<T,N,C>, FnSum>::Type_t
862sum(const PVector<T,N,C>& s1)
863{
864 typename UnaryReturn<PVector<T,N,C>, FnSum>::Type_t d;
865
866 for(int i=0; i < N; ++i)
867 d.elem(i) = sum(s1.elem(i));
868
869 return d;
870}
871#endif
872
873
874// InnerProduct (norm-seq) global sum = sum(tr(adj(s1)*s1))
875template<class T, int N, template<class,int> class C>
879
880template<class T, int N, template<class,int> class C>
884
885template<class T, int N, template<class,int> class C>
888{
890
891 d.elem() = localNorm2(s1.elem(0));
892 for(int i=1; i < N; ++i)
893 d.elem() += localNorm2(s1.elem(i));
894
895 return d;
896}
897
898
900template<class T1, class T2, int N, template<class,int> class C>
904
905template<class T1, class T2, int N, template<class,int> class C>
909
910template<class T1, class T2, int N, template<class,int> class C>
913{
915
916 d.elem() = localInnerProduct(s1.elem(0), s2.elem(0));
917 for(int i=1; i < N; ++i)
918 d.elem() += localInnerProduct(s1.elem(i), s2.elem(i));
919
920 return d;
921}
922
923
925
928template<class T1, class T2, int N, template<class,int> class C>
932
933template<class T1, class T2, int N, template<class,int> class C>
937
938template<class T1, class T2, int N, template<class,int> class C>
941{
943
944 d.elem() = localInnerProductReal(s1.elem(0), s2.elem(0));
945 for(int i=1; i < N; ++i)
946 d.elem() += localInnerProductReal(s1.elem(i), s2.elem(i));
947
948 return d;
949}
950
951
952// This PVector<T1,N,C> stuff versus PSpinVector<T1,N> is causing problems.
953// When searching for type matching functions, the language does not allow
954// for varying template arguments to match a function. We should just move
955// away from PVector to use PSpinVector and PColorVector. However, have to
956// replicate all the functions. Uggh - another day...
957
958//
960//template<class T1, class T2, int N, template<class,int> class C>
961//struct BinaryReturn<PScalar<T1>, PVector<T2,N,C>, FnLocalInnerProduct> {
962// typedef PVector<typename BinaryReturn<T1, T2, FnLocalInnerProduct>::Type_t, N, C> Type_t;
963//};
964//
965//template<class T1, class T2, int N, template<class,int> class C>
966//inline PVector<typename BinaryReturn<T1, T2, FnLocalInnerProduct>::Type_t,N,C>
967//localInnerProduct(const PScalar<T1>& s1, const PVector<T2,N,C>& s2)
968//{
969// typename BinaryReturn<PScalar<T1>, PVector<T2,N,C>, FnLocalInnerProduct>::Type_t d;
970//
971// for(int i=0; i < N; ++i)
972// d.elem(i) = localInnerProduct(s1.elem(0), s2.elem(i));
973//
974// return d;
975//}
976//
977//
980// * return realpart of InnerProduct(adj(s1)*s2)
981// */
982//template<class T1, class T2, int N, template<class,int> class C>
983//struct BinaryReturn<PScalar<T1>, PVector<T2,N,C>, FnLocalInnerProductReal > {
984// typedef PVector<typename BinaryReturn<T1, T2, FnLocalInnerProductReal>::Type_t, N,C> Type_t;
985//};
986//
987//template<class T1, class T2, int N, template<class,int> class C>
988//inline PVector<typename BinaryReturn<T1, T2, FnLocalInnerProductReal>::Type_t,N,C>
989//localInnerProductReal(const PScalar<T1>& s1, const PVector<T2,N,C>& s2)
990//{
991// typename BinaryReturn<PScalar<T1>, PVector<T2,N,C>, FnLocalInnerProductReal>::Type_t d;
992//
993// for(int i=0; i < N; ++i)
994// d.elem(i) = localInnerProductReal(s1.elem(), s2.elem(i));
995//
996// return d;
997//}
998
999
1001
1005template<class T1, class T2, class T3, int N, template<class,int> class C>
1009
1010template<class T1, class T2, class T3, int N, template<class,int> class C>
1013{
1015
1016 // Not optimal - want to have where outside assignment
1017 for(int i=0; i < N; ++i)
1018 d.elem(i) = where(a.elem(), b.elem(i), c.elem(i));
1019
1020 return d;
1021}
1022 // end of group primvector
1024
1025} // namespace QDP
1026
1027#endif
T & elem(int i)
Definition qdp_outer.h:400
Primitive Matrix class.
T & elem(int i, int j)
Primitive Scalar.
Primitive Vector class.
CC & operator/=(const PScalar< T1 > &rhs)
PVector /= PScalar.
CC & operator*=(const PScalar< T1 > &rhs)
PVector *= PScalar.
CC & operator-=(const C< T1, N > &rhs)
PVector -= PVector.
CC & operator=(const C< T1, N > &rhs)
PVector = PVector.
CC & operator+=(const C< T1, N > &rhs)
PVector += PVector.
T & elem(int i)
const T & elem(int i) const
CC & assign(const C< T1, N > &rhs)
PVector = PVector.
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
OLattice< PScalar< PColorMatrix< RComplexFloat, 3 > > > C
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< 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< 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< 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< 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< 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< FnImag, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnImag >::Type_t >::Expression_t imag(const QDPExpr< T1, C1 > &l)
Definition qdp.h:4985
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
C2< typename BinaryReturn< T1, T2, Op >::Type_t, N > Type_t
C< typename BinaryReturn< T1, T2, Op >::Type_t, N > Type_t
C< typename BinaryReturn< T1, T2, Op >::Type_t, N > Type_t
PScalar< typename BinaryReturn< T1, T2, FnInnerProductReal >::Type_t > Type_t
PScalar< typename BinaryReturn< T1, T2, FnLocalInnerProduct >::Type_t > Type_t
PScalar< typename BinaryReturn< T1, T2, FnInnerProduct >::Type_t > Type_t
C< typename BinaryReturn< T1, T2, Op >::Type_t, N > Type_t
PScalar< typename BinaryReturn< T1, T2, FnLocalInnerProductReal >::Type_t > Type_t
PVector< 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 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
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
PVector< typename SinglePrecType< T1 >::Type_t, N, C > Type_t
C< typename TrinaryReturn< T1, T2, T3, FnWhere >::Type_t, N > Type_t
C< 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
Find the underlying word type of a field.
Definition qdp_traits.h:29