+* Workaround for gcc 3.4.x conflict with HUGE_VAL definition in Solaris
+ (gcc bug 19933).
+
+* Better identification of Matlab-plugin installation directory.
+
NLopt 1.0.1 (13 Nov. 2008)
* Allow user to override Matlab-plugin installation directory with
#include <stdlib.h>
#include "nlopt.h"
-#include "config.h"
+#include "nlopt-util.h"
/*-----------------------------------------------------------------------*/
/* wrappers around f77 procedures */
#include "nlopt.h"
#include "nlopt-util.h"
-#include "config.h"
#define MIN(a,b) ((a) < (b) ? (a) : (b))
/*************************************************************************/
-#ifdef INFINITY
-# define MY_INF INFINITY
-#else
-# define MY_INF HUGE_VAL
-#endif
-
int nlopt_isinf(double x) {
return fabs(x) >= HUGE_VAL * 0.99
#ifdef HAVE_ISINF
discontinuous objectives so we can just return Inf for invalid x */
for (i = 0; i < n; ++i)
if (x[i] < data->lb[i] || x[i] > data->ub[i])
- return MY_INF;
+ return HUGE_VAL;
f = data->f(n, x, NULL, data->f_data);
- return (isnan(f) || nlopt_isinf(f) ? MY_INF : f);
+ return (isnan(f) || nlopt_isinf(f) ? HUGE_VAL : f);
}
static double f_noderiv(int n, const double *x, void *data_)
stop.n = n;
stop.minf_max = (isnan(minf_max)
|| (nlopt_isinf(minf_max) && minf_max < 0))
- ? -MY_INF : minf_max;
+ ? -HUGE_VAL : minf_max;
stop.ftol_rel = ftol_rel;
stop.ftol_abs = ftol_abs;
stop.xtol_rel = xtol_rel;
#include "nlopt.h"
#include "cdirect.h"
#include "redblack.h"
-#include "config.h"
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#include "nlopt.h"
#include "cdirect.h"
#include "redblack.h"
-#include "config.h"
/* Hybrid algorithm, inspired by DIRECT, that uses another local
* optimization algorithm within each rectangle, and then looks
dnl Process this file with autoconf to produce a configure script.
-AC_INIT(nlopt, 1.0.1, stevenj@alum.mit.edu)
+AC_INIT(nlopt, 1.0.2, stevenj@alum.mit.edu)
AC_CONFIG_SRCDIR(api/nlopt.h)
-SHARED_VERSION_INFO="0:1:0" # CURRENT:REVISION:AGE
+SHARED_VERSION_INFO="0:2:0" # CURRENT:REVISION:AGE
AM_INIT_AUTOMAKE(1.7)
AM_CONFIG_HEADER(config.h)
AC_SUBST(MEX)
AC_SUBST(MEXSUFF)
+dnl -----------------------------------------------------------------------
+dnl Check for broken Solaris HUGE_VAL macro under gcc 3.4.x and similar
+
+AC_MSG_CHECKING([for working HUGE_VAL])
+AC_TRY_COMPILE([#include <math.h>], [double x = -HUGE_VAL;],
+[AC_MSG_RESULT([ok])],
+[AC_TRY_COMPILE([#include <math.h>
+#ifdef __GNUC__
+#undef HUGE_VAL
+#define HUGE_VAL __builtin_huge_val()
+#endif], [double x = -HUGE_VAL;],
+[AC_MSG_RESULT([__builtin_huge_val()])
+AC_DEFINE(REPLACEMENT_HUGE_VAL,[__builtin_huge_val()],
+ [replacement for broken HUGE_VAL macro, if needed])],
+[AC_MSG_RESULT([unknown])
+AC_MSG_ERROR([broken HUGE_VAL macro with this compiler, unknown workaround])])])
+
dnl -----------------------------------------------------------------------
dnl Debugging
+AM_CPPFLAGS = -I$(top_srcdir)/util -I$(top_srcdir)/api
+
noinst_LTLIBRARIES = libdirect.la
libdirect_la_SOURCES = DIRect.c direct_wrap.c DIRserial.c DIRsubrout.c \
direct-internal.h direct.h
#include <math.h>
#include "direct.h"
+#include "nlopt-util.h"
#ifdef __cplusplus
extern "C"
#include <stdio.h>
#include "mma.h"
-#include "config.h"
+#include "nlopt-util.h"
int mma_verbose = 0; /* > 0 for verbose output */
-AM_CPPFLAGS = -I$(top_srcdir)/api
+AM_CPPFLAGS = -I$(top_srcdir)/api -I$(top_srcdir)/util
MFILES = NLOPT_GN_DIRECT.m NLOPT_GN_DIRECT_L.m NLOPT_GN_DIRECT_L_RAND.m NLOPT_GN_DIRECT_NOSCAL.m NLOPT_GN_DIRECT_L_NOSCAL.m NLOPT_GN_DIRECT_L_RAND_NOSCAL.m NLOPT_GN_ORIG_DIRECT.m NLOPT_GN_ORIG_DIRECT_L.m NLOPT_GD_STOGO.m NLOPT_GD_STOGO_RAND.m NLOPT_LD_LBFGS_NOCEDAL.m NLOPT_LD_LBFGS.m NLOPT_LN_PRAXIS.m NLOPT_LD_VAR1.m NLOPT_LD_VAR2.m NLOPT_LD_TNEWTON.m NLOPT_LD_TNEWTON_RESTART.m NLOPT_LD_TNEWTON_PRECOND.m NLOPT_LD_TNEWTON_PRECOND_RESTART.m NLOPT_GN_CRS2_LM.m NLOPT_GN_MLSL.m NLOPT_GD_MLSL.m NLOPT_GN_MLSL_LDS.m NLOPT_GD_MLSL_LDS.m NLOPT_LD_MMA.m NLOPT_LN_COBYLA.m NLOPT_LN_NEWUOA.m NLOPT_LN_NEWUOA_BOUND.m NLOPT_LN_NELDERMEAD.m NLOPT_LN_SBPLX.m
+#######################################################################
+# dummy C program to fool automake into making sure that CPPFLAGS etc.
+# are all defined
+noinst_PROGRAMS = dummy
+dummy_SOURCES = dummy.c
+
#######################################################################
octdir = $(OCT_INSTALL_DIR)
mdir = $(M_INSTALL_DIR)
--- /dev/null
+#include <stdio.h>
+int main(void) { printf("Hello world.\n"); return 0; }
#include <mex.h>
#include "nlopt.h"
+#include "nlopt-util.h"
#define xSTRIZE(x) #x
#define STRIZE(x) xSTRIZE(x)
*/
#include "nlopt-util.h"
-#include "config.h"
#if defined(HAVE_STDINT_H)
# include <stdint.h>
#define NLOPT_UTIL_H
#include <stdlib.h>
+#include <math.h>
+#include "config.h"
+
+/* workaround for Solaris + gcc 3.4.x bug (see configure.ac) */
+#if defined(__GNUC__) && defined(REPLACEMENT_HUGE_VAL)
+# undef HUGE_VAL
+# define HUGE_VAL REPLACEMENT_HUGE_VAL
+#endif
#ifdef __cplusplus
extern "C"
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include <nlopt-util.h>
-#include "config.h"
+#include "nlopt-util.h"
/* Simple replacement for the BSD qsort_r function (re-entrant sorting),
if it is not available. (It looks like glibc 2.8 will include qsort_r
#include <time.h>
#include "redblack.h"
+#include "config.h"
+/* workaround for Solaris + gcc 3.4.x bug (see configure.ac) */
+#if defined(__GNUC__) && defined(REPLACEMENT_HUGE_VAL)
+# undef HUGE_VAL
+# define HUGE_VAL REPLACEMENT_HUGE_VAL
+#endif
+
static int comp(rb_key k1, rb_key k2)
{
if (*k1 < *k2) return -1;
a free/open-source implementation. */
#include <stdlib.h>
+#include <math.h>
#include "nlopt-util.h"
-#include "config.h"
-
#if defined(HAVE_STDINT_H)
# include <stdint.h>
#endif
/* compile with -DSOBOLSEQ_TEST for test program */
#ifdef SOBOLSEQ_TEST
#include <stdio.h>
-#include <math.h>
#include <time.h>
/* test integrand from Joe and Kuo paper ... integrates to 1 */
*/
#include "nlopt-util.h"
-#include "config.h"
#if TIME_WITH_SYS_TIME
# include <sys/time.h>