From e190176ce2404e3b32b007d18682a7d9576ec00e Mon Sep 17 00:00:00 2001 From: zaikunzhang Date: Sat, 16 Sep 2023 01:47:16 +0800 Subject: [PATCH] 230916.014716.HKT declare `npt` as `const` in the C interface --- c/include/prima/prima.h | 6 +++--- c/prima.c | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/c/include/prima/prima.h b/c/include/prima/prima.h index b83742d7fd..853a9454a3 100644 --- a/c/include/prima/prima.h +++ b/c/include/prima/prima.h @@ -104,11 +104,11 @@ typedef void (*prima_objcon)(const double x[], double *f, double constr[]); PRIMAC_API int prima_bobyqa(const prima_obj calfun, const int n, double x[n], double *f, const double xl[n], const double xu[n], - int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, int npt, const int iprint); + int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int npt, const int iprint); PRIMAC_API int prima_newuoa(const prima_obj calfun, const int n, double x[n], double *f, - int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, int npt, const int iprint); + int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int npt, const int iprint); PRIMAC_API int prima_uobyqa(const prima_obj calfun, const int n, double x[n], double *f, @@ -128,7 +128,7 @@ int prima_lincoa(const prima_obj calfun, const int n, double x[n], double *f, const int m_ineq, const double Aineq[m_ineq*n], const double bineq[m_ineq], const int m_eq, const double Aeq[m_eq*n], const double beq[m_eq], const double xl[n], const double xu[n], - int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, int npt, const int iprint); + int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int npt, const int iprint); #ifdef __cplusplus } diff --git a/c/prima.c b/c/prima.c index 150c967408..b0f25d0a56 100644 --- a/c/prima.c +++ b/c/prima.c @@ -9,9 +9,9 @@ int cobyla_c(const int m_nlcon, const prima_objcon calcfc, const int n, double x const double xl[n], const double xu[n], int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int iprint, int *info); int bobyqa_c(prima_obj calfun, const int n, double x[n], double *f, const double xl[n], const double xu[n], - int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, int npt, const int iprint, int *info); + int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int npt, const int iprint, int *info); int newuoa_c(prima_obj calfun, const int n, double x[n], double *f, - int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, int npt, const int iprint, int *info); + int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int npt, const int iprint, int *info); int uobyqa_c(prima_obj calfun, const int n, double x[n], double *f, int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int iprint, int *info); int lincoa_c(prima_obj calfun, const int n, double x[n], double *f, @@ -19,7 +19,7 @@ int lincoa_c(prima_obj calfun, const int n, double x[n], double *f, const int m_ineq, const double Aineq[m_ineq*n], const double bineq[m_ineq], const int m_eq, const double Aeq[m_eq*n], const double beq[m_eq], const double xl[n], const double xu[n], - int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, int npt, const int iprint, int *info); + int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int npt, const int iprint, int *info); /* these functions just call the fortran compatibility layer and return the status code */ int prima_cobyla(const int m_nlcon, const prima_objcon calcfc, const int n, double x[n], double *f, double *cstrv, double nlconstr[m_nlcon], @@ -34,7 +34,7 @@ int prima_cobyla(const int m_nlcon, const prima_objcon calcfc, const int n, doub } int prima_bobyqa(const prima_obj calfun, const int n, double x[n], double *f, const double xl[n], const double xu[n], - int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, int npt, const int iprint) + int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int npt, const int iprint) { int info = 0; bobyqa_c(calfun, n, x, f, xl, xu, nf, rhobeg, rhoend, ftarget, maxfun, npt, iprint, &info); @@ -42,7 +42,7 @@ int prima_bobyqa(const prima_obj calfun, const int n, double x[n], double *f, co } int prima_newuoa(const prima_obj calfun, const int n, double x[n], double *f, - int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, int npt, const int iprint) + int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int npt, const int iprint) { int info = 0; newuoa_c(calfun, n, x, f, nf, rhobeg, rhoend, ftarget, maxfun, npt, iprint, &info); @@ -61,7 +61,7 @@ int prima_lincoa(const prima_obj calfun, const int n, double x[n], double *f, do const int m_ineq, const double Aineq[m_ineq*n], const double bineq[m_ineq], const int m_eq, const double Aeq[m_eq*n], const double beq[m_eq], const double xl[n], const double xu[n], - int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, int npt, const int iprint) + int *nf, const double rhobeg, const double rhoend, const double ftarget, const int maxfun, const int npt, const int iprint) { int info = 0; lincoa_c(calfun, n, x, f, cstrv, m_ineq, Aineq, bineq, m_eq, Aeq, beq, xl, xu, nf, rhobeg, rhoend, ftarget, maxfun, npt, iprint, &info);