      SUBROUTINE MT (A,B,W,M,N,K,PU,ER)
C     -------
      INTEGER ER, K, PU, M, N
      DOUBLE PRECISION A(N,N), B(M,M), W(N)
C
      INTEGER I,II,J,JJ,JS,KN,L
      DOUBLE PRECISION ZR
      PARAMETER ( ZR = 0.0D0 )
C     -------
      ER = 0
      IF (M.LT.1.OR.N.LT.1)  GO TO 920
      IF (K.LT.1)            GO TO 920
      KN   = K+N-1
      IF (KN.GT.M)           GO TO 920

      DO 120 JJ=K,M
         DO 70 I=1,N
            II    = K
            W(I) = ZR
            DO 45 L=1,N
               W(I) = W(I) + A(L,I)*B(II,JJ)
               II    = II+1
   45       CONTINUE
   70    CONTINUE
         II = K
         DO 95 I=1,N
            B(II,JJ) = W(I)
            IF (JJ.GT.KN)    B(JJ,II) = W(I)
            II       = II+1
   95    CONTINUE
  120 CONTINUE
C     ----------
      DO 220 II=1,KN
         JS = 1
         IF (II.GT.K)  JS = II-K+1
         DO 170 J=JS,N
            JJ    = K
            W(J) = ZR
            DO 145 L=1,N
               W(J) = W(J) + B(II,JJ)*A(L,J)
               JJ    = JJ+1
  145       CONTINUE
  170    CONTINUE
         JJ = K
         IF (II.GT.K)  JJ=II
         DO 195 J=JS,N
            B(II,JJ) = W(J)
            IF (II.LT.K)  B(JJ,II) = W(J)
            JJ       = JJ+1
  195    CONTINUE
  220 CONTINUE
      DO 270 II=K,KN
         DO 245 JJ=II,KN
            B(JJ,II) = B(II,JJ)
  245    CONTINUE
  270 CONTINUE
C
      GO TO 1000
C -------------------ERROR
  920 ER =-1
      IF (PU.GT.0)     WRITE (PU,6900) M,N,K
C ----------------------------------------------------------------------
 1000 RETURN