Prev | Next |
CPPAD_DISCRETE_FUNCTION(Base, name)
y = name(x)
ay = name(ax)
AD<Base>
operation sequence
.
The value of a discrete function can depend on the
independent variables
,
but its derivative is identically zero.
For example, suppose that the integer part of
a variable
x
is the
index into an array of values.
name
with arguments of type
AD<Base>
can be recorded in an operation sequence.
name
where the argument has type
Base
.
CppAD uses this to create a version of
name
where the argument has type
AD<Base>
.
x
has prototype
const Base& x
It is the value at which the user provided version of
name
is to be evaluated.
y
has prototype
Base y
It is the return value for the user provided version of
name
.
ax
has prototype
const AD<Base>& ax
It is the value at which the CppAD provided version of
name
is to be evaluated.
ay
has prototype
AD<Base> ay
It is the return value for the CppAD provided version of
name
.
CPPAD_DISCRETE_FUNCTION(Base, name)
defines the
AD<Base>
version of
name
.
This can be with in a namespace (not the CppAD
namespace)
but must be outside of any routine.
Base
atomic operation
and hence is part of the current
AD of
Base
operation sequence
.
name
using the user provided
Base
version of this routine.
All the derivatives of
name
will be evaluated as zero.
name(ax)
must not be in parallel
execution mode.
CppADCreateDiscrete
is defined to be the same as CPPAD_DISCRETE_FUNCTION
but its use is deprecated.