From edc03beb6e7133d914b7914986fb35357dacda70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Thi=C3=A9baut?= Date: Fri, 5 Apr 2024 10:37:46 +0200 Subject: [PATCH] Move cobyla_c, bobyqa_c, etc. definitions in `prima.h` --- c/include/prima/prima.h | 24 ++++++++++++++++++++++++ c/prima.c | 26 -------------------------- 2 files changed, 24 insertions(+), 26 deletions(-) diff --git a/c/include/prima/prima.h b/c/include/prima/prima.h index 6a041816d8..75a56f116a 100644 --- a/c/include/prima/prima.h +++ b/c/include/prima/prima.h @@ -244,6 +244,30 @@ PRIMAC_API int prima_init_options(prima_options_t *const options); +// Functions implemented in Fortran (*_c.f90) +int cobyla_c(const int m_nlcon, const prima_objcon_t calcfc, const void *data, const int n, double x[], double *const f, double *const cstrv, double nlconstr[], + const int m_ineq, const double Aineq[], const double bineq[], + const int m_eq, const double Aeq[], const double beq[], + const double xl[], const double xu[], + const double f0, const double nlconstr0[], + int *const nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int iprint, const double ctol, + const prima_callback_t callback, int *const info); + +int bobyqa_c(prima_obj_t calfun, const void *data, const int n, double x[], double *const f, const double xl[], const double xu[], + int *const nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int npt, const int iprint, const prima_callback_t callback, int *const info); + +int newuoa_c(prima_obj_t calfun, const void *data, const int n, double x[], double *const f, + int *const nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int npt, const int iprint, const prima_callback_t callback, int *const info); + +int uobyqa_c(prima_obj_t calfun, const void *data, const int n, double x[], double *const f, + int *const nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int iprint, const prima_callback_t callback, int *const info); + +int lincoa_c(prima_obj_t calfun, const void *data, const int n, double x[], double *const f, + double *const cstrv, const int m_ineq, const double Aineq[], const double bineq[], + const int m_eq, const double Aeq[], const double beq[], const double xl[], const double xu[], + int *const nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int npt, const int iprint, const double ctol, + const prima_callback_t callback, int *const info); + // Structure to hold the result // prima_minimize will allocate the memory for x and nlconstr (if needed), // and as such the user is expected to free the memory using prima_free_result diff --git a/c/prima.c b/c/prima.c index ce16e276da..8a138a35ad 100644 --- a/c/prima.c +++ b/c/prima.c @@ -203,32 +203,6 @@ const char *prima_get_rc_string(const prima_rc_t rc) } } - -// Functions implemented in Fortran (*_c.f90) -int cobyla_c(const int m_nlcon, const prima_objcon_t calcfc, const void *data, const int n, double x[], double *const f, double *const cstrv, double nlconstr[], - const int m_ineq, const double Aineq[], const double bineq[], - const int m_eq, const double Aeq[], const double beq[], - const double xl[], const double xu[], - const double f0, const double nlconstr0[], - int *const nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int iprint, const double ctol, - const prima_callback_t callback, int *const info); - -int bobyqa_c(prima_obj_t calfun, const void *data, const int n, double x[], double *const f, const double xl[], const double xu[], - int *const nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int npt, const int iprint, const prima_callback_t callback, int *const info); - -int newuoa_c(prima_obj_t calfun, const void *data, const int n, double x[], double *const f, - int *const nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int npt, const int iprint, const prima_callback_t callback, int *const info); - -int uobyqa_c(prima_obj_t calfun, const void *data, const int n, double x[], double *const f, - int *const nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int iprint, const prima_callback_t callback, int *const info); - -int lincoa_c(prima_obj_t calfun, const void *data, const int n, double x[], double *const f, - double *const cstrv, const int m_ineq, const double Aineq[], const double bineq[], - const int m_eq, const double Aeq[], const double beq[], const double xl[], const double xu[], - int *const nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int npt, const int iprint, const double ctol, - const prima_callback_t callback, int *const info); - - // The function that does the minimization using a PRIMA solver int prima_minimize(const prima_algorithm_t algorithm, const prima_problem_t problem, const prima_options_t options, prima_result_t *const result) {