      SUBROUTINE DEIG(IBAL,A,KA,N,WR,WI,IERR)
      DOUBLE PRECISION A(KA,N),WR(N),WI(N)
      LOW=1
      IGH=N
      IF (IBAL.NE.0) CALL DBAL(KA,N,A,LOW,IGH,WR)
      CALL DORTH(KA,N,LOW,IGH,A,WR)
      CALL DHQR(KA,N,LOW,IGH,A,WR,WI,IERR)
      RETURN
      END
