Maxima Function
mode_declare (y_1, mode_1, ..., y_n, mode_n)
mode_declare
is used to declare the modes of variables and
functions for subsequent translation or compilation of functions.
mode_declare
is typically placed at the beginning of a function
definition, at the beginning of a Maxima script, or executed at the interactive prompt.
The arguments of mode_declare
are pairs consisting of a variable and a mode which is
one of boolean
, fixnum
, number
, rational
, or float
.
Each variable may also
be a list of variables all of which are declared to have the same mode.
If a variable is an array, and if every element of the array which is
referenced has a value then array (yi, complete, dim1, dim2, ...)
rather than
array(yi, dim1, dim2, ...)
should be used when first declaring the bounds of the array.
If all the elements of the array
are of mode fixnum
(float
), use fixnum
(float
) instead of complete
.
Also if every element of the array is of the same mode, say m
, then
mode_declare (completearray (yi), m))
should be used for efficient translation.
Numeric code using arrays might run faster by declaring the expected size of the array, as in:
mode_declare (completearray (a [10, 10]), float)
for a floating point number array which is 10 x 10.
One may declare the mode of the result of a function by
using function (f_1, f_2, ...)
as an argument;
here f_1
, f_2
, ... are the names
of functions. For example the expression,
mode_declare ([function (f_1, f_2, ...)], fixnum)
declares that the values returned by f_1
, f_2
, ... are single-word integers.
modedeclare
is a synonym for mode_declare
.