\(\newcommand{\W}[1]{ \; #1 \; }\) \(\newcommand{\R}[1]{ {\rm #1} }\) \(\newcommand{\B}[1]{ {\bf #1} }\) \(\newcommand{\D}[2]{ \frac{\partial #1}{\partial #2} }\) \(\newcommand{\DD}[3]{ \frac{\partial^2 #1}{\partial #2 \partial #3} }\) \(\newcommand{\Dpow}[2]{ \frac{\partial^{#1}}{\partial {#2}^{#1}} }\) \(\newcommand{\dpow}[2]{ \frac{ {\rm d}^{#1}}{{\rm d}\, {#2}^{#1}} }\)
to_csrc¶
View page sourceC Source Code Corresponding to an ADFun Object¶
Syntax¶
to_csrc
( os , c_type )Prototype¶
template <class Base, class RecBase>
void CppAD::ADFun<Base,RecBase>::to_csrc(
std::ostream& os ,
const std::string& c_type )
fun¶
is the ADFun object.
Base¶
is the type corresponding to this ADFun object; i.e., its calculations are done using the type Base .
RecBase¶
in the prototype above, RecBase is the same type as Base .
os¶
The C source code representation of the function fun is written to os .
c_type¶
The possible values for this argument are:
float
, double
, or long_double
.
JIT Functions¶
Function Type¶
The function type jit_
c_type is defined in the CppAD namespace as:
typedef int
(* jit_
c_type )(size_t
, const
type * , size_t
, type * , size_t
*Here type is the same as c_type except that the
underbar in long_double
is replaced by a space.
In the case of the Visual C++ compiler (_MSC_VER
is defined),
__cdecl
and __declspec(dllimport)
are added to
the function type definition.
Syntax¶
cppad_jit_
function_name (A corresponding function call evaluations zero order forward mode for the function fun and
.function_name_get
()see function_name .
Atomic Callbacks¶
Function Type¶
The function type atomic_
c_type is defined in the CppAD namespace.
typedef int
(* atomic_
c_type )(size_t
, size_t
, const
type * , size_t
, type * , size_t
*Syntax¶
cppad_atomic_
atomic_name (A corresponding function call evaluates zero order forward mode for the atomic function with the specified atomic_name ; see atomic_four name .
call_id¶
This argument is only used during atomic four function callbacks, in which case it is the corresponding call_id .
nu¶
is the number of independent dynamic parameters plus number of independent variables for the function fun .
u¶
is a C vector of size nu containing the independent dynamic parameters
and independent variables.
The independent dynamic parameter come first as in the same order as
dynamic in the call to Independent
for this function.
The independent variables are in the same order as
x in the call to Independent
for this function.
ny¶
is the number of dependent values for this function (a dependent value can be a variable, dynamic parameter, or constant parameter).
y¶
is a C vector of size ny . This input values of its elements do not matter. Upon return, it contains the function value correspond to u .
compare_change¶
This argument is both an input and an output. The number of comparison operators that change their bool result value is added to compare_change . This way, compare_change can be used to accumulate the number of changes between multiplier calls.
flag¶
If this is zero, no error was detected. If it is one (two), nu ( ny ) does not have its expected value.
Restrictions¶
The to_csrc
routine is not implemented for
VecAD operations.
Example¶
The section example_jit contains examples and tests
that use to_csrc
.