This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)
 Documentation / Mathematica / Built-in Functions / Programming / Functional Programming  /
CompiledFunction

  • CompiledFunction[ args , nregs , instr , func ] represents compiled code for evaluating a compiled function.
  • args is a list giving a pattern for the type of each argument to the function. The types are specified as in Compile.
  • nregs is a list giving the number of integer, real, complex and logical registers required to evaluate the compiled code.
  • instr is a list of actual compiled code instructions.
  • func is a Mathematica pure function to be used if no result can be obtained from the compiled code for any reason.
  • Compile generates a CompiledFunction object which can be executed by applying it to appropriate arguments.
  • CompiledFunction objects that are constructed explicitly can also be executed. Basic consistency checks are done when such objects are first evaluated by Mathematica.
  • The code in a CompiledFunction object is based on an idealized register machine.
  • See the Mathematica book: Section 2.2.8Section 2.5.15.
  • See also: InterpolatingFunction.

    Further Examples

    This compiles an expression that performs an operation on a matrix.

    In[1]:=

    Out[1]=

    The list operations are now carried out in a compiled way, and the result is an integer.

    In[2]:=

    Out[2]=