      PROGRAM PROB11
C
C     PROBLEM 11
C
C  REFERENCE:  PROBLEMS TO TEST PARALLEL AND VECTOR LANGUAGES
C              CSD-TR 516, COMPUTER SCIENCE, PURDUE UNIVERSITY
C              JOHN R. RICE, MAY 1, 1985
C
C              REVISED BY JOHN R. RICE AND J. JING, OCT. 1, 1990
C
C
C      *************************************************
C      *      Adapted for FORTRAN D benchmarking       *
C      *    by  T. HAUPT  (haupt@sccs.npac.syr.edu)    *
C      *                                               *
C      *    Northeast Parallel Architectures Center    *
C      *   at Syracuse University, Syracuse, NY, USA   *
C      *************************************************
C
C
C       VERSION F90D-1.00
C       ==================================================
C
      PARAMETER (NPROC0=4)
      PARAMETER (NFMOM=4)
      PARAMETER (N=16384)

      REAL TFMOM(NFMOM)
      REAL PI
      DATA PI / 3.1415926 /
      REAL, ARRAY(N)    :: DATA,COSWT

C$      DECOMPOSITION A(16384)
C$      DISTRIBUTE A(CYCLIC)
C$      ALIGN DATA(i) WITH A(i)
C$      ALIGN COSWT(i) WITH A(I)


      WRITE(6,*) 'enter the number of processors'
      READ(5,*) nproc0

      DATA=-[1:NK]*10.0 + 1080.0*SIN(1+[1:NK]*0.0623)
      DATA = AMAX1(0.0,AMIN1(1000.,DATA))
      DATA = ALOG(DATA+1.0)

      TFMOM(1) = SUM(DATA)/NK

      DO K = 2, NFMOM
      COSWT = COS(PI*[1:NK]*(K-1)/(NK+1)) * DATA
      TFMOM(K) = SUM(COSWT)/NK
      ENDDO


      PRINT *,'PROBLEM 11 WITH N =',NK
      DO I=1,NFMOM
      PRINT *,'MOMENT ',I,' = ',TFMOM(I)
      ENDDO

      STOP
      END








