chiark / gitweb /
curveopt: wip
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 7 Apr 2018 22:11:02 +0000 (23:11 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 7 Apr 2018 22:11:02 +0000 (23:11 +0100)
findcurve.c

index 58f74720868a245ddbb811b7e176f1571a93c7c8..a8dfc469f331d52339a6171b8c054cc95697cff4 100644 (file)
@@ -26,6 +26,17 @@ static int NP;
 static double *INPUT; /* dyanmic array, on main's stack */
 static double PREP[NPREP];
 
+static void printcore(const double *X) {
+  int i, j;
+  DECLARE_F_G;
+  CALCULATE_F_G;
+  printf("[");
+  for (i=0; i<NP; i++)
+    for (j=0; j<3; j++)
+      printf(" %25.18g,", POINT(i)[j]);
+  printf(" ]\n");
+}
+
 static void prepare(double X[] /* startpoint */) {
   /* fills in PREP and startpoint */
   PREPARE;
@@ -36,13 +47,18 @@ static double cb_Efunc(void *xp) {
   DECLARE_F_G;
   CALCULATE_F_G;
 
+  printf(" Efunc ");
+  printcore(X);
+
   double e = 0;
   int P;
   for (P=0; P<NP-3; P++) {
     double P_cost;
     CALCULATE_COST;
+    printf(" %.18g", P_cost);
     e += P_cost;
   }
+  printf("\n");
   return e;
 }
 
@@ -69,17 +85,6 @@ static double cb_metric(void *xp, void *yp) {
   return sqrt(s);
 }
 
-static void printcore(const double *X) {
-  int i, j;
-  DECLARE_F_G;
-  CALCULATE_F_G;
-  printf("[");
-  for (i=0; i<NP; i++)
-    for (j=0; j<3; j++)
-      printf(" %.18g,", POINT(i)[i]);
-  printf(" ]\n");
-}
-
 static void __attribute__((unused)) cb_print(void *xp) {
   const double *x = xp;
   printf("\n");