Skip to content

Commit

Permalink
Use new C routines
Browse files Browse the repository at this point in the history
  • Loading branch information
amontoison committed Sep 30, 2024
1 parent 9bebaec commit c283774
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 15 deletions.
26 changes: 13 additions & 13 deletions include/cutest.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ typedef int ipc_;
#endif

typedef struct VarTypes {
int nbnds, neq, nlin, nrange, nlower, nupper,
nineq, nineq_lin, nineq_nlin, neq_lin,
neq_nlin;
int nbnds, neq, nlin, nrange, nlower, nupper,
nineq, nineq_lin, nineq_nlin, neq_lin,
neq_nlin;
} VarTypes;

/*
Expand Down Expand Up @@ -310,9 +310,9 @@ void CUTEST_usetup ( integer *status, const integer *funit,
void CUTEST_csetup ( integer *status, const integer *funit,
const integer *iout,
const integer *io_buffer, integer *n, integer *m,
doublereal *x, doublereal *bl, doublereal *bu,
doublereal *x, doublereal *bl, doublereal *bu,
doublereal *v, doublereal *cl, doublereal *cu,
logical *equatn, logical *linear, const integer *e_order,
logical *equatn, logical *linear, const integer *e_order,
const integer *l_order, const integer *v_order );

/* Unconstrained dimensioning and report routines */
Expand Down Expand Up @@ -500,7 +500,7 @@ void CUTEST_csgreh ( integer *status, const integer *n, const integer *m,
const logical *grlagf, integer *nnzj,
const integer *lcjac, doublereal *cjac,
integer *indvar, integer *indfun,
integer *ne, const integer *le, integer *iprnhi,
integer *ne, const integer *le, integer *iprnhi,
integer *iprhi, const integer *lirnhi,
integer *irnhi, const integer *lhi, doublereal *hi,
const logical *byrows );
Expand Down Expand Up @@ -565,9 +565,9 @@ void CUTEST_usetup_s ( integer *status, const integer *funit,
void CUTEST_csetup_s ( integer *status, const integer *funit,
const integer *iout,
const integer *io_buffer, integer *n, integer *m,
real *x, real *bl, real *bu,
real *x, real *bl, real *bu,
real *v, real *cl, real *cu,
logical *equatn, logical *linear, const integer *e_order,
logical *equatn, logical *linear, const integer *e_order,
const integer *l_order, const integer *v_order );

/* Unconstrained dimensioning and report routines */
Expand Down Expand Up @@ -701,7 +701,7 @@ void CUTEST_cdh_s ( integer *status, const integer *n, const integer *m,
void CUTEST_cdhc_s ( integer *status, const integer *n, const integer *m,
const real *x, const real *y,
const integer *lh1, real *h );
void CUTEST_cdhj_s ( integer *status, const integer *n, const integer *m,
void CUTEST_cdhj_s ( integer *status, const integer *n, const integer *m,
const real *x, const real *y0, const real *y,
const integer *lh1, real *h );
void CUTEST_cshp_s ( integer *status, const integer *n, integer *nnzh,
Expand Down Expand Up @@ -754,7 +754,7 @@ void CUTEST_csgreh_s ( integer *status, const integer *n, const integer *m,
const logical *grlagf, integer *nnzj,
const integer *lcjac, real *cjac,
integer *indvar, integer *indfun,
integer *ne, const integer *le, integer *iprnhi,
integer *ne, const integer *le, integer *iprnhi,
integer *iprhi, const integer *lirnhi,
integer *irnhi, const integer *lhi, real *hi,
const logical *byrows );
Expand Down Expand Up @@ -914,9 +914,9 @@ void CUTEST_usetup_q ( integer *status, const integer *funit,
void CUTEST_csetup_q ( integer *status, const integer *funit,
const integer *iout,
const integer *io_buffer, integer *n, integer *m,
quadreal *x, quadreal *bl, quadreal *bu,
quadreal *x, quadreal *bl, quadreal *bu,
quadreal *v, quadreal *cl, quadreal *cu,
logical *equatn, logical *linear, const integer *e_order,
logical *equatn, logical *linear, const integer *e_order,
const integer *l_order, const integer *v_order );

/* Unconstrained dimensioning and report routines */
Expand Down Expand Up @@ -1103,7 +1103,7 @@ void CUTEST_csgreh_q ( integer *status, const integer *n, const integer *m,
const logical *grlagf, integer *nnzj,
const integer *lcjac, quadreal *cjac,
integer *indvar, integer *indfun,
integer *ne, const integer *le, integer *iprnhi,
integer *ne, const integer *le, integer *iprnhi,
integer *iprhi, const integer *lirnhi,
integer *irnhi, const integer *lhi, quadreal *hi,
const logical *byrows );
Expand Down
18 changes: 16 additions & 2 deletions src/test/utest.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ int main() {
rpc_ *vector, *result;
rpc_ **H2_val, **H_band;
char *p_name;
char *classification;
char **X_names;
rpc_ CPU[4], CALLS[4];

Expand All @@ -61,7 +62,13 @@ int main() {
CUTEST_udimen_r(&status, &input, &n);
printf("* n = %d\n", n);
l_h2_1 = n;


MALLOC(classification, FCSTRING_LEN + 1, char);
MALLOC(p_name, FSTRING_LEN + 1, char);
MALLOC(X_names, n, char *);
for (i = 0; i < n; i++)
MALLOC(X_names[i], FSTRING_LEN + 1, char);

X = malloc(n * sizeof(rpc_));
X_l = malloc(n * sizeof(rpc_));
X_u = malloc(n * sizeof(rpc_));
Expand Down Expand Up @@ -96,7 +103,14 @@ int main() {
printf("error status = %d\n", status);
}
write_x(n, X, X_l, X_u);


// Obtain classification
printf("Call CUTEST_classification\n");
CUTEST_classification_r(&status, &input, classification);
if (status != 0) {
printf("error status = %d\n", status);
}

// Obtain variable and problem names
printf("Call CUTEST_unames\n");
CUTEST_unames_r(&status, &n, p_name, X_names);
Expand Down

0 comments on commit c283774

Please sign in to comment.