      SUBROUTINE MATMUL(N,M,A,B,C)
C        PURPOSE: COMPUTE C AS PRODUCT OF A AND B
      COMPLEX*16 A(M,M)
      COMPLEX*16 B(M,M)
      COMPLEX*16 C(M,M)
      DO 10 I=1,N
        DO 10 J=1,N
          C(I,J)=(0.0D0,0.0D0)
          DO 10 K=1,N
            C(I,J)=C(I,J)+A(I,K)*B(K,J)
10    CONTINUE
      RETURN
      END


      SUBROUTINE VECMUL(N,M,A,B,C)
C        PURPOSE: COMPUTE VECTOR  C AS PRODUCT OF MATRIX A AND VECTOR B
      COMPLEX*16 A(M,M)
      COMPLEX*16 B(M)
      COMPLEX*16 C(M)
      DO 10 I=1,N
        C(I)=(0.0D0,0.0D0)
        DO 10 J=1,N
          C(I)=C(I)+A(I,J)*B(J)
10    CONTINUE
      RETURN
      END



      SUBROUTINE MULVEC(N,M,A,B,C)
C        PURPOSE: COMPUTE VECTOR  C AS PRODUCT OF MATRIX A AND VECTOR B
      COMPLEX*16 A(M,M)
      COMPLEX*16 B(M)
      COMPLEX*16 C(M)
      DO 10 I=1,N
        C(I)=(0.0D0,0.0D0)
        DO 10 J=1,N
          C(I)=C(I)+A(J,I)*B(J)
10    CONTINUE
      RETURN
      END



      SUBROUTINE SUMABS(N,M,B,S)
C        PURPOSE: COMPUTE SUM OF ABS(B)
      COMPLEX*16 B(M)
      REAL*8 S
      S = 0.0D0
      DO 10 I=1,N
        S=S+ABS(B(I))
10    CONTINUE
      RETURN
      END
