chiark / gitweb /
detect null preconditioner when maximizing
authorstevenj <stevenj@alum.mit.edu>
Wed, 23 Nov 2011 19:33:10 +0000 (14:33 -0500)
committerstevenj <stevenj@alum.mit.edu>
Wed, 23 Nov 2011 19:33:10 +0000 (14:33 -0500)
Ignore-this: 8e1efab266f1b1e84454498b3ba2e17c

darcs-hash:20111123193310-c8de0-64d7f604fb95fca7a8f7ae15d6d5805c57e5fe04.gz

api/optimize.c

index 75aa48750eee32acd5c31ceca58bffc85513797c..49fdaec6522d8cc71f4238cd91793a49cdcc11e1 100644 (file)
@@ -837,7 +837,8 @@ NLOPT_STDCALL nlopt_optimize(nlopt_opt opt, double *x, double *opt_f)
        flips the sign of everything */
      if ((maximize = opt->maximize)) {
          fmd.f = f; fmd.f_data = f_data; fmd.pre = pre;
-         opt->f = f_max; opt->f_data = &fmd; opt->pre = pre_max;
+         opt->f = f_max; opt->f_data = &fmd; 
+         if (opt->pre) opt->pre = pre_max;
          opt->stopval = -opt->stopval;
          opt->maximize = 0;
      }