Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exposing nlopt functions for weighted tolerance (nlopt_set_x_weight and cie) #124

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions inst/include/nloptrAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,27 @@ inline NLOPT_EXTERN(nlopt_result) nlopt_get_xtol_abs(const nlopt_opt opt, double
return fun(opt, tol);
}

inline NLOPT_EXTERN(nlopt_result) nlopt_set_x_weights1(nlopt_opt opt, double tol)
{
static nlopt_result(*fun)(nlopt_opt, double) = NULL;
if (fun == NULL) fun = (nlopt_result(*)(nlopt_opt, double)) R_GetCCallable("nloptr","nlopt_set_x_weights1");
return fun(opt, tol);
}

inline NLOPT_EXTERN(nlopt_result) nlopt_set_x_weights(nlopt_opt opt, const double *tol)
{
static nlopt_result(*fun)(nlopt_opt, const double *) = NULL;
if (fun == NULL) fun = (nlopt_result(*)(nlopt_opt, const double *)) R_GetCCallable("nloptr","nlopt_set_x_weights");
return fun(opt, tol);
}

inline NLOPT_EXTERN(nlopt_result) nlopt_get_x_weights(const nlopt_opt opt, double *tol)
{
static nlopt_result(*fun)(nlopt_opt, double *) = NULL;
if (fun == NULL) fun = (nlopt_result(*)(nlopt_opt, double *)) R_GetCCallable("nloptr","nlopt_get_x_weights");
return fun(opt, tol);
}

inline NLOPT_EXTERN(nlopt_result) nlopt_set_maxeval(nlopt_opt opt, int maxeval)
{
static nlopt_result(*fun)(nlopt_opt, int) = NULL;
Expand Down
3 changes: 3 additions & 0 deletions src/init_nloptr.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ void R_init_nloptr(DllInfo *info) {
R_RegisterCCallable("nloptr", "nlopt_set_xtol_abs1", (DL_FUNC) &nlopt_set_xtol_abs1);
R_RegisterCCallable("nloptr", "nlopt_set_xtol_abs", (DL_FUNC) &nlopt_set_xtol_abs);
R_RegisterCCallable("nloptr", "nlopt_get_xtol_abs", (DL_FUNC) &nlopt_get_xtol_abs);
R_RegisterCCallable("nloptr", "nlopt_set_x_weights1", (DL_FUNC) &nlopt_set_x_weights1);
R_RegisterCCallable("nloptr", "nlopt_set_x_weights", (DL_FUNC) &nlopt_set_x_weights);
R_RegisterCCallable("nloptr", "nlopt_get_x_weights", (DL_FUNC) &nlopt_get_x_weights);
R_RegisterCCallable("nloptr", "nlopt_set_maxeval", (DL_FUNC) &nlopt_set_maxeval);
R_RegisterCCallable("nloptr", "nlopt_get_maxeval", (DL_FUNC) &nlopt_get_maxeval);
R_RegisterCCallable("nloptr", "nlopt_set_maxtime", (DL_FUNC) &nlopt_set_maxtime);
Expand Down