summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2020-12-29 14:40:04 +0100
committerJaron Kent-Dobias <jaron@kent-dobias.com>2020-12-29 14:40:04 +0100
commit7423dcb2938c3883abdc949411fcedc47b0e4705 (patch)
tree8a52563bd164864b97f15961e865f30e4696f769
parentfa131164b1a82cb165562b138051557f63068ee8 (diff)
downloadcode-7423dcb2938c3883abdc949411fcedc47b0e4705.tar.gz
code-7423dcb2938c3883abdc949411fcedc47b0e4705.tar.bz2
code-7423dcb2938c3883abdc949411fcedc47b0e4705.zip
New parameter to control length of Langevin simulation.
-rw-r--r--langevin.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/langevin.cpp b/langevin.cpp
index 8660330..241abaf 100644
--- a/langevin.cpp
+++ b/langevin.cpp
@@ -192,14 +192,18 @@ int main(int argc, char* argv[]) {
// simulation parameters
double δ = 1e-2; // threshold for determining saddle
double γ = 1e-2; // step size
+ unsigned t = 1000; // number of Langevin steps
int opt;
- while ((opt = getopt(argc, argv, "N:T:E:e:r:i:g:")) != -1) {
+ while ((opt = getopt(argc, argv, "N:T:e:r:i:g:t:")) != -1) {
switch (opt) {
case 'N':
N = (unsigned)atof(optarg);
break;
+ case 't':
+ t = (unsigned)atof(optarg);
+ break;
case 'T':
T = atof(optarg);
break;
@@ -232,7 +236,7 @@ int main(int argc, char* argv[]) {
std::cout << zz(0) << std::endl;
gradientDescent(J, z, ε, δ, γ);
- langevin(J, z, ε, T, 1000, γ, r);
+ langevin(J, z, ε, T, t, γ, r);
zz = z.pow(2).sum();
double a = norm(z);