e04gb
is the AD Library version of the primal routine
e04gbf.
Based (in the C++ interface) on overload resolution,
e04gb can be used for primal, tangent and adjoint
evaluation. It supports tangents and adjoints of first and second order.
The parameter ad_handle can be used to choose whether adjoints are computed using a symbolic adjoint or straightforward algorithmic differentiation.
In addition, the routine has further optimisations when symbolic expert strategy is selected.
Corresponding to the overloaded C++ function, the Fortran interface provides five routines with names reflecting the type used for active real arguments. The actual subroutine and type names are formed by replacing AD and ADTYPE in the above as follows:
The function is overloaded on ADTYPE which represents the type of active arguments. ADTYPE may be any of the following types: double, dco::ga1s<double>::type, dco::gt1s<double>::type, dco::gt1s<dco::gt1s<double>::type>::type, dco::ga1s<dco::gt1s<double>::type>::type,
Note: this function can be used with AD tools other than dco/c++. For details, please contact NAG.
3Description
e04gb
is the AD Library version of the primal routine
e04gbf.
e04gbf is a comprehensive quasi-Newton algorithm for finding an unconstrained minimum of a sum of squares of nonlinear functions in variables . First derivatives are required. The routine is intended for functions which have continuous first and second derivatives (although it will usually work even if the derivatives have occasional discontinuities).
For further information see Section 3 in the documentation for e04gbf.
3.1Symbolic Adjoint
3.1.1Symbolic Strategy
Symbolic strategy may be selected by calling
ad_handle.set_strategy(nag::ad::symbolic)
prior
to calling e04gb. No further
changes are needed compared to using the algorithmic strategy.
3.1.2Symbolic Expert Strategy
Symbolic expert strategy may be selected by calling
ad_handle.set_strategy(nag::ad::symbolic_expert)
prior to calling e04gb. In contrast to the symbolic
strategy, in symbolic expert strategy the
user-supplied primal callback needs a specific
implementation to support symbolic computation, but this can improve
overall performance. See the example
e04gb_a1_sym_expert_dcoe.cpp for details.
3.1.3Mathematical Background
To be more specific, the symbolic adjoint solves
(1)
followed by an adjoint projection through the user-supplied adjoint routine
(2)
The Hessian as well as the mixed derivative tensor is computed using the user-supplied adjoint routine.
You can set or access the adjoints of output arguments x, fvec, fjac and fsumsq. The adjoints of all other output arguments are ignored.
e04gb increments the adjoints of the variable , where is the parameter used in the function callback lsqfun.
4References
Du Toit J, Naumann U (2017) Adjoint Algorithmic Differentiation Tool Support for Typical Numerical Patterns in Computational Finance
Giles M (2017) Collected Matrix Derivative Results for Forward and Reverse Mode Algorithmic Differentiation
Gill P E and Murray W (1978) Algorithms for the solution of the nonlinear least squares problem SIAM J. Numer. Anal.15 977–992
Naumann U, Lotz J, Leppkes K and Towara M (2017) Algorithmic Differentiation of Numerical Methods: Tangent and Adjoint Solvers for Parameterized Systems of Nonlinear Equations
5Arguments
In addition to the arguments present in the interface of the primal routine,
e04gb includes some arguments specific to AD.
A brief summary of the AD specific arguments is given below. For the remainder, links are provided to the corresponding argument from the primal routine.
A tooltip popup for all arguments can be found by hovering over the argument name in Section 2 and in this section.
On entry: a configuration object that holds information on the differentiation strategy. Details on setting the AD strategy are described in AD handle object and AD Strategies in the NAG AD Library Introduction.
selct enables you to specify whether the linear minimizations (i.e., minimizations of with respect to ) are to be performed by a routine which just requires the evaluation of the (), or by a routine which also requires the first derivatives of the ().
lsqfun
needs to be callable with the specification listed below. This can be a C++ lambda, a functor or a (static member) function pointer.
If using a lambda, parameters can be captured safely by reference. No copies of the callable are made internally.
lsqmon
needs to be callable with the specification listed below. This can be a C++ lambda, a functor or a (static member) function pointer.
If using a lambda, parameters can be captured safely by reference. No copies of the callable are made internally.
If a null pointer is used as the argument, then a NAG supplied routine will be used as the argument for this parameter (C++ only).
For the Fortran interface, the NAG supplied routine e04fd_AD_z may be used as the actual argument for this parameter.