next up previous contents
Next: Pure Subroutine Example Up: Data Parallel Execution Previous: Pure Procedures

Pure Function Example

Consider,

    PURE REAL FUNCTION F(x,y) 
     IMPLICIT NONE
     REAL, INTENT(IN) ::  x, y
      F = x*x + y*y + 2*x*y + ASIN(MIN(x/y,y/x))
    END FUNCTION F

Here,

Example of use:

    FORALL (i=1:n,j=1:n) &
     A(i,j) = b(i) + F(1.0*i,1.0*j)

For more information, click here gif


next up previous contents
Next: Pure Subroutine Example Up: Data Parallel Execution Previous: Pure Procedures

Adam Marshall ©University of Liverpool, 1996
Fri Dec 6 18:56:08 GMT 1996
Not for commercial use.