4 #include "latlib/o815/o815.h"
6 #include "latlib/writeout.h"
8 #include "latlib/obstat.hpp"
14 class obs_plaq : public o815::obs {
20 obs_plaq(o815 *_O815);
24 void _meas(bool loadedobs, const int& nthmeas);
30 static double plaqSus(vector< vector<double> > *vals, void *para);
33 obstat<double,double> oPlaq;
36 obs_plaq::obs_plaq(o815 *_O815) : o815::obs("plaq",
37 _O815->paraQ->getParaNames() + "plaq:plaq_err:plaqsus:plaqsus_err",
38 _O815, sizeof(obsmem) ) {
40 Sim = (sim*)O815->Sim;
43 void obs_plaq::_start() {
44 //*out << "OBS_test: start" << endl;
47 void obs_plaq::_meas(bool loadedobs, const int& nthmeas) {
51 oPlaq.addMeas(OM->plaq);
54 void obs_plaq::_finish() {
55 *out << O815->paraQ->getParaVals();
57 int compid_plaq, compid_plaqsus;
59 compid_plaq = oPlaq.computeEasy();
60 compid_plaqsus = oPlaq.computeJack(obs_plaq::plaqSus, &(Sim->lsize4));
62 *out << "\t" << oPlaq.getMean(compid_plaq) << "\t" << oPlaq.getErr(compid_plaq);
63 *out << "\t" << oPlaq.getMean(compid_plaqsus) << "\t" << oPlaq.getErr(compid_plaqsus);
70 void obs_plaq::plaqCompute()
74 for( int ix=0; ix<Sim->lsize4; ix++ )
75 for( int inu=0; inu<3; inu++ )
76 for( int isigma=inu+1; isigma<4; isigma++ ) {
77 OM->plaq += real( Sim->U[ ix*4 + inu ] * Sim->U[ (*Sim->nb)[ix*8+inu]*4 + isigma ]
78 * conj(Sim->U[ (*Sim->nb)[ix*8+isigma]*4 + inu ]) * conj(Sim->U[ ix*4 + isigma ]) );
81 OM->plaq /= Sim->lsize4*6;
84 double obs_plaq::plaqSus(vector< vector<double> > *vals, void *para) {
85 double mean=0, mean2=0;
86 for(vector< vector<double> >::iterator valIt = vals->begin(); valIt != vals->end(); ++valIt)
89 mean2 += pow((*valIt)[0],2);
92 mean2 /= vals->size();
94 return ( mean2 - pow(mean,2) ) * *(int*)para * 6;