summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2019-12-11 19:43:02 -0500
committerJaron Kent-Dobias <jaron@kent-dobias.com>2019-12-11 19:43:02 -0500
commit782148c25b456a6549e8b35bcf9710c7afe22425 (patch)
treee228db9f03cbdd8717ddfadbf08546aaace267aa
parentd754b8720d7393b3b0ff2bc5e383668c161111b5 (diff)
downloadcode-782148c25b456a6549e8b35bcf9710c7afe22425.tar.gz
code-782148c25b456a6549e8b35bcf9710c7afe22425.tar.bz2
code-782148c25b456a6549e8b35bcf9710c7afe22425.zip
ranges are no longer hardcoded
-rw-r--r--hadamard.cpp37
1 files 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<double> β0s;
+ std::list<double> β1s;
+ std::list<unsigned> 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<range> 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<Measurement*> 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) {