to_csrc

C Source Code Corresponding to an ADFun Object

Syntax

fun . 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

flag = cppad_jit_ function_name (
      nu , u , ny , y , compare_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_id , nu , u , ny , y , compare_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 .