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

Draft: Make the 'lagrange' parameter of 'vec_jac' const #91

Open
wants to merge 6 commits 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
6 changes: 3 additions & 3 deletions ADOL-C/include/adolc/drivers/drivers.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ ADOLC_DLL_EXPORT fint large_jacobian_(fint *, fint *, fint *, fint *, fdouble *,
/*--------------------------------------------------------------------------*/
/* vector_jacobian */
/* vec_jac(tag, m, n, repeat, x[n], u[m], v[n]) */
ADOLC_DLL_EXPORT int vec_jac(short, int, int, int, const double *, double *,
double *);
ADOLC_DLL_EXPORT int vec_jac(short, int, int, int, const double *,
const double *, double *);
ADOLC_DLL_EXPORT fint vec_jac_(fint *, fint *, fint *, fint *, fdouble *,
fdouble *, fdouble *);
const fdouble *, fdouble *);

/*--------------------------------------------------------------------------*/
/* jacobian_vector */
Expand Down
14 changes: 8 additions & 6 deletions ADOL-C/include/adolc/fortutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@
/* Now the C THINGS */
BEGIN_C_DECLS

ADOLC_DLL_EXPORT void spread1(int m, fdouble *x, double *X);
ADOLC_DLL_EXPORT void pack1(int m, double *X, fdouble *x);
ADOLC_DLL_EXPORT void spread1(int m, const fdouble *x, double *X);
ADOLC_DLL_EXPORT void pack1(int m, const double *X, fdouble *x);

ADOLC_DLL_EXPORT void spread2(int m, int n, fdouble *x, double **X);
ADOLC_DLL_EXPORT void pack2(int m, int n, double **X, fdouble *x);
ADOLC_DLL_EXPORT void spread2(int m, int n, const fdouble *x, double **X);
ADOLC_DLL_EXPORT void pack2(int m, int n, const double *const *X, fdouble *x);

ADOLC_DLL_EXPORT void spread3(int m, int n, int p, fdouble *x, double ***X);
ADOLC_DLL_EXPORT void pack3(int m, int n, int p, double ***X, fdouble *x);
ADOLC_DLL_EXPORT void spread3(int m, int n, int p, const fdouble *x,
double ***X);
ADOLC_DLL_EXPORT void pack3(int m, int n, int p, const double *const *const *X,
fdouble *x);

END_C_DECLS

Expand Down
186 changes: 104 additions & 82 deletions ADOL-C/include/adolc/interfaces.h

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ADOL-C/src/drivers/drivers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ int gradient(short tag, int n, const double *argument, double *result) {
/* */
/* vec_jac(tag, m, n, repeat, x[n], u[m], v[n]) */
int vec_jac(short tag, int m, int n, int repeat, const double *argument,
double *lagrange, double *row) {
const double *lagrange, double *row) {
int rc = -1;
double *y = NULL;

Expand Down
2 changes: 1 addition & 1 deletion ADOL-C/src/drivers/driversf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ fint gradient_(fint *ftag, fint *fn, fdouble *fargument, fdouble *fresult) {
/* */
/* vec_jac(tag, m, n, repeat, x[n], u[m], v[n]) */
fint vec_jac_(fint *ftag, fint *fm, fint *fn, fint *frepeat, fdouble *fargument,
fdouble *flagrange, fdouble *frow) {
const fdouble *flagrange, fdouble *frow) {
int rc = -1;
short tag = (short)*ftag;
int m = *fm, n = *fn, repeat = *frepeat;
Expand Down
48 changes: 24 additions & 24 deletions ADOL-C/src/fo_rev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,49 +230,52 @@
int depen, /* consistency chk on # of deps */
int indep, /* consistency chk on # of indeps */
int swchk, /* consistency chk on # of switches */
short *siggrad, double *lagrange,
const short *siggrad, const double *lagrange,
double *results) /* coefficient vectors */
#else
int fos_reverse(short tnum, /* tape id */
int depen, /* consistency chk on # of deps */
int indep, /* consistency chk on # of indeps */
double *lagrange, double *results) /* coefficient vectors */
const double *lagrange,
double *results) /* coefficient vectors */

#endif
#elif _FOV_
/****************************************************************************/
/* First-Order Vector Reverse Pass. */
/****************************************************************************/

int fov_reverse(short tnum, /* tape id */
int depen, /* consistency chk on # of deps */
int indep, /* consistency chk on # of indeps */
int nrows, /* # of Jacobian rows being calculated */
double **lagrange, /* domain weight vector */
double **results) /* matrix of coefficient vectors */
int fov_reverse(short tnum, /* tape id */
int depen, /* consistency chk on # of deps */
int indep, /* consistency chk on # of indeps */
int nrows, /* # of Jacobian rows being calculated */
const double *const *lagrange, /* domain weight vector */
double **results) /* matrix of coefficient vectors */

#elif defined(_INT_REV_)
#if defined(_TIGHT_)
/****************************************************************************/
/* First Order Vector version of the reverse mode for bit patterns, tight */
/****************************************************************************/
int int_reverse_tight(short tnum, /* tape id */
int depen, /* consistency chk on # of deps */
int indep, /* consistency chk on # of indeps */
int nrows, /* # of Jacobian rows being calculated */
size_t **lagrange, /* domain weight vector[var][row](in)*/
size_t **results) /* matrix of coeff. vectors[var][row]*/
int int_reverse_tight(

Check warning on line 260 in ADOL-C/src/fo_rev.cpp

View check run for this annotation

Codecov / codecov/patch

ADOL-C/src/fo_rev.cpp#L260

Added line #L260 was not covered by tests
short tnum, /* tape id */
int depen, /* consistency chk on # of deps */
int indep, /* consistency chk on # of indeps */
int nrows, /* # of Jacobian rows being calculated */
const size_t *const *lagrange, /* domain weight vector[var][row](in)*/
size_t **results) /* matrix of coeff. vectors[var][row]*/

#elif defined(_NTIGHT_)
/****************************************************************************/
/* First Order Vector version of the reverse mode, bit pattern, safe */
/****************************************************************************/
int int_reverse_safe(short tnum, /* tape id */
int depen, /* consistency chk on # of deps */
int indep, /* consistency chk on # of indeps */
int nrows, /* # of Jacobian rows being calculated */
size_t **lagrange, /* domain weight vector[var][row](in)*/
size_t **results) /* matrix of coeff. vectors[var][row]*/
int int_reverse_safe(

Check warning on line 272 in ADOL-C/src/fo_rev.cpp

View check run for this annotation

Codecov / codecov/patch

ADOL-C/src/fo_rev.cpp#L272

Added line #L272 was not covered by tests
short tnum, /* tape id */
int depen, /* consistency chk on # of deps */
int indep, /* consistency chk on # of indeps */
int nrows, /* # of Jacobian rows being calculated */
const size_t *const *lagrange, /* domain weight vector[var][row](in)*/
size_t **results) /* matrix of coeff. vectors[var][row]*/
#else
#error Neither _TIGHT_ nor _NTIGHT_ defined
#endif
Expand Down Expand Up @@ -719,10 +722,7 @@
*Ares = 0.0;
#else
if (ADOLC_CURRENT_TAPE_INFOS.in_nested_ctx) {
FOR_0_LE_l_LT_p {
ARES_INC = LAGRANGETRANS(l, indexd);
LAGRANGETRANS(l, indexd) = 0.0;
}
FOR_0_LE_l_LT_p { ARES_INC = LAGRANGETRANS(l, indexd); }
} else {
FOR_0_LE_l_LT_p ARES_INC = LAGRANGE(l, indexd);
}
Expand Down
12 changes: 6 additions & 6 deletions ADOL-C/src/fortutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,37 +21,37 @@
/* */

/*--------------------------------------------------------------------------*/
void spread1(int m, fdouble *x, double *X) {
void spread1(int m, const fdouble *x, double *X) {

Check warning on line 24 in ADOL-C/src/fortutils.cpp

View check run for this annotation

Codecov / codecov/patch

ADOL-C/src/fortutils.cpp#L24

Added line #L24 was not covered by tests
int j;
for (j = 0; j < m; j++)
X[j] = *x++;
}

/*--------------------------------------------------------------------------*/
void pack1(int m, double *X, fdouble *x) {
void pack1(int m, const double *X, fdouble *x) {

Check warning on line 31 in ADOL-C/src/fortutils.cpp

View check run for this annotation

Codecov / codecov/patch

ADOL-C/src/fortutils.cpp#L31

Added line #L31 was not covered by tests
int j;
for (j = 0; j < m; j++)
*x++ = X[j];
}

/*--------------------------------------------------------------------------*/
void spread2(int m, int n, fdouble *x, double **X) {
void spread2(int m, int n, const fdouble *x, double **X) {

Check warning on line 38 in ADOL-C/src/fortutils.cpp

View check run for this annotation

Codecov / codecov/patch

ADOL-C/src/fortutils.cpp#L38

Added line #L38 was not covered by tests
int i, j;
for (j = 0; j < n; j++)
for (i = 0; i < m; i++)
X[i][j] = *x++;
}

/*--------------------------------------------------------------------------*/
void pack2(int m, int n, double **X, fdouble *x) {
void pack2(int m, int n, const double *const *X, fdouble *x) {

Check warning on line 46 in ADOL-C/src/fortutils.cpp

View check run for this annotation

Codecov / codecov/patch

ADOL-C/src/fortutils.cpp#L46

Added line #L46 was not covered by tests
int i, j;
for (j = 0; j < n; j++)
for (i = 0; i < m; i++)
*x++ = X[i][j];
}

/*--------------------------------------------------------------------------*/
void spread3(int m, int n, int p, fdouble *x, double ***X) {
void spread3(int m, int n, int p, const fdouble *x, double ***X) {

Check warning on line 54 in ADOL-C/src/fortutils.cpp

View check run for this annotation

Codecov / codecov/patch

ADOL-C/src/fortutils.cpp#L54

Added line #L54 was not covered by tests
int i, j, k;
for (k = 0; k < p; k++)
for (j = 0; j < n; j++)
Expand All @@ -60,7 +60,7 @@
}

/*--------------------------------------------------------------------------*/
void pack3(int m, int n, int p, double ***X, fdouble *x) {
void pack3(int m, int n, int p, const double *const *const *X, fdouble *x) {

Check warning on line 63 in ADOL-C/src/fortutils.cpp

View check run for this annotation

Codecov / codecov/patch

ADOL-C/src/fortutils.cpp#L63

Added line #L63 was not covered by tests
int i, j, k;
for (k = 0; k < p; k++)
for (j = 0; j < n; j++)
Expand Down
23 changes: 13 additions & 10 deletions ADOL-C/src/forward_partx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
/* zos_forward_partx(tag, m, mdim[n], n, x[n][d], y[m]) */
/* (based on zos_forward) */

int zos_forward_partx(short tag, int m, int n, int *ndim, double **x,
double *y) {
int zos_forward_partx(short tag, int m, int n, const int *ndim,

Check warning on line 25 in ADOL-C/src/forward_partx.cpp

View check run for this annotation

Codecov / codecov/patch

ADOL-C/src/forward_partx.cpp#L25

Added line #L25 was not covered by tests
const double *const *x, double *y) {
double *x0; /* base point */
int i, j, ind, sum_n, rc;

Expand Down Expand Up @@ -52,8 +52,8 @@
/* fos_forward_partx(tag, m, n, ndim[n], x[n][][2], y[m][2]) */
/* (based on fos_forward) */

int fos_forward_partx(short tag, int m, int n, int *ndim, double ***x,
double **y) {
int fos_forward_partx(short tag, int m, int n, const int *ndim,

Check warning on line 55 in ADOL-C/src/forward_partx.cpp

View check run for this annotation

Codecov / codecov/patch

ADOL-C/src/forward_partx.cpp#L55

Added line #L55 was not covered by tests
const double *const *const *x, double **y) {
double *x0; /* base point */
double *xtay; /* Taylor coefficients */
double *y0; /* result */
Expand Down Expand Up @@ -97,8 +97,8 @@
/* hos_forward_partx(tag, m, n, ndim[n], d, x[n][][d+1], y[m][d+1]) */
/* (based on hos_forward) */

int hos_forward_partx(short tag, int m, int n, int *ndim, int d, double ***x,
double **y) {
int hos_forward_partx(short tag, int m, int n, const int *ndim, int d,

Check warning on line 100 in ADOL-C/src/forward_partx.cpp

View check run for this annotation

Codecov / codecov/patch

ADOL-C/src/forward_partx.cpp#L100

Added line #L100 was not covered by tests
const double *const *const *x, double **y) {
double *x0; /* base point */
double **xtay; /* Taylor coefficients */
double *y0; /* result */
Expand Down Expand Up @@ -145,8 +145,9 @@
y[m], Y[m][p]) */
/* (based on fov_forward) */

int fov_forward_partx(short tag, int m, int n, int *ndim, int p, double **x,
double ***Xppp, double *y, double **Ypp) {
int fov_forward_partx(short tag, int m, int n, const int *ndim, int p,

Check warning on line 148 in ADOL-C/src/forward_partx.cpp

View check run for this annotation

Codecov / codecov/patch

ADOL-C/src/forward_partx.cpp#L148

Added line #L148 was not covered by tests
const double *const *x, const double *const *const *Xppp,
double *y, double **Ypp) {
double *x0; /* base point */
double **X; /* Taylor coefficients */
int i, j, k, ind, sum_n, rc;
Expand Down Expand Up @@ -181,8 +182,10 @@
y[m], Y[m][p][d]) */
/* (based on hov_forward) */

int hov_forward_partx(short tag, int m, int n, int *ndim, int d, int p,
double **x, double ****Xpppp, double *y, double ***Yppp) {
int hov_forward_partx(short tag, int m, int n, const int *ndim, int d, int p,

Check warning on line 185 in ADOL-C/src/forward_partx.cpp

View check run for this annotation

Codecov / codecov/patch

ADOL-C/src/forward_partx.cpp#L185

Added line #L185 was not covered by tests
const double *const *x,
const double *const *const *const *Xpppp, double *y,
double ***Yppp) {
double *x0; /* base point */
double ***X; /* Taylor coefficients */
int i, j, k, l, ind, sum_n, rc;
Expand Down
53 changes: 27 additions & 26 deletions ADOL-C/src/ho_rev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,36 +238,36 @@
return rc;
}

int hos_ti_reverse(short tnum, /* tape id */
int depen, /* consistency chk on # of deps */
int indep, /* consistency chk on # of indeps */
int degre, /* highest derivative degre */
double **lagrange, /* range weight vectors */
double **results) /* matrix of coefficient vectors */
int hos_ti_reverse(short tnum, /* tape id */
int depen, /* consistency chk on # of deps */
int indep, /* consistency chk on # of indeps */
int degre, /* highest derivative degre */
const double *const *lagrange, /* range weight vectors */
double **results) /* matrix of coefficient vectors */

#elif _HOS_OV_

/***************************************************************************/
/* Higher Order Scalar Reverse Pass, Vector Keep. */
/***************************************************************************/
int hos_ov_reverse(short tnum, /* tape id */
int depen, /* consistency chk on # of deps */
int indep, /* consistency chk on # of indeps */
int degre, /* highest derivative degre */
int nrows, /* # of Jacobian rows calculated */
double **lagrange, /* range weight vector */
int hos_ov_reverse(short tnum, /* tape id */

Check warning on line 253 in ADOL-C/src/ho_rev.cpp

View check run for this annotation

Codecov / codecov/patch

ADOL-C/src/ho_rev.cpp#L253

Added line #L253 was not covered by tests
int depen, /* consistency chk on # of deps */
int indep, /* consistency chk on # of indeps */
int degre, /* highest derivative degre */
int nrows, /* # of Jacobian rows calculated */
const double *const *lagrange, /* range weight vector */
double ***results) /* matrix of coefficient vectors */

#elif _HOV_
/***************************************************************************/
/* Higher Order Vector Reverse Pass. */
/***************************************************************************/
int hov_reverse(short tnum, /* tape id */
int depen, /* consistency chk on # of deps */
int indep, /* consistency chk on # of indeps */
int degre, /* highest derivative degre */
int nrows, /* # of Jacobian rows calculated */
double **lagrange, /* domain weight vector */
int hov_reverse(short tnum, /* tape id */
int depen, /* consistency chk on # of deps */
int indep, /* consistency chk on # of indeps */
int degre, /* highest derivative degre */
int nrows, /* # of Jacobian rows calculated */
const double *const *lagrange, /* domain weight vector */
double ***results, /* matrix of coefficient vectors */
short **nonzero) /* structural sparsity pattern */
{
Expand All @@ -284,14 +284,15 @@
return rc;
}

int hov_ti_reverse(short tnum, /* tape id */
int depen, /* consistency chk on # of deps */
int indep, /* consistency chk on # of indeps */
int degre, /* highest derivative degre */
int nrows, /* # of Jacobian rows calculated */
double ***lagrange, /* domain weight vectors */
double ***results, /* matrix of coefficient vectors */
short **nonzero) /* structural sparsity pattern */
int hov_ti_reverse(
short tnum, /* tape id */
int depen, /* consistency chk on # of deps */
int indep, /* consistency chk on # of indeps */
int degre, /* highest derivative degre */
int nrows, /* # of Jacobian rows calculated */
const double *const *const *lagrange, /* domain weight vectors */
double ***results, /* matrix of coefficient vectors */
short **nonzero) /* structural sparsity pattern */

#endif

Expand Down
Loading
Loading