![]() |
Prev | Next | capacity_taylor |
f.capacity_taylor(
c)
ADFun<
Base>
f
size_t
c
It specifies the number of taylor_ coefficients that are allocated for
each variable in the AD operation sequence corresponding to f.
y_p =
f.Forward(
p,
x_p)
uses the lower order taylor_ coefficients and
computes the p-th order taylor_ coefficients for all
the variables in the operation sequence corresponding to f.
(You can determine the number of variables in the operation sequence
using the size_var
function.)
Forward
with the maximum value of
p equal to q,
it should be faster to pre-allocate memory for these calls using
f.capacity_taylor(
c)
with c equal to
q + 1
.
If you do no do this, Forward
will automatically allocate memory
and will copy the results to a larger buffer, when necessary.
Note that each call to Dependent
frees the old memory
connected to the function object and sets the corresponding
taylor capacity to zero.
f.capacity_taylor(
c)
with c equal to q.
ADFun<
Base>
f(
x,
y)
,
there is an implicit call to Forward
with p equal to zero
and x_p equal to
the value of the
independent variables
when the AD operation sequence was recorded.