|
Prev | Next |
f.optimize()
f.optimize
procedure reduces the number of operations,
and thereby the time and the memory, required to
compute function and derivative values.
f
has prototype
ADFun<Base> f
optimize member function
may greatly reduce the number of variables
in the operation sequence; see size_var
.
If a zero order forward
calculation is done during
the construction of
f
, it will require more memory
and time than required after the optimization procedure.
In addition, it will need to be redone.
For this reason, it is more efficient to use
ADFun<Base> f;
f.Dependent(x, y);
f.optimize();
instead of
ADFun<Base> f(x, y)
f.optimize();
See the discussion about
sequence constructors
.
NDEBUG is not defined).
f
and the results are checked to see that they are
the same as before.
If they are not the same, the
ErrorHandler
is called with a known error message
related to
f.optimize()
.