chiark / gitweb /
Use trusty
[nlopt.git] / api / deprecated.c
index 50b69a33220e98fe09ef38c72586dcd133bd1e9d..e6e4b4097ebbf1933f58c78f0f2c007ed3d922c7 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
@@ -28,8 +28,8 @@ nlopt_algorithm nlopt_local_search_alg_deriv = NLOPT_LD_MMA;
 nlopt_algorithm nlopt_local_search_alg_nonderiv = NLOPT_LN_COBYLA;
 int nlopt_local_search_maxeval = -1; /* no maximum by default */
 
-NLOPT_STDCALL
-void nlopt_get_local_search_algorithm(nlopt_algorithm *deriv,
+void
+NLOPT_STDCALL nlopt_get_local_search_algorithm(nlopt_algorithm *deriv,
                                      nlopt_algorithm *nonderiv,
                                      int *maxeval)
 {
@@ -38,8 +38,8 @@ void nlopt_get_local_search_algorithm(nlopt_algorithm *deriv,
      *maxeval = nlopt_local_search_maxeval;
 }
 
-NLOPT_STDCALL
-void nlopt_set_local_search_algorithm(nlopt_algorithm deriv,
+void
+NLOPT_STDCALL nlopt_set_local_search_algorithm(nlopt_algorithm deriv,
                                      nlopt_algorithm nonderiv,
                                      int maxeval)
 {
@@ -52,17 +52,17 @@ void nlopt_set_local_search_algorithm(nlopt_algorithm deriv,
 
 int nlopt_stochastic_population = 0;
 
-NLOPT_STDCALL
-int nlopt_get_stochastic_population(void) { 
+int
+NLOPT_STDCALL nlopt_get_stochastic_population(void) { 
      return nlopt_stochastic_population; }
-NLOPT_STDCALL
-void nlopt_set_stochastic_population(int pop) { 
+void
+NLOPT_STDCALL nlopt_set_stochastic_population(int pop) { 
      nlopt_stochastic_population = pop <= 0 ? 0 : (unsigned) pop; }
 
 /*************************************************************************/
 
-NLOPT_STDCALL
-nlopt_result nlopt_minimize_econstrained(
+nlopt_result
+NLOPT_STDCALL nlopt_minimize_econstrained(
      nlopt_algorithm algorithm,
      int n, nlopt_func_old f, void *f_data,
      int m, nlopt_func_old fc, void *fc_data_, ptrdiff_t fc_datum_size,
@@ -119,7 +119,7 @@ nlopt_result nlopt_minimize_econstrained(
 
      ret = nlopt_set_xtol_rel(opt, xtol_rel);
      if (ret != NLOPT_SUCCESS) { nlopt_destroy(opt); return ret; }
-     ret = nlopt_set_xtol_abs(opt, xtol_abs);
+     if (xtol_abs) ret = nlopt_set_xtol_abs(opt, xtol_abs);
      if (ret != NLOPT_SUCCESS) { nlopt_destroy(opt); return ret; }
      
      ret = nlopt_set_maxeval(opt, maxeval);
@@ -134,8 +134,8 @@ nlopt_result nlopt_minimize_econstrained(
      return ret;
 }
 
-NLOPT_STDCALL
-nlopt_result nlopt_minimize_constrained(
+nlopt_result
+NLOPT_STDCALL nlopt_minimize_constrained(
      nlopt_algorithm algorithm,
      int n, nlopt_func_old f, void *f_data,
      int m, nlopt_func_old fc, void *fc_data, ptrdiff_t fc_datum_size,
@@ -153,8 +153,8 @@ nlopt_result nlopt_minimize_constrained(
          xtol_rel, xtol_abs, ftol_rel, ftol_abs, maxeval, maxtime);
 }
 
-NLOPT_STDCALL
-nlopt_result nlopt_minimize(
+nlopt_result
+NLOPT_STDCALL nlopt_minimize(
      nlopt_algorithm algorithm,
      int n, nlopt_func_old f, void *f_data,
      const double *lb, const double *ub, /* bounds */