evalhf/var - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Resource Management : evalhf : evalhf/var

evalhf/var

passing arrays by value/result; var(name)

 

Description

Examples

Description

• 

The var construct is a placeholder for Maple array arguments passed as parameters to functions evaluated by evalhf.

• 

For example,

A:=array....;

evalhffvarA;

• 

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:

Aarray1..2,3,4:Barray1..2,0,0:

evalhffA,B

4.

(1)

printB

00

(2)

evalhffA,varB

4.

(3)

printB

4.0.

(4)

det := proc(A::array)
    A[1,1]*A[2,2] - A[1,2]*A[2,1];
end proc:

MMatrix2,12,14,12,13

M:=12141213

(5)

evalhfdetM

0.0416666666666666574

(6)

M

12141213

(7)

evalhfdetvarM

0.0416666666666666574

(8)

M

0.5000000000000000.2500000000000000.5000000000000000.333333333333333

(9)

See Also

evalhf[array]

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam