summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hadamard.cpp24
-rw-r--r--hadamard_pt.hpp8
2 files changed, 20 insertions, 12 deletions
diff --git a/hadamard.cpp b/hadamard.cpp
index 9364d3c..c26b558 100644
--- a/hadamard.cpp
+++ b/hadamard.cpp
@@ -56,7 +56,7 @@ int main(int argc, char* argv[]) {
unsigned n_tuning = 1e2;
double β0 = 1.00;
double βf = 40.00;
- unsigned num = 40;
+ unsigned num = 136;
unsigned k = 2;
double ε = 0.01;
@@ -104,9 +104,12 @@ int main(int argc, char* argv[]) {
}
MeasureTransitionRates B(num);
- range r = {β0, βf, num};
+ range r1 = {0.0, 5.5, 44};
+ range r2 = {5.5, 6.5, 80};
+ range r3 = {6.5, 8, 12};
+ auto rs = {r1, r2, r3};
- PT p({r}, n, B, As);
+ PT p(rs, n, B, As);
for (MCMC& sim : p.Ms) {
sim.M = walsh(k);
@@ -120,8 +123,13 @@ int main(int argc, char* argv[]) {
p.run(N, M);
std::cout << "Finished " << n << ".\n";
- std::string filename = "probs_" + std::to_string(n) + "_" + std::to_string(β0) + "_" +
- std::to_string(βf) + "_" + std::to_string(num) + ".dat";
+ std::string rs_string = "";
+
+ for (range r : rs) {
+ rs_string += "_" + std::to_string(r.β0) + "_" + std::to_string(r.β1) + "_" + std::to_string(r.N);
+ }
+
+ std::string filename = "probs_" + std::to_string(n) + rs_string + ".dat";
std::ifstream file(filename);
unsigned N_old = 0;
@@ -158,8 +166,7 @@ int main(int argc, char* argv[]) {
file_out.close();
- std::string efilename = "energies_" + std::to_string(n) + "_" + std::to_string(β0) + "_" +
- std::to_string(βf) + "_" + std::to_string(num) + ".dat";
+ std::string efilename = "energies_" + std::to_string(n) + rs_string + ".dat";
std::ifstream efile(efilename);
unsigned Ne_old = 0;
@@ -187,8 +194,7 @@ int main(int argc, char* argv[]) {
efile_out.close();
- std::string ρfilename = "rhos_" + std::to_string(n) + "_" + std::to_string(β0) + "_" +
- std::to_string(βf) + "_" + std::to_string(num) + ".dat";
+ std::string ρfilename = "rhos_" + std::to_string(n) + rs_string + ".dat";
std::ifstream ρfile(ρfilename);
std::vector<std::vector<unsigned>> ρdata_old(As.size());
diff --git a/hadamard_pt.hpp b/hadamard_pt.hpp
index 744c866..0b32908 100644
--- a/hadamard_pt.hpp
+++ b/hadamard_pt.hpp
@@ -32,10 +32,12 @@ public:
PT(std::list<range> ranges, unsigned n, ParallelMeasurement& B,
std::vector<Measurement*>& As)
: B(B), As(As) {
+ unsigned count = 0;
for (range r : ranges) {
- for (unsigned i = 0; i < r.N; i++) {
- double β = r.β0 + i * (r.β1 - r.β0) / (r.N - 1);
- Ms.push_back(MCMC(n, β, *As[i]));
+ for (unsigned i = 1; i <= r.N; i++) {
+ double β = r.β0 + i * (r.β1 - r.β0) / r.N;
+ Ms.push_back(MCMC(n, β, *As[count]));
+ count++;
}
}
}