chiark / gitweb /
Use trusty
[nlopt.git] / api / general.c
index e892bd997d8ae6f545099451bd64b619ea14bb51..672163d4e6899e897c49233fa5b9085e0111ec80 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
  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
  */
 
-#include <math.h>
-#include <float.h>
-
 #include "nlopt-internal.h"
 
 /*************************************************************************/
 
-int nlopt_isinf(double x) {
-     return fabs(x) >= HUGE_VAL * 0.99
-#ifdef HAVE_ISINF
-         || isinf(x)
-#endif
-         ;
-}
-/*************************************************************************/
-
-void nlopt_version(int *major, int *minor, int *bugfix)
+void NLOPT_STDCALL nlopt_version(int *major, int *minor, int *bugfix)
 {
      *major = MAJOR_VERSION;
      *minor = MINOR_VERSION;
@@ -61,11 +49,7 @@ static const char nlopt_algorithm_names[NLOPT_NUM_ALGORITHMS][256] = {
      "StoGO (NOT COMPILED)",
      "StoGO randomized (NOT COMPILED)",
 #endif
-#ifdef WITH_NOCEDAL_LBFGS
-     "original NON-FREE L-BFGS code by Nocedal et al. (local, deriv.-based)",
-#else
-     "original NON-FREE L-BFGS code by Nocedal et al. (NOT COMPILED)",
-#endif
+     "original L-BFGS code by Nocedal et al. (NOT COMPILED)",
      "Limited-memory BFGS (L-BFGS) (local, derivative-based)",
      "Principal-axis, praxis (local, no-derivative)",
      "Limited-memory variable-metric, rank 1 (local, derivative-based)",
@@ -95,9 +79,12 @@ static const char nlopt_algorithm_names[NLOPT_NUM_ALGORITHMS][256] = {
      "Augmented Lagrangian method for equality constraints (needs sub-algorithm)",
      "Multi-level single-linkage (MLSL), random (global, needs sub-algorithm)",
      "Multi-level single-linkage (MLSL), quasi-random (global, needs sub-algorithm)",
+     "Sequential Quadratic Programming (SQP) (local, derivative)",
+     "CCSA (Conservative Convex Separable Approximations) with simple quadratic approximations (local, derivative)",
+     "ESCH evolutionary strategy"
 };
 
-const char *nlopt_algorithm_name(nlopt_algorithm a)
+const char * NLOPT_STDCALL nlopt_algorithm_name(nlopt_algorithm a)
 {
      if (((int) a) < 0 || a >= NLOPT_NUM_ALGORITHMS) return "UNKNOWN";
      return nlopt_algorithm_names[a];
@@ -126,13 +113,13 @@ const char *nlopt_algorithm_name(nlopt_algorithm a)
 /*************************************************************************/
 
 static THREADLOCAL int nlopt_srand_called = 0;
-void nlopt_srand(unsigned long seed) {
+void NLOPT_STDCALL nlopt_srand(unsigned long seed) {
      nlopt_srand_called = 1;
      nlopt_init_genrand(seed);
 }
 
-void nlopt_srand_time(void) {
-     nlopt_srand(nlopt_time_seed() + my_gettid() * 314159);
+void NLOPT_STDCALL nlopt_srand_time(void) {
+     nlopt_srand(nlopt_time_seed() + (unsigned long)my_gettid() * 314159);
 }
 
 void nlopt_srand_time_default(void) {