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


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

Adam Marshall ©University of Liverpool, 1996
Fri Dec 6 15:03:35 GMT 1996
Not for commercial use.