      PROGRAM JACOBI
      PARAMETER (N=1024)
      REAL A(N,N), B(N,N)

      DO I=1, N
         DO J=1, N
            IF ((I .EQ. 1) .OR. (I .EQ. N) 
     &           .OR. (J .EQ. 1) .OR. (J .EQ. N)) THEN
               A(I,J)=1
            ELSE
               A(I,J)=0
            ENDIF
         ENDDO
      ENDDO

      DO ITER =1, 100
         IF (ITER .EQ. 11) THEN
            CALL AdlibClockStart()
         ENDIF

! for poor Solaris 2.5.1
!         DO J=1, N
!            DO I=1, N
!               B(I,J)=A(I,J)
!            ENDDO
!         ENDDO

         DO J=2, N-1
            DO I=2, N-1
               B(I,J)=A(I,J)
            ENDDO
         ENDDO

         DO J=2, N-1
            DO I=2, N-1
               A(I,J)=(B(I-1,J)+B(I+1,J)+B(I,J-1)+B(I,J+1))*0.25
            ENDDO
         ENDDO

      ENDDO

      CALL AdlibClockStop()

!      PRINT 111, ((A(I,J),I=1,N), J=1,N)
111   FORMAT(1x,f17.2)
      
      END

