chiark / gitweb /
Revert "simplex wip: compiles"
[moebius3.git] / findcurve.c
index 275b501b92bfc4a15e80521345759110d8d2d2bf..055018f3bfb6abf87e5dba0aabbcf8dcb59dc906 100644 (file)
@@ -46,6 +46,7 @@ static void prepare(double X[] /* startpoint */) {
 
 static double cb_Efunc(void *xp) {
   const double *X = xp;
+  int P;
   DECLARE_F_G;
   CALCULATE_F_G;
 
@@ -53,27 +54,15 @@ static double cb_Efunc(void *xp) {
   int i,j;
   printf(" Efunc\n");
   for (j=0; j<3; j++) {
-    for (i=0; i<NP; i++)
-      printf(" %7.4f", POINT(i)[j]);
+    for (P=0; P<NP; P++)
+      printf(" %7.4f", POINT(P)[j]);
     printf("\n");
   }
   printf("             ");
 #endif
 
-  double e = 0;
-  int P;
-  for (P=0; P<NP-3; P++) {
-    double P_cost;
-    CALCULATE_COST;
-#ifdef DEBUG
-    printf(" %7.4f", P_cost);
-#endif
-    e += P_cost;
-  }
-#ifdef DEBUG
-  printf("\n");
-#endif
-  return e;
+  CALCULATE_COST;
+  return cost;
 }
 
 static void cb_step(const gsl_rng *rng, void *xp, double step_size) {