Prev Next

@(@\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}} }@)@This is cppad-20221105 documentation. Here is a link to its current documentation .
C Source Code Corresponding to an ADFun Object

Syntax

    
fun.to_csrc(osc_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
flag = cppad_jit_function_name(
    
nuunyycompare_change
)

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. The function type jit_c_type is defined in the CppAD namespace. In the case of the Visual C++ compiler (_MSC_VER is defined), __cdecl and __declspec(dllimport) are added to the function type definition.

Atomic Callbacks
flag = cppad_atomic_function_name(
    
call_idnuunyycompare_change
)

typedef int (*jit_
c_type)(
    size_t, size_t, const 
type*, size_t, type*, size_t*
)
The function type atomic_c_type is defined in the CppAD namespace. The corresponding function evaluates zero order forward mode for the atomic function with the specified function_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.
Input File: include/cppad/core/to_csrc.hpp