chiark / gitweb /
fixed comment, added some basic argument checks
authorstevenj <stevenj@alum.mit.edu>
Wed, 29 Aug 2007 05:43:23 +0000 (01:43 -0400)
committerstevenj <stevenj@alum.mit.edu>
Wed, 29 Aug 2007 05:43:23 +0000 (01:43 -0400)
darcs-hash:20070829054323-c8de0-df6dfb55434e77aa9fb87aa0cdb7f14a516379e5.gz

api/nlopt.c
cdirect/cdirect.c

index f29e4ca87574965d4f80a40719dba923bcb97de2..e13980e4d3d8f08c5233a0b13c29c2103ed30c96 100644 (file)
@@ -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;
index f910de1f6eaf44c6780a7dfcb8b5546fa505b7fe..2684cc72c40d80dc7b3a08eda46874ea62d21518 100644 (file)
  * 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
  */