      SUBROUTINE R8D(N,K,T,ITER,B,Z,ZZ,CSET,WSET,CRUN,WRUN,IER)
c
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c
c    This is the output routine for the large sparse matrix version
c    of Benchmark 8. 
c
c    This will need to be modified to contain the particular 
c    configuration information requested.
c
c    Parameters:
c    
c     Provided by calling routine:
c      N     =  Size of the A matrices
c      K     =  Number of A matrices
c      T     =  Length of B array - 1 for last iteration
c      ITER  =  The number of iterations of this benchmark
c      B     =  Sequences of steps on a maximal path
c      Z     =  Probability of this best path
c      ZZ    =  Expected probability of the best path
c      CSET  =  Total setup time for all iterations (CPU)
c      WSET  =  Total setup time for all iterations (Wall Clock)
c      CRUN  =  Total run time for all iterations (CPU)
c      WRUN  =  Total run time for all iterations (Wall Clock)
c      IER   =  Error flag array
c                 IER(1) = Iteration on which error occurred
c                 IER(2) = Flag indicating type of error
c                 IER(3) = Step on which error type 2 occurred
c 
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c
      IMPLICIT INTEGER (A-Z)
c     
      INTEGER B(0:T)
      INTEGER IER(3)
      INTEGER N,K,T,ITER
      REAL CSET,WSET,CRUN,WRUN,Z,ZZ
      CHARACTER(LEN=9) DATECHAR
c
C--CVS variable declaration
      TYPE CVS
      sequence
      character( 160 )     string
      integer              stringend
      END TYPE CVS       
C--CVS initilaize variables    
      TYPE( CVS ),save :: CVS_INFO =
     $  CVS("BMARKGRP $Date: 2005/01/07 23:07:10 $ $Revision: 1.2 $" //
     $      "$RCSfile: r8d.f,v $ $Name: rel_5 $", 0)


c      
      PRINT 5
   5  FORMAT('Benchmark #8d -- Dynamic Program ',/,
     $  'Small Dense Matrices',/)
c
      CALL DATE_AND_TIME(DATECHAR)
      PRINT 7, DATECHAR
   7  FORMAT('Date: ',A10,/)
c
      PRINT 15,N,K,ITER
  15  FORMAT('Matrix size = ',I15,/,
     $  'Number of matrices   =  ',I5,/,
     $  'Number of iterations =  ',I5,/)
c
      PRINT 25, CSET, WSET
  25  FORMAT('Total time for set up: ',/,
     $  'time: Setup CPU        = ',F12.4,' seconds',/,
     $  'time: Setup Wall_Clock = ',F12.4,' seconds',/)
c
      PRINT 35, CRUN, WRUN
  35  FORMAT('Total time to run: ',/,
     $  'time:  Run CPU        = ',F12.4,' seconds',/,
     $  'time:  Run Wall_Clock = ',F12.4,' seconds',/)
c
c  If no errors then print out stats from final iteration
      IF (IER(2) .EQ. 0) THEN
        PRINT 40, T,Z
  40    FORMAT('Statistics on final iteration: ',/,
     $    '  Length of solution on last iteration  = ',I10,/,
     $    '  Lg probability of path = ',/,'data:          ',F16.4,/)
        PRINT 45
  45    FORMAT('A few of the steps are:')
        PRINT 55,(B(I),I=0,19)
  55    FORMAT('Steps 0 through 19',/,'data: '20I4,/)
        J=T/2
        JJ=J+19
        PRINT 65,J,JJ,(B(I),I=J,JJ)
  65    FORMAT('Steps ',I7,' through ',I7,/,'data: '20I4,/)
        J=T-19
        JJ=T
        PRINT 65,J,JJ,(B(I),I=J,JJ)
        PRINT 67
  67    FORMAT(//' *** NO ERRORS DETECTED *** ',//)
        RETURN
      ENDIF
c
c  Error occurred
      IF (IER(2) .GT. 0) THEN
        PRINT 70, IER(1)
  70    FORMAT(/,' *** Error detected on iteration ',I5, ' *** ',/)
        IF (IER(2) .EQ. 1) THEN
          PRINT 75, Z, ZZ, ABS(Z/ZZ-1)
  75      FORMAT(' Error: Path probability = ',E16.6,/,
     $           ' Expected ',E16.6,'  Difference = ',E16.6,//)
          RETURN
        ELSE
          PRINT 80, IER(3)
  80      FORMAT(' Error in described path.',/,
     $           ' Invalid transition on step ',I7,//)
          RETURN
          ENDIF
      ENDIF
      END
