]> git.treefish.org Git - phys/heatbath.git/commitdiff
Made phip2 measurement much faster and much less stupid.
authorAlexander Schmidt <alex@treefish.org>
Thu, 28 Nov 2013 09:40:06 +0000 (10:40 +0100)
committerAlexander Schmidt <alex@treefish.org>
Thu, 28 Nov 2013 09:40:06 +0000 (10:40 +0100)
obs_phip2_hist.hpp

index 60c86b8e41e40bb18cfbf3152fe7acfdd5c99822..0f2ef3294052d99db9c08cc7cb7f29c85d9e934b 100644 (file)
@@ -41,17 +41,14 @@ void obs_phip2_hist::_meas(bool loadedobs, const int& nthmeas) {
     const double ppx = 2.*M_PI/O815->comargs.lsize[1] * ( 0 + int( kpimode/4. * O815->comargs.lsize[1] ) );
 
     if (!loadedobs) {
-      OM->phip2[ kpimode ] = 0;
-       
-      for (int ixt = 0; ixt < O815->comargs.lsize[0]; ixt++)
-       for (int ixx = 0; ixx < O815->comargs.lsize[1]; ixx++)
-         for (int ixpt = 0; ixpt < O815->comargs.lsize[0]; ixpt++)
-           for (int ixpx = 0; ixpx < O815->comargs.lsize[1]; ixpx++)
-             OM->phip2[ kpimode ] += real( conj( Sim->conf[ ixt*O815->comargs.lsize[1] + ixx ].phi )
-                                           * Sim->conf[ ixpt*O815->comargs.lsize[1] + ixpx ].phi
-                                           * exp ( _i_*(double)ppx*(double)(ixx-ixpx) + _i_*(double)ppt*(double)(ixt-ixpt) ) );
-       
-      OM->phip2[ kpimode ] /= Sim->LSIZE2;
+      complex<double> phitildepp = 0;
+      
+      for (int ixpt = 0; ixpt < O815->comargs.lsize[0]; ixpt++)
+       for (int ixpx = 0; ixpx < O815->comargs.lsize[1]; ixpx++)
+         phitildepp += Sim->conf[ ixpt*O815->comargs.lsize[1] + ixpx ].phi 
+           * exp ( - _i_*(double)ppx*(double)ixpx - _i_*(double)ppt*(double)ixpt );
+      
+      OM->phip2[ kpimode ] = norm( phitildepp) / Sim->LSIZE2;
     }
     
     *out << O815->paraQ->getParaVals();