C     APPENDIX E   SAMPLE PROBLEM 1
C     MATRIX ARITHMETIC
C
      DOUBLE PRECISION A(7,8), VECTOR(7), B(7,7)
      DOUBLE PRECISION AA(56)
      EQUIVALENCE (A, AA), (AA(50), VECTOR(1))
C
      LOGICAL DONE
      DONE = .FALSE.
C
      DO 1 I = 1,7
          DO 101 J = 1,7
              B(I,J) = 1./(I+J-1.)
              A(I,J) = B(I,J)
101       CONTINUE
1     CONTINUE
C
      PRINT 13
13    FORMAT('HILBERT MATRIX'/)
      PRINT 2, ((A(I,J), J = 1,7), I = 1,7)
2     FORMAT(1X,7E14.7)
      PRINT 15
15    FORMAT(/'INVERSE'/)
C
10    DO 6 K = 1,7
          VECTOR(1) = 1.
C
          DO 3 I = 2,7
              VECTOR(I) = 0.
3         CONTINUE
C
          DO 4 J = 2,8
              A(1,J) = A(1,J)/A(1,1)
4         CONTINUE
C
          DO 5 I = 1,55
              AA(I) = AA(I+1)
5         CONTINUE
C
          DO 602 I = 1,6
              AA(56) = A(I,1)
C
              DO 601 J = 1,7
                  A(I,J) = A(I,J+1)-AA(56)*A(7,J)
601           CONTINUE
602       CONTINUE
6     CONTINUE
C
      PRINT 2, ((A(I,J), J = 1,7), I = 1,7)
C
      IF (DONE) GO TO 12
      DONE = .NOT. DONE
C
11    PRINT 16
16    FORMAT(/'MATRIX PRODUCT'/)
C
      DO 9 K = 1,7
          DO 8 I = 1,7
              VECTOR(I) = 0.
              DO 801 J = 1,7
                  VECTOR(I) = VECTOR(I)+A(I,J)*B(J,K)
801           CONTINUE   
8         CONTINUE
C
          PRINT 18,VECTOR
9     CONTINUE
18    FORMAT(1X,7F14.8)
      PRINT 17
17    FORMAT(/'TWICE INVERTED'/)
C
      GO TO 10
      
12    PRINT 7
7     FORMAT(/)
C
      STOP 111
      END 