chiark / gitweb /
helixish: attempt at the whole thing
[moebius3.git] / findcurve.c
index 2045761c0a5a9876795e38dbfc474bbd9d68afb6..c038182e685ca954002d0e0473338077c01f5af4 100644 (file)
@@ -34,6 +34,9 @@ static double cb_Efunc(void *xp) {
     double d = F[i] - target[i];
     e += d*d;
   }
+  //printf("\n cb_Efunc %p %10.7f [", xp, e);
+  //for (i=0; i<N; i++) printf(" %10.7f,", x[i]);
+  //printf("]\n");
   return e;
 }
 
@@ -44,6 +47,9 @@ static void cb_step(const gsl_rng *rng, void *xp, double step_size) {
   gsl_ran_dir_nd(rng, N,step);
   for (i=0; i<N; i++)
     x[i] += step_size * step[i];
+  //printf("\n cb_step %p %10.7f [", xp, step_size);
+  //for (i=0; i<N; i++) printf(" %10.7f,", step[i]);
+  //printf("]\n");
 }
 
 static double cb_metric(void *xp, void *yp) {
@@ -57,18 +63,23 @@ static double cb_metric(void *xp, void *yp) {
   return sqrt(s);
 }
 
-static void cb_print(void *xp) {
-  const double *x = xp;
-  double F[N];
+static void printcore(const double *x) {
   int i;
+  double F[N];
   X_EXTRACT;
   F_POPULATE;
-  printf("\n[");
+  printf("[");
   for (i=0; i<6; i++) printf(" %.18g,", x[i]);
   for (i=0; i<6; i++) printf(" %.18g,", F[i]);
   printf(" ]\n");
 }
 
+static void __attribute__((unused)) cb_print(void *xp) {
+  const double *x = xp;
+  printf("\n");
+  printcore(x);
+}
+
 static double scan1double(void) {
   double v;
   int r;
@@ -103,15 +114,18 @@ int main(void) {
       .t_initial = 0.5,
       .mu_t = 1.001,
       .t_min = epsilon * 1E-3,
+      .iters_fixed_T = 100,
+      .n_tries = 10,
+      .step_size = 0.05,
     };
 
     gsl_siman_solve(rng,
                    startpoint,
                    cb_Efunc, cb_step, cb_metric,
-                   0, // cb_print,
+                   0, //cb_print,
                    0,0,0, sizeof(startpoint), siman_params);
 
-    cb_print(startpoint);
+    printcore(startpoint);
 
     printf("[]\n");
     fflush(stdout);