handling of arrays
evalhf handles only two special structures: arrays and rtables. This help page describes arrays, and rtables with their datatype option set to something other than float and complex. The rtable structure, which is a supertype of Array, Matrix, Vector, and hfarray are described in evalhf/hfarray.
Arrays passed as parameters to evalhf should have all their entries evaluating to floats or unassigned.
Unassigned array entries are treated as 0 by evalhf.
In general, evalhf can pass arrays downwards (to its called routines). These arrays can be modified and returned as function values, but cannot be returned as function values at the top level.
We distinguish two levels of interaction for arrays: (a) top-level, first call to evalhf and (b) function-to-function within an evalhf call. Thus
(a) A := array(1..2, 3..10); B := array(....); evalhf(f(A) + g(var(B)));
(b) f := proc(..) ..., A:=array(); g(...A,...) ... endproc; evalhf(f(...));
This distinction has to be made because at the top level, arrays are converted to hardware floats, something which is not necessary in between internal evalhf calls. This conversion is expensive and should be used judiciously.
Arrays within evalhf are passed by reference, and hence can be modified by any sub-function which uses them.
Arrays at the top level (a) are normally passed by value. By using the var(array) construct, arrays are passed by value and result, being converted into hardware floats and after evaluation, converted back.
The function array(...) is valid inside evalhf calls and accepts dimension information only. The result is an array of the given dimensions initialized to all zeros. No indexing or initializing information can be given to the function array.
Indexing functions are not handled by evalhf.
There is no mechanism, within evalhf, to find the dimension of an array from the object itself.
Global arrays or global array references are not permitted within evalhf.
Download Help Document
What kind of issue would you like to report? (Optional)