      PROGRAM adi
	  PARAMETER (NN=100)
      REAL                  :: a,b,brhs,c
      REAL,DIMENSION(NN,NN) :: beta,psi,zeta,rhs,wspace
!HPF$ PROCESSORS procs(4)
!HPF$ TEMPLATE tplate(NN)
!HPF$ DISTRIBUTE tplate(BLOCK)
!HPF$ ALIGN beta(*,:)   WITH tplate(:)
!HPF$ ALIGN psi(*,:)    WITH tplate(:)
!HPF$ ALIGN zeta(*,:)   WITH tplate(:)
!HPF$ ALIGN rhs(*,:)    WITH tplate(:)
!HPF$ ALIGN wspace(*,:) WITH tplate(:)
!      alpha = 2.0*h2/DT
!      psi (2:NN-1,2:NN-1) = 2.0
      DO iTime = 1,NTime
        forall (i=j1:jN) psi(j1,i) = (rhs(j1,i) - a*psi(1,i))/b
!        forall (i=j1:jN,k=j1:j1) psi(k,i) = (rhs(j1,i) - a*psi(1,i))/b
        DO k=jN,j1,-1
!          forall (i=j1:jN) psi(k,i) = psi(k,i) - wspace(k+1,i)*psi(k+1,i)
        END DO
!        rhs(1,:) = psi(1,:)
      END DO ! iTime
      PRINT *, 'Final Result: for psi()'
!      DO i=1,NN
!        WRITE(UNIT=6,FMT=1002) (psi(i,j),j=1,NN/4)
!      END DO
        WRITE(UNIT=6,FMT=1002) ((psi(i,j),i=1,NN),j=1,NN/4)
      STOP
1002  FORMAT(12F9.3)
      END

