Compile
[{$x_1$, $x_2$, ...}, expr]Compile
[{{$x_1$, $t_1$} {$x_2$, $t_1$} ...}, expr] Compilation is performed using llvmlite , or Python's builtin
“compile” function.
cf = Compile[{x, y}, x + 2 y]
cf[2.5, 4.3]
cf = Compile[{{x, _Real}}, Sin[x]]
cf[1.4]
Compile supports basic flow control:
cf = Compile[{{x, _Real}, {y, _Integer}}, If[x == 0.0 && y <= 0, 0.0, Sin[x ^ y] + 1 / Min[x, 0.5]] + 0.5]
cf[3.5, 2]
Loops and variable assignments are supported usinv Python builtin “compile” function:
Compile[{{a, _Integer}, {b, _Integer}}, While[b != 0, {a, b} = {b, Mod[a, b]}]; a] (* GCD of a, b *)