Skip to content

Commit

Permalink
230916.014716.HKT declare npt as const in the C interface
Browse files Browse the repository at this point in the history
  • Loading branch information
zaikunzhang committed Sep 15, 2023
1 parent f38178a commit e190176
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions c/include/prima/prima.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
}
Expand Down
12 changes: 6 additions & 6 deletions c/prima.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ 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,
double *cstrv,
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],
Expand All @@ -34,15 +34,15 @@ 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);
return info;
}

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);
Expand All @@ -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);
Expand Down

0 comments on commit e190176

Please sign in to comment.