From 09af4e58d62c088bf2daaa9dba54768b6c4ca773 Mon Sep 17 00:00:00 2001 From: stevenj Date: Wed, 29 Aug 2007 01:43:23 -0400 Subject: [PATCH] fixed comment, added some basic argument checks darcs-hash:20070829054323-c8de0-df6dfb55434e77aa9fb87aa0cdb7f14a516379e5.gz --- api/nlopt.c | 4 ++++ cdirect/cdirect.c | 7 ++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/api/nlopt.c b/api/nlopt.c index f29e4ca..e13980e 100644 --- a/api/nlopt.c +++ b/api/nlopt.c @@ -194,6 +194,10 @@ static nlopt_result nlopt_minimize_( nlopt_data d; nlopt_stopping stop; + /* some basic argument checks */ + if (n <= 0 || !f || !lb || !ub || !x || !fmin) + return NLOPT_INVALID_ARGS; + d.f = f; d.f_data = f_data; d.lb = lb; diff --git a/cdirect/cdirect.c b/cdirect/cdirect.c index f910de1..2684cc7 100644 --- a/cdirect/cdirect.c +++ b/cdirect/cdirect.c @@ -19,9 +19,10 @@ * measure (d) of the rectangle, [2..n+1] are the coordinates of the * center (c), and [n+2..2n+1] are the widths of the sides (w). * - * a list of rectangles is just an array of N hyper-rectangles - * stored as an N x L in row-major order. Generally, - * we allocate more than we need, allocating Na hyper-rectangles. + * we store the hyper-rectangles in a red-black tree, sorted by (d,f) + * in lexographic order, to allow us to perform quick convex-hull + * calculations (in the future, we might make this data structure + * more sophisticated based on the dynamic convex-hull literature). * * n > 0 always */ -- GitLab