Skip to content

Hessian preconditioner wrappers#410

Open
smartalecH wants to merge 1 commit into
stevengj:masterfrom
smartalecH:master
Open

Hessian preconditioner wrappers#410
smartalecH wants to merge 1 commit into
stevengj:masterfrom
smartalecH:master

Conversation

@smartalecH
Copy link
Copy Markdown

Closes #177

There's still an issue with the python wrappers. Seems to be passing the wrong number of arguments:

NotImplementedError: Wrong number or type of arguments for overloaded function 'opt_set_precond_min_objective'.
  Possible C/C++ prototypes are:
    nlopt::opt::set_precond_min_objective(nlopt::func,nlopt::pfunc,void *)
    nlopt::opt::set_precond_min_objective(nlopt::func,nlopt::pfunc,void *,nlopt_munge,nlopt_munge)

Any ideas what might be wrong?

Comment thread src/api/nlopt-in.hpp
d->o = this; d->f = f; d->f_data = f_data; d->mf = NULL; d->vf = NULL;
d->pf = pf;
d->munge_destroy = md; d->munge_copy = mc;
printf("ALEC\n");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this line is an artifact of some debugging?

Comment thread src/swig/nlopt-python.i
static void pfunc_python(unsigned n, const double *x, const double *v, double *vpre, void *f)
{
npy_intp sz = npy_intp(n), sz0 = 0, stride1 = sizeof(double);
PyObject *xpy = PyArray_New(&PyArray_Type, 1, &sz, NPY_DOUBLE, &stride1,
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like these calls are equivalent to calling PyArray_SimpleNewFromData?

Comment thread src/swig/nlopt-python.i
const_cast<double*>(v), // not NPY_WRITEABLE
0, NPY_ARRAY_C_CONTIGUOUS | NPY_ARRAY_ALIGNED, NULL);
PyObject *vprepy = vpre
? PyArray_SimpleNewFromData(1, &sz, NPY_DOUBLE, vpre)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't vpre always be non-NULL here?

@jschueller
Copy link
Copy Markdown
Collaborator

hello @smartalecH, any news on this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Preconditioners not wrapped in C++ ...

4 participants