evalhf/var - passing arrays by value/result; var(name)
|
Description
|
|
•
|
The var construct is a place holder for Maple array arguments passed as parameters to functions evaluated by evalhf.
|
•
|
The var array arguments are converted to hardware floating point. Then evalhf evaluates the function with this float array and on return, the arguments are converted back into the Maple array. This achieves an effect similar to var arguments in Pascal function calls, but in reality it does call by value/result.
|
•
|
The var mechanism is the only mechanism available that will obtain an array result from a computation done by evalhf other than individual calls to compute each array entry.
|
•
|
If desired, an evalhf call can be passed an hfarray or rtable with datatype=float[8] or datatype=complex[8] instead of an array. These are truly passed by reference, and result in negligible overhead on entry to and exit from the evalhf environment.
|
•
|
This conversion process is only necessary when passing an array from Maple to an evalhf function call. Calls within functions already under evalhf evaluation do not need the var(..) feature.
|
|
|
Examples
|
|
>
|
f := proc(A,B) B[1]:= A[2] end proc:
|
>
|
|
>
|
|
| (1) |
>
|
|
| (2) |
>
|
|
| (3) |
>
|
|
| (4) |
>
|
det := proc(A::array)
A[1,1]*A[2,2] - A[1,2]*A[2,1];
end proc:
|
>
|
|
| (5) |
>
|
|
| (6) |
>
|
|
| (7) |
>
|
|
| (8) |
>
|
|
| (9) |
|
|
Download Help Document
Was this information helpful?