chiark / gitweb /
Use trusty
[nlopt.git] / neldermead / sbplx.c
index efe68a43f1f653a428ee599f8a373574ce22de9c..f2ad6f373065cc0ec845e2aaad2274ebf771d979 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2010 Massachusetts Institute of Technology
+/* Copyright (c) 2007-2014 Massachusetts Institute of Technology
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
@@ -51,7 +51,7 @@ typedef struct {
 } subspace_data;
 
 /* wrapper around objective function for subspace optimization */
-static double subspace_func(int ns, const double *xs, double *grad, void *data)
+static double subspace_func(unsigned ns, const double *xs, double *grad, void *data)
 {
      subspace_data *d = (subspace_data *) data;
      int i, is = d->is;
@@ -59,7 +59,7 @@ static double subspace_func(int ns, const double *xs, double *grad, void *data)
      double *x = d->x;
 
      (void) grad; /* should always be NULL here */
-     for (i = is; i < is + ns; ++i) x[p[i]] = xs[i-is];
+     for (i = is; i < is + ((int) ns); ++i) x[p[i]] = xs[i-is];
      return d->f(d->n, x, NULL, d->f_data);
 }
 
@@ -79,7 +79,7 @@ nlopt_result sbplx_minimize(int n, nlopt_func f, void *f_data,
 
      *minf = f(n, x, NULL, f_data);
      stop->nevals++;
-     if (nlopt_stop_forced(stop)) return NLOPT_FORCE_STOP;
+     if (nlopt_stop_forced(stop)) return NLOPT_FORCED_STOP;
      if (*minf < stop->minf_max) return NLOPT_MINF_MAX_REACHED;
      if (nlopt_stop_evals(stop)) return NLOPT_MAXEVAL_REACHED;
      if (nlopt_stop_time(stop)) return NLOPT_MAXTIME_REACHED;