4.4.2 Argument functions

Specific Scilab functions or C or Fortran routines can be used as an argument of some high-level primitives (such as ode, optim, dassl...). These fonctions are called argument functions or externals. The calling sequence of this function or routine is imposed by the high-level primitive which sets the argument of this function or routine.

For example the function costfunc is an argument of the optim primitive. Its calling sequence must be: [f,g,ind]=costfunc(x,ind) as imposed by the optim primitive. The following non-linear primitives in Scilab need argument functions or subroutines: ode, optim, impl, dassl, intg, odedc, fsolve. For problems where computation time is important, it is recommended to use C or Fortran subroutines. Examples of such subroutines are given in the directory SCIDIR/routines/default. See the README file there for more details.

When such a subroutine is written it must be linked to Scilab. This link operation can be done dynamically by the link command. It is also possible to introduce the code in a more permanent manner by inserting it in a specific interface in SCIDIR/routines/default and rebuild a new Scilab by a make all command in the Scilab directory.