\(\newcommand{\W}[1]{ \; #1 \; }\) \(\newcommand{\R}[1]{ {\rm #1} }\) \(\newcommand{\B}[1]{ {\bf #1} }\) \(\newcommand{\D}[2]{ \frac{\partial #1}{\partial #2} }\) \(\newcommand{\DD}[3]{ \frac{\partial^2 #1}{\partial #2 \partial #3} }\) \(\newcommand{\Dpow}[2]{ \frac{\partial^{#1}}{\partial {#2}^{#1}} }\) \(\newcommand{\dpow}[2]{ \frac{ {\rm d}^{#1}}{{\rm d}\, {#2}^{#1}} }\)
new_dynamic¶
View page sourceChange the Dynamic Parameters¶
Syntax¶
new_dynamic
( dynamic )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 .
BaseVector¶
The type BaseVector must be a SimpleVector class with elements of type Base .
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.