next up previous contents
Next: MIMD Example Up: Pure Procedures Previous: Pure Function Example

 

Pure Subroutine Example

Consider,

    PURE SUBROUTINE G(x,y,z)
     IMPLICIT NONE
     REAL, INTENT(OUT), DIMENSION(:) :: z
     REAL, INTENT(IN),  DIMENSION(:) ::  x, y
     INTEGER i
     INTERFACE
      REAL FUNCTION F(x,y)
       REAL, INTENT(IN) ::  x, y
      END FUNCTION F
     END INTERFACE
!      ...
      FORALL(i=1:SIZE(z)) z(i) = F(x(i),y(i))
    END SUBROUTINE G

Here,

Example of use,

    CALL G(x,y,res)

It is very good form to give an interface.

Now try this question gif

Return to corresponding overview page gif


next up previous contents
Next: MIMD Example Up: Pure Procedures Previous: Pure Function Example

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