next up previous contents
Next: Pure Subroutine Example Up: Pure Procedures 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)

Although not mandatory, an explicit interface should be given so that the compiler can witness that the procedure is indeed pure.

Return to corresponding overview page gif


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

©University of Liverpool, 1997
Wed May 28 20:20:27 BST 1997
Not for commercial use.