chiark
/
gitweb
/
~ianmdlvl
/
nlopt.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2495733
)
set_initial_step(opt, NULL) resets to default
author
stevenj
<stevenj@alum.mit.edu>
Mon, 14 Jun 2010 20:42:37 +0000
(16:42 -0400)
committer
stevenj
<stevenj@alum.mit.edu>
Mon, 14 Jun 2010 20:42:37 +0000
(16:42 -0400)
darcs-hash:
20100614204237
-c8de0-
cd7a3a4bdbbd4d67c592fd103779f3a97aa51fc8
.gz
api/options.c
patch
|
blob
|
history
diff --git
a/api/options.c
b/api/options.c
index 5b808106ee326f6106727a9ab3ad2dd0ca2be7d4..40e47917ff6dd586e043a144518622ec1ae555f4 100644
(file)
--- a/
api/options.c
+++ b/
api/options.c
@@
-486,7
+486,11
@@
nlopt_result nlopt_set_initial_step1(nlopt_opt opt, double dx)
nlopt_result nlopt_set_initial_step(nlopt_opt opt, const double *dx)
{
unsigned i;
- if (!opt || !dx) return NLOPT_INVALID_ARGS;
+ if (!opt) return NLOPT_INVALID_ARGS;
+ if (!dx) {
+ free(opt->dx); opt->dx = NULL;
+ return NLOPT_SUCCESS;
+ }
for (i = 0; i < opt->n; ++i) if (dx[i] == 0) return NLOPT_INVALID_ARGS;
if (!opt->dx && nlopt_set_initial_step1(opt, 1) == NLOPT_OUT_OF_MEMORY)
return NLOPT_OUT_OF_MEMORY;