For each of the following examples state if the procedure Well_Izzit is PURE or not. In each case explain how you came to your decisions.
FUNCTION Well_Izzit(A,B) REAL, DIMENSION(:,:), INTENT(IN) :: A, B REAL, DIMENSION(SIZE(A,1),SIZE(A,2)) :: Well_Izzit Well_Izzit = A + B END FUNCTION
SUBROUTINE Well_Izzit(A,B,Rez) REAL, DIMENSION(:,:), INTENT(IN) :: A, B REAL, DIMENSION(:,:), INTENT(INOUT) :: Rez Rez = A + B + Rez END SUBROUTINE
MODULE Moddie INTEGER, DIMENSION(2), SAVE :: x,y END MODULE FUNCTION Well_Izzit(A,B) USE Moddie REAL, DIMENSION(:,:), INTENT(IN) :: A, B REAL, DIMENSION(SIZE(A,1),SIZE(A,2)) :: Well_Izzit x = MAXLOC(A) y = MAXLOC(B) Well_Izzit = (A + B)*(A(x(1),x(2))+B(y(1),y(2))) END FUNCTION
SUBROUTINE Well_Izzit(A,B,Rez) REAL, DIMENSION(:,:), INTENT(IN) :: A, B REAL, DIMENSION(:,:), ALLOCATABLE :: C REAL, DIMENSION(:,:), INTENT(INOUT) :: Rez ALLOCATE(C(SIZE(A,1),SIZE(A,2))) C = A + B Rez = Transpose(C)*A*B DEALLOCATE(C) END SUBROUTINE
FUNCTION Well_Izzit(A,B) REAL, DIMENSION(:,:) :: A, B REAL, DIMENSION(SIZE(A,1),SIZE(A,2)) :: Well_Izzit Well_Izzit = A + B END FUNCTION