Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

derivative.h

Go to the documentation of this file.
00001 //------------------------------------------------------------------
00002 //  
00003 //   derivative.h
00004 //  
00005 //   Header file for the  Shift class and Derivative classes
00006 //  
00007 //   March 2001
00008 //  
00009 //   Kostas Orginos
00010 //  
00011 //------------------------------------------------------------------*/
00012 #ifndef INCLUDED_DERIVATIVE_H
00013 #define INCLUDED_DERIVATIVE_H
00014 #include <stdio.h>
00015 #include <util/data_types.h>
00016 #include <util/site.h>
00017 
00018 CPS_START_NAMESPACE
00019 
00020 enum Dir {FRWD=+1,
00021           BKWD=-1 };
00022 
00023 enum Quark {QUARK =+1,
00024             AQUARK=-1 };
00025 
00026 
00077 class Shift
00078 {
00079   int  d     ; // Forward or backward
00080   int  q     ; // Act on quark -> or on anti-quark <-
00081 
00082   bool more ; // Used to iterate over all possible shifts
00083 public:
00084   Shift(){}
00085   Shift(int d_, int q_): d(d_),q(q_){}
00086   
00088   int D() const {return d;}
00090   int Q() const {return q;}
00106   Float sign(){return (Float)(d*q);} 
00107 
00108   int bit(){return -d*q;} 
00109 
00110   void Modify(int d_, int q_){d=d_;q=q_;}
00111 
00113   void Next() ;
00114 
00116   bool NotEnd(){return more ; }
00118   void Start(){q=QUARK;d=FRWD;more=true;}
00120   void NextQuark(){d-=2;more=(d>=-1);}
00121 
00122 
00123   //For debugging
00124   //void print(){printf("shift: d=%2i q=%2i | %4g\n",d,q,sign());}
00125 
00126   ~Shift(){}
00127 };
00128 
00186 class Derivative
00187 {
00188   int* indx ;
00189   int Num ;
00190 
00191   bool more ;
00192   Shift* sh ;
00193 
00194   char *tag ;
00195 
00197   void Tag() ;
00198 
00199  public:
00200   Derivative():Num(0){Tag();}
00201 
00202   Derivative(int mu) ;
00203 
00204   Derivative(int mu,int nu) ;
00205   
00206   Derivative(int mu,int nu,int rho) ;
00207 
00208   Derivative(int *mu,int N) ;
00209   
00211   Derivative(const Derivative& tt) ;
00212 
00213   
00215   void Start() ;
00216 
00218   void Next() ;
00219 
00223   void NextQuark() ;
00224 
00226   bool NotEnd(){return more ; }
00227 
00232   void CalcEndPoints(int *aquark, int *quark, Site& s) ;
00233 
00238   void CalcListOfLinks(int *lnk) ;
00239 
00249   Float Fact() ;
00250 
00251 
00281   int DTermIndx() ;
00282 
00284   int N(){return Num;}
00285 
00287   void printTag(FILE *fp){fprintf(fp,"%s",tag);}
00288 
00289   // For debugging 
00290   //void sh_print(){for(int i(0);i<Num; i++) sh[i].print(); printf("\n"); }
00291 
00297   int NDTerms(){return 1<<Num ;}
00298   
00299   ~Derivative() ;
00300 
00301 } ;
00302 
00303 CPS_END_NAMESPACE
00304 
00305 #endif // !INCLUDED_DERIVATIVE_H  
00306 
00307 

Generated on Sat Oct 10 14:11:10 2009 for Columbia Physics System by  doxygen 1.3.9.1