Skip to content
Joris Gillis edited this page Apr 4, 2023 · 2 revisions

Standard documentation for Function_jit:

 [INTERNAL] 

::

 jit(str name, str body, [str] name_in, [str] name_out, dict opts) -> Function
 jit(str name, str body, [str] name_in, [str] name_out, [Sparsity] sparsity_in, [Sparsity] sparsity_out, dict opts) -> Function

Create a just-in-time compiled function from a C language string.

The names and sparsity patterns of all the inputs and outputs must be

provided. If sparsities are not provided, all inputs and outputs are

assumed to be scalar. Only specify the function body, assuming that input and output nonzeros are stored in arrays with the specified naming convension. The data type used is 'casadi_real', which is typically equal to 'double or another data type with the same API as 'double.

Inputs may be null pointers. This means that the all entries are zero.

Outputs may be null points. This means that the corresponding result can be ignored.

If an error occurs in the evaluation, issue "return 1;";

The final generated function will have a structure similar to:

casadi_int fname(const casadi_real** arg, casadi_real** res, casadi_int* iw, casadi_real* w, void* mem) { const casadi_real *x1, *x2; casadi_real *r1, *r2; x1 = *arg++; x2 = *arg++; r1 = *res++; r2 = *res++; <FUNCTION_BODY> return 0; }

Extra doc: https://github.com/casadi/casadi/wiki/L_1v3

Doc source: https://github.com/casadi/casadi/blob/develop/casadi/core/function.hpp#L189

Implementation: https://github.com/casadi/casadi/blob/develop/casadi/core/function.cpp#L262-L274

.......

::

 jit(str name, str body, [str] name_in, [str] name_out, dict opts)

[INTERNAL] Create a just-in-time compiled function from a C language string.

The names and sparsity patterns of all the inputs and outputs must be

provided. If sparsities are not provided, all inputs and outputs are

assumed to be scalar. Only specify the function body, assuming that input and output nonzeros are stored in arrays with the specified naming convension. The data type used is 'casadi_real', which is typically equal to 'double or another data type with the same API as 'double.

Inputs may be null pointers. This means that the all entries are zero.

Outputs may be null points. This means that the corresponding result can be ignored.

If an error occurs in the evaluation, issue "return 1;";

The final generated function will have a structure similar to:

casadi_int fname(const casadi_real** arg, casadi_real** res, casadi_int* iw, casadi_real* w, void* mem) { const casadi_real *x1, *x2; casadi_real *r1, *r2; x1 = *arg++; x2 = *arg++; r1 = *res++; r2 = *res++; <FUNCTION_BODY> return 0; }

Extra doc: https://github.com/casadi/casadi/wiki/L_1v3

Doc source: https://github.com/casadi/casadi/blob/develop/casadi/core/function.hpp#L185

Implementation: https://github.com/casadi/casadi/blob/develop/casadi/core/function.cpp#L253-L260

.............

.......

::

 jit(str name, str body, [str] name_in, [str] name_out, [Sparsity] sparsity_in, [Sparsity] sparsity_out, dict opts)

[INTERNAL] Create a just-in-time compiled function from a C language string.

The names and sparsity patterns of all the inputs and outputs must be

provided. If sparsities are not provided, all inputs and outputs are

assumed to be scalar. Only specify the function body, assuming that input and output nonzeros are stored in arrays with the specified naming convension. The data type used is 'casadi_real', which is typically equal to 'double or another data type with the same API as 'double.

Inputs may be null pointers. This means that the all entries are zero.

Outputs may be null points. This means that the corresponding result can be ignored.

If an error occurs in the evaluation, issue "return 1;";

The final generated function will have a structure similar to:

casadi_int fname(const casadi_real** arg, casadi_real** res, casadi_int* iw, casadi_real* w, void* mem) { const casadi_real *x1, *x2; casadi_real *r1, *r2; x1 = *arg++; x2 = *arg++; r1 = *res++; r2 = *res++; <FUNCTION_BODY> return 0; }

Extra doc: https://github.com/casadi/casadi/wiki/L_1v3

Doc source: https://github.com/casadi/casadi/blob/develop/casadi/core/function.hpp#L189

Implementation: https://github.com/casadi/casadi/blob/develop/casadi/core/function.cpp#L262-L274

.............

Extra documentation

To edit, see writing tips.

Clone this wiki locally