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:
61fe516
)
fix #26
author
Steven G. Johnson
<stevenj@alum.mit.edu>
Fri, 17 Apr 2015 02:47:43 +0000
(22:47 -0400)
committer
Steven G. Johnson
<stevenj@alum.mit.edu>
Fri, 17 Apr 2015 02:47:43 +0000
(22:47 -0400)
api/optimize.c
patch
|
blob
|
history
diff --git
a/api/optimize.c
b/api/optimize.c
index 2087d8f69480b8e008e32eba45e2c2b1c65cfb17..0d679dc0ba6c1dd3678ed48fb3b259cc3d2248aa 100644
(file)
--- a/
api/optimize.c
+++ b/
api/optimize.c
@@
-248,10
+248,15
@@
static void elimdim_expand(unsigned n, double *v,
/* given opt, create a new opt with equal-constraint dimensions eliminated */
static nlopt_opt elimdim_create(nlopt_opt opt)
{
/* given opt, create a new opt with equal-constraint dimensions eliminated */
static nlopt_opt elimdim_create(nlopt_opt opt)
{
- nlopt_opt opt0 = nlopt_copy(opt);
+ nlopt_opt opt0;
+ nlopt_munge munge_copy_save = opt->munge_on_copy;
double *x, *grad = NULL;
unsigned i;
double *x, *grad = NULL;
unsigned i;
+ opt->munge_on_copy = 0; /* hack: since this is an internal copy,
+ we can leave it un-munged; see issue #26 */
+ opt0 = nlopt_copy(opt);
+ opt->munge_on_copy = munge_copy_save;
if (!opt0) return NULL;
x = (double *) malloc(sizeof(double) * opt->n);
if (opt->n && !x) { nlopt_destroy(opt0); return NULL; }
if (!opt0) return NULL;
x = (double *) malloc(sizeof(double) * opt->n);
if (opt->n && !x) { nlopt_destroy(opt0); return NULL; }