Purpose
Often one is only interested in computing derivatives with respect
to a subset of arguments to a function.
In this case, it is easier to make all the arguments to the function
independent variables
.
It is more efficient,
will use less memory and be faster,
if the only the argument were are computing derivatives with respect to
are independent variables and the other arguments are
dynamic
parameters.
The new_dynamic method is used to change the value
of the dynamic parameters in
f
.
f
The object
f
has prototype
ADFun<Base> f
Note that the ADFun
object
f
is not const.
dynamic
This argument has prototype
const BaseVector& dynamic
(see
BaseVector
below).
It specifies a new value for the independent
dynamic
parameters.
It size must be the same as the size of the independent
dynamic
parameter vector
in the call to Independent that started
the recording for
f
; see
size_dyn_ind
.
Taylor Coefficients
The Taylor coefficients computed by previous calls to
f.Forward
are lost after this operation; including the
order zero coefficients (because they may depend on the dynamic parameters).
In order words;
f.size_order
returns zero directly after
f.new_dynamic
is called.
Example
The file new_dynamic.cpp
contains an example and test of this operation.
Input File: include/cppad/core/new_dynamic.hpp