Prev | Next |
implicit_kedem kedem_ad(L_fun, F_fun, solve)
rk = kedem_ad.Forward(k, xk, store)
kedem_ad
.
We define the reduced function
@(@
R(x) = F[ x , Y(x) ]
@)@ where
@(@
F : \B{R}^{n \times m} \rightarrow \B{R}^p
@)@.
The object
kedem_ad
can be used to compute
derivatives of the reduced function @(@
R(x)
@)@.
Note that in the special case where @(@
F(x, y) = y
@)@,
@(@
R(x) = Y(x)
@)@.
const CppAD::ADFun<double>& L_fun
and is the CppAD function object corresponding to @(@
L(x, y)
@)@.
const CppAD::ADFun<double>& F_fun
and is the CppAD function object corresponding to @(@
F(x, y)
@)@.
const Solve& solve
The type
Solver
must support the default constructor
and the assignment operator.
It must also support the following operations:
y = solve.function(x)
the argument
x
and the return value
y
have prototypes
const VECTOR(double)& x
VECTOR(double) y
where
x.size() == n
and
y.size() == m
.
The return value satisfies the relation @(@
L(x, y) = 0
@)@.
b = solve.derivative(x, y)
the arguments have prototypes
const VECTOR(double)& x
const VECTOR(double)& y
The return value has prototype
VECTOR(double) b
This returns the value of @(@
L_y (x, y)
@)@ for subsequent
calls to
solve.linear
.
Only the elements of @(@
L_y (x, y)
@)@ that depend on @(@
(x, y)
@)@
need be included in the vector @(@
b
@)@.
u = solve.linear(b, v)
the arguments
b
,
v
and the return value
u
have prototypes
const VECTOR(double)& b
const VECTOR(double)& v
const VECTOR(double) u
where both vectors have size
m
.
The argument
b
has prototype
VECTOR(double)& b
The return value satisfies the equation
@[@
u = L_y (x, y)^{-1} v
@]@
where @(@
L_y (x, y)
@)@ corresponds to
b
.
size_t k
Note that computing the k
-th order, uses the results of the
previous lower order calculations which are internally stored
in the function objects.
xk
has prototypes
const VECTOR(double)& xk
its size is
m
and it is the k
-th order Taylor coefficient
for
x
.
The results of the calculation are stored internally and used
during higher order forward mode calculations.
If
k > 0
,
there must have been a previous call to forward
for
order
k - 1
.
bool store
If it is true, the results of this forward mode calculation is store
so that a future forward mode calculation of order
k+1
is possible.
This requires an extra pass over the operation sequence for
L_fun
.
Hence
store
should be false when a higher order calculation
will not be needed.
rk
has prototype
VECTOR(double) rk
its size is
m
and it is the k
-th order Taylor coefficient
for
R(x)
.
k
-th order Taylor coefficients are
@(@
x^k = x^{(k)} (0) / k !
@)@ and
@(@
y^k = y^{(k)} (0) / k !
@)@.
y0 = solve.function(x0)
k
-th order forward mode on
L_fun
,
with @(@
y^k = 0
@)@, to determine
@[@
z^k = H_k ( x^0 , \cdots , x^k , y^0 , \cdots , y^{k-1} )
@]@
We then solve the equation
@[@
0 = z^k + L_y ( x^0 , y^0 ) y^k
@]@
to determine the proper value for @(@
y^k
@)@.