89 attemptMoveTimer_.start();
93 double oldHamiltonian = simulator().hamiltonian();
96 simulator().saveState();
99 simulator().clearData();
103 attemptMoveTimer_.stop();
106 compressorTimer_.start();
107 int compress = simulator().compressor().compress();
109 compressorTimer_.stop();
111 bool isConverged =
false;
114 simulator().restoreState();
119 componentTimer_.start();
120 simulator().computeWc();
122 if (simulator().needsCc() || simulator().needsDc()){
125 simulator().computeCc();
128 if (simulator().needsDc()){
129 simulator().computeDc();
131 componentTimer_.stop();
134 hamiltonianTimer_.start();
135 simulator().computeHamiltonian();
136 double newHamiltonian = simulator().hamiltonian();
137 hamiltonianTimer_.stop();
140 decisionTimer_.start();
142 double weight = exp(-(newHamiltonian - oldHamiltonian));
143 accept = random().metropolis(weight);
146 simulator().clearState();
148 simulator().restoreState();
150 decisionTimer_.stop();
169 double total = totalTimer_.time();
171 <<
"Total" << std::setw(17) <<
"Per Move" << std::setw(14) <<
"Fraction" <<
"\n";
172 out <<
"Attempt Move: "
173 <<
Dbl(attemptMoveTimer_.time(), 9, 3) <<
" s, "
174 <<
Dbl(attemptMoveTimer_.time()/nAttempt_, 9, 3) <<
" s, "
175 <<
Dbl(attemptMoveTimer_.time()/total, 9, 3) <<
"\n";
176 out <<
"Compressor: "
177 <<
Dbl(compressorTimer_.time(), 9, 3) <<
" s, "
178 <<
Dbl(compressorTimer_.time()/nAttempt_, 9, 3) <<
" s, "
179 <<
Dbl(compressorTimer_.time()/total, 9, 3) <<
"\n";
180 out <<
"Compute eigen-components: "
181 <<
Dbl(componentTimer_.time(), 9, 3) <<
" s, "
182 <<
Dbl(componentTimer_.time()/nAttempt_, 9, 3) <<
" s, "
183 <<
Dbl(componentTimer_.time()/total, 9, 3) <<
"\n";
184 out <<
"Compute Hamiltonian: "
185 <<
Dbl(hamiltonianTimer_.time(), 9, 3) <<
" s, "
186 <<
Dbl(hamiltonianTimer_.time()/nAttempt_, 9, 3) <<
" s, "
187 <<
Dbl(hamiltonianTimer_.time()/total, 9, 3) <<
"\n";
188 out <<
"Accept or Reject: "
189 <<
Dbl(decisionTimer_.time(), 9, 3) <<
" s, "
190 <<
Dbl(decisionTimer_.time()/nAttempt_, 9, 3) <<
" s, "
191 <<
Dbl(decisionTimer_.time()/total, 9, 3) <<
"\n";
192 out <<
"total time: "
193 <<
Dbl(total, 9, 3) <<
" s, "
194 <<
Dbl(total/nAttempt_, 9, 3) <<
" s \n";