Create a new code differentiation object.
VDV=diffcode_der(v,dv)
matrix of doubles, or hypermatrix of doubles, or diffcode object
matrix of doubles, or hypermatrix of doubles, or diffcode object. dv must have the same size as v
a data structure with type "TDFFCD".
This function creates a data structure containing the value and the directional derivative.
On output, the data structure VDV
has two fields:
VDV.v
is set to v (the value)
,
VDV.dv
is set to dv (the directional derivative)
.
This module is based on overloading.
The principle of the module is the following.
Assume that a function f
is defined by
v=f(x)
where x
is the input and v
is the output.
Then the directional derivative is
dv = f'(x) dx
where dx
is the directional derivative
of x
and dv
is the
directional derivative of v
.
In the following example, we compute the
function value and derivative of z=x^3+y^3+2*x*y
.