|
ADOL-C: Automatic Differentiation in C/C++ 2.7.3
|
#include <adolc/adolcexport.h>#include <adolc/drivers/absnormalform.h>#include <adolc/interfaces.h>#include <adolc/internal/common.h>#include <span>

Go to the source code of this file.
Namespaces | |
| namespace | ADOLC |
Enumerations | |
| enum class | ADOLC::UpdateConsts { ADOLC::True , ADOLC::False } |
Compile-time selector for constant-term updates in ADOLC::abs_normal. More... | |
Functions | |
| template<UpdateConsts uc = UpdateConsts::True> | |
| ADOLC_API int | ADOLC::abs_normal (short tapeId, std::span< const double > x, AbsNormalForm &anf) |
| Compute the abs-normal form of a taped function at a point. | |
| template<> | |
| ADOLC_API int | ADOLC::abs_normal< UpdateConsts::True > (short tapeId, std::span< const double > x, AbsNormalForm &anf) |
Specialization that updates cy and cz after evaluation. | |
| template<> | |
| ADOLC_API int | ADOLC::abs_normal< UpdateConsts::False > (short tapeId, std::span< const double > x, AbsNormalForm &anf) |
Specialization that leaves cy and cz unchanged. | |
| BEGIN_C_DECLS ADOLC_API fint | directional_active_gradient_ (fint, fint, double *, double *, double *, double **, short *) |
| ADOLC_API int | directional_active_gradient (short tag, int n, const double *x, const double *d, double *g, short *sigma_g) |
| ADOLC_API fint | abs_normal_ (fint *ftag, fint *fdepen, fint *findep, fint *fswchk, fdouble *fx, fdouble *fy, fdouble *fz, fdouble *fcz, fdouble *fcy, fdouble *fJ, fdouble *fY, fdouble *fZ, fdouble *fL) |
| ADOLC_API int | abs_normal (short tag, int m, int n, int swchk, const double *x, double *y, double *z, double **Y, double **J, double **Z, double **L) |
| Compute the ABS-normal form of a taped function. | |
| ADOLC_API int abs_normal | ( | short | tag, |
| int | m, | ||
| int | n, | ||
| int | swchk, | ||
| const double * | x, | ||
| double * | y, | ||
| double * | z, | ||
| double ** | Y, | ||
| double ** | J, | ||
| double ** | Z, | ||
| double ** | L | ||
| ) |
Compute the ABS-normal form of a taped function.
This routine evaluates the abs-normal form in the same ordering used by the driver interfaces: function outputs first and switching variables second, i.e.
\[ \left[\begin{array}{c} y\\ z \end{array}\right] = \left[\begin{array}{c} b\\ c \end{array}\right] + \left[\begin{array}{cc} Y & J\\ Z & L \end{array}\right] \left[\begin{array}{c} x\\ |z| \end{array}\right] \]
(see Griewank et al.: Solving piecewise linear equations in abs-normal form) associated with a previously recorded tape. It computes function values, switching variables, and the components needed for piecewise-linear / piecewise-smooth analysis.
J, Z, and L is not guaranteed to be stable across different compilers, optimization levels, or minor changes in the taped operations.For example, for
\[ f(x) = |x_0 - x_1| + |x_2 - x_3| \]
a compiler may process the absolute values in either order. As a consequence, the first switching variable may correspond to \(|x_0 - x_1|\) (so its row depends on \(x_0, x_1\)), or instead to \(|x_2 - x_3|\) (so its row depends on \(x_2, x_3\)). This yields a different row structure in the abs-normal form even though the mathematical function is identical.
| tag | Tape identifier. |
| m | Number of dependent variables. |
| n | Number of independent variables. |
| swchk | Number of switching variables (as returned by get_num_switches()). |
| x | Base point (input values), array of length n. |
| y | Function values at x, array of length m. |
| z | Switching variable values, array of length swchk. |
| Y | Matrix of size m × n. |
| J | Matrix of size m × swchk. |
| Z | Matrix of size swchk × n. |
| L | Lower-triangular matrix of size swchk × swchk. |
| ADOLC_API fint abs_normal_ | ( | fint * | ftag, |
| fint * | fdepen, | ||
| fint * | findep, | ||
| fint * | fswchk, | ||
| fdouble * | fx, | ||
| fdouble * | fy, | ||
| fdouble * | fz, | ||
| fdouble * | fcz, | ||
| fdouble * | fcy, | ||
| fdouble * | fJ, | ||
| fdouble * | fY, | ||
| fdouble * | fZ, | ||
| fdouble * | fL | ||
| ) |
| ADOLC_API int directional_active_gradient | ( | short | tag, |
| int | n, | ||
| const double * | x, | ||
| const double * | d, | ||
| double * | g, | ||
| short * | sigma_g | ||
| ) |
| BEGIN_C_DECLS ADOLC_API fint directional_active_gradient_ | ( | fint | , |
| fint | , | ||
| double * | , | ||
| double * | , | ||
| double * | , | ||
| double ** | , | ||
| short * | |||
| ) |