Prev | Next |
class atomic_user : public CppAD::atomic_four<Base> {
...
};
atomic_user afun(ctor_arg_list)
afun(ax, ay)
afun(call_id, ax, ay)
ok = afun.for_type( call_id,
type_x, type_y
)
ok = afun.forward( call_id,
select_y, order_low, order_up, taylor_x, taylor_y
)
ok = afun.reverse( call_id,
select_x, order_up, taylor_x, taylor_y, partial_x, partial_y
)
ok = afun.jac_sparsity( call_id,
dependency, ident_zero_x, select_x select_y, pattern_out
)
ok = afun.hes_sparsity( call_id,
ident_zero_x, select_x select_y, pattern_out
)
ok = afun.rev_depend( call_id,
ident_zero_x, depend_x, depend_y
)
AD<Base>
atomic
operations
and letting CppAD do the rest.
The class
atomic_four<Base>
is used to
create a new atomic operation corresponding to a function @(@
g(x)
@)@
where the user specifies how to compute the derivatives
and sparsity patterns for @(@
g(x)
@)@.
AD<Base>
operations and variables
in the recording.
atomic_user
class.
These functions compute derivatives,
sparsity patterns, and dependency relations.
Each virtual function has a default implementation
that returns
ok == false
.
The for_type
and forward
function
(for the case
order_up == 0
) are used by an atomic function
call
.
Hence, they are required for one to use an atomic function.
Other functions and orders are only required if they are used
for your calculations.
For example,
forward
for the case
order_up == 2
can just return
ok == false
unless you require
forward mode calculation of second derivatives.
atomic_four_ctor | Atomic Function Constructor |
atomic_four_call | Calling an Atomic Function |
atomic_four_for_type | Atomic Function Forward Type Calculation |
atomic_four_forward | Atomic Function Forward Mode |
atomic_four_reverse | Atomic Function Reverse Mode |
atomic_four_jac_sparsity | Atomic Function Jacobian Sparsity Patterns |
atomic_four_hes_sparsity | Atomic Function Hessian Sparsity Patterns |
atomic_four_rev_depend | Atomic Function Reverse Dependency |