From 782148c25b456a6549e8b35bcf9710c7afe22425 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Wed, 11 Dec 2019 19:43:02 -0500 Subject: ranges are no longer hardcoded --- hadamard.cpp | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/hadamard.cpp b/hadamard.cpp index c26b558..076458f 100644 --- a/hadamard.cpp +++ b/hadamard.cpp @@ -54,9 +54,9 @@ public: int main(int argc, char* argv[]) { unsigned n_tuning = 1e2; - double β0 = 1.00; - double βf = 40.00; - unsigned num = 136; + std::list β0s; + std::list β1s; + std::list Ns; unsigned k = 2; double ε = 0.01; @@ -71,16 +71,16 @@ int main(int argc, char* argv[]) { k = atoi(optarg); break; case 'b': - β0 = atof(optarg); + β0s.push_back(atof(optarg)); break; case 'c': - βf = atof(optarg); + β1s.push_back(atof(optarg)); break; case 'e': ε = atof(optarg); break; case 'n': - num = atof(optarg); + Ns.push_back((unsigned)atof(optarg)); break; case 't': n_tuning = (unsigned)atof(optarg); @@ -98,17 +98,32 @@ int main(int argc, char* argv[]) { unsigned n = pow(2, k); + std::list rs; + unsigned num = 0; + + if ((β0s.size() != β1s.size()) || (β0s.size() != Ns.size())) { + std::cout << "You need the same number of ranges!\n"; + exit(0); + } else { + auto it0 = β0s.begin(); + auto it1 = β1s.begin(); + auto itN = Ns.begin(); + + while (it0 != β0s.end()) { + rs.push_back({*it0, *it1, *itN}); + num += *itN; + it0++; + it1++; + itN++; + } + } + std::vector As(num); for (Measurement*& A : As) { A = new MeasureEnergy(); } MeasureTransitionRates B(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(rs, n, B, As); for (MCMC& sim : p.Ms) { -- cgit v1.2.3-70-g09d2