Prev Next size_taylor

Number Taylor Coefficients, Per Variable, Currently Stored

Syntax
s = f.size_taylor()

Purpose
Determine the number of Taylor coefficients, per variable, currently calculated and stored in the ADFun object f. See the discussion under Constructor , Forward , and capacity_taylor for a description of when this value can change.

f
The object f has prototype
     const ADFun<
Basef

s
The result s has prototype
     size_t 
s
and is the number of Taylor coefficients, per variable in the AD operation sequence, currently calculated and stored in the ADFun object f.

Constructor
Directly after the FunConstruct syntax
     ADFun<
Basef(xy)
the value of s returned by size_taylor is one. This is because there is an implicit call to Forward that computes the zero order Taylor coefficients during this constructor.

Forward
After a call to Forward with the syntax
        
f.Forward(px_p)
the value of s returned by size_taylor would be  p + 1 . The call to Forward above uses the lower order Taylor coefficients to compute and store the p-th order Taylor coefficients for all the variables in the operation sequence corresponding to f. Thus there are  p + 1 (order zero through p) Taylor coefficients per variable. (You can determine the number of variables in the operation sequence using the size_var function.)

capacity_taylor
If the number of Taylor coefficients currently stored in f is less than or equal c, a call to capacity_taylor with the syntax
     
f.capacity_taylor(c)
does not affect the value s returned by size_taylor. Otherwise, the value s returned by size_taylor is equal to c (only Taylor coefficients of order zero through  c-1 have been retained).

Example
The file Forward.cpp contains an example and test of this operation. It returns true if it succeeds and false otherwise.
Input File: omh/forward.omh