00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef INCLUDED_CORRFUNC_H
00015 #define INCLUDED_CORRFUNC_H
00016
00017 #include <stdlib.h>
00018 #include <stdio.h>
00019 #include <util/data_types.h>
00020 #include <comms/glb.h>
00021 #include <util/gjp.h>
00022 #include <util/verbose.h>
00023 #include <util/error.h>
00024 #include <util/qcdio.h>
00025
00026 CPS_START_NAMESPACE
00027
00028 class CorrFunc {
00029 Complex *func ;
00030 int Nt ;
00031
00032 public:
00033 CorrFunc() ;
00034
00035 CorrFunc(const CorrFunc& rhs) ;
00036 ~CorrFunc(){ sfree(func);}
00037
00038 CorrFunc& operator=(const CorrFunc& rhs) ;
00039 CorrFunc& operator*=(const CorrFunc& rhs) ;
00040 CorrFunc& operator+=(const CorrFunc& rhs) ;
00041 CorrFunc& operator-=(const CorrFunc& rhs) ;
00042 CorrFunc& operator*=(const Float& r) ;
00043 CorrFunc& operator*=(const Complex& c) ;
00044
00045 int TimeSize() const {return Nt;}
00046
00047
00048 void print(FILE *fp) const
00049 {
00050 for(int t=0; t<Nt; t++)
00051 Fprintf(fp,"%i %e %e\n", t,func[t].real(),func[t].imag());
00052 }
00053
00054 void print(FILE *fp,int t) const
00055 {
00056 Fprintf(fp," %e %e ",func[t].real(),func[t].imag());
00057 }
00058
00059 void GlobalSum(void)
00060 {
00061 #if TARGET == QCDOC
00062 slice_sum((Float*)func, 2*Nt, 99);
00063 #endif
00064 }
00065
00066 Complex& operator[](int i) { return func[i] ; }
00067
00068 void Zero(){ for(int t = 0 ; t<Nt; t++) func[t] = 0.0 ;}
00069
00070 };
00071
00072 CPS_END_NAMESPACE
00073
00074 #endif
00075
00076