chiark / gitweb /
do not print size every time(!)
authorIan Jackson <ian@davenant.relativity.greenend.org.uk>
Sun, 28 Sep 2008 23:14:20 +0000 (00:14 +0100)
committerIan Jackson <ian@davenant.relativity.greenend.org.uk>
Sun, 28 Sep 2008 23:14:20 +0000 (00:14 +0100)
minimise.c

index d07af5e..bf5b096 100644 (file)
@@ -69,7 +69,7 @@ int main(int argc, const char *const *argv) {
   double initial_half[DIM], step_size[DIM];
   FILE *initial_f;
   gsl_vector initial_gsl, step_size_gsl;
-  int r, i;
+  int r, i, size_check_counter= 0;
 
   if (argc==3) {
     input_file= argv[1];
@@ -126,15 +126,17 @@ int main(int argc, const char *const *argv) {
   for (;;) {
     GA( gsl_multimin_fminimizer_iterate(minimiser) );
 
-    size= gsl_multimin_fminimizer_size(minimiser);
-    r= gsl_multimin_test_size(size, stop_epsilon);
+    if (!(size_check_counter++ % DIM)) {
+      size= gsl_multimin_fminimizer_size(minimiser);
+      r= gsl_multimin_test_size(size, stop_epsilon);
 
-    if (printing_check(pr_size,215))
-      printf("r=%2d, size %# e\n", r, size);
-    flushoutput();
+      if (printing_check(pr_size,215))
+       printf("r=%2d, size %# e\n", r, size);
+      flushoutput();
 
-    if (r==GSL_SUCCESS) break;
-    assert(r==GSL_CONTINUE);
+      if (r==GSL_SUCCESS) break;
+      assert(r==GSL_CONTINUE);
+    }
   }
 
   if (final_file) {