transcompile SciMax Toolbox translate_file

SciMax Toolbox >> translate

translate

Maxima Function

Calling Sequence

translate (f_1, ..., f_n)
translate(functions)
translate(all)

Description

Translates the user-defined functions f_1, ..., f_n from the Maxima language into Lisp and evaluates the Lisp translations. Typically the translated functions run faster than the originals.

translate (all) or translate (functions) translates all user-defined functions.

Functions to be translated should include a call to mode_declare at the beginning when possible in order to produce more efficient code. For example:

f (x_1, x_2, ...) := block ([v_1, v_2, ...],
    mode_declare (v_1, mode_1, v_2, mode_2, ...), ...)

where the x_1, x_2, ... are the parameters to the function and the v_1, v_2, ... are the local variables.

The names of translated functions are removed from the functions list if savedef is false (see below) and are added to the props lists.

Functions should not be translated unless they are fully debugged.

Expressions are assumed simplified; if they are not, correct but non-optimal code gets generated. Thus, the user should not set the simp switch to false which inhibits simplification of the expressions to be translated.

The switch translate, if true, causes automatic translation of a user's function to Lisp.

Note that translated functions may not run identically to the way they did before translation as certain incompatabilities may exist between the Lisp and Maxima versions. Principally, the rat function with more than one argument and the ratvars function should not be used if any variables are mode_declare'd canonical rational expressions (CRE). Also the prederror: false setting will not translate.

savedef - if true will cause the Maxima version of a user function to remain when the function is translate'd. This permits the definition to be displayed by dispfun and allows the function to be edited.

transrun - if false will cause the interpreted version of all functions to be run (provided they are still around) rather than the translated version.

The result returned by translate is a list of the names of the functions translated.

transcompile SciMax Toolbox translate_file