      SUBROUTINE DET6(A,D6)
      COMPLEX A(6,6),B(5,5),D6,D
      D6=(0.,0.)
      DO 10 J=1,6
      IF(A(1,J).NE.(0.,0.)) THEN
      CALL SET(A,B,1,J,6)
      CALL DET5(B,D)
      C=(-1)**(J+1)
      D6=D6+CMPLX(C,0.)*D*A(1,J)
      ENDIF
  10  CONTINUE
      RETURN
      END
C
C     *********************************************************
C
      SUBROUTINE DET5(A,D5)
      COMPLEX A(5,5),B(4,4),D5,D
      D5=(0.,0.)
      DO 10 J=1,5
      IF(A(1,J).NE.(0.,0.)) THEN
      CALL SET(A,B,1,J,5)
      CALL DET4(B,D)
      C=(-1)**(J+1)
      D5=D5+CMPLX(C,0.)*D*A(1,J)
      ENDIF
  10  CONTINUE
      RETURN
      END
C
C     ***********************************************************
C
      SUBROUTINE DET4(A,D4)
      COMPLEX A(4,4),B(3,3),D4,D
      D4=(0.,0.)
      DO 10 J=1,4
      IF(A(1,J).NE.(0.,0.)) THEN
      CALL SET(A,B,1,J,4)
      CALL DET3(B,D)
      C=(-1)**(J+1)
      D4=D4+CMPLX(C,0.)*D*A(1,J)
      ENDIF
  10  CONTINUE
      RETURN
      END
C
C     **********************************************************
C
      SUBROUTINE DET3(A,D3)
      COMPLEX A(3,3),D3
      D3=A(1,1)*(A(2,2)*A(3,3)-A(2,3)*A(3,2))
     1+  A(1,2)*(A(2,3)*A(3,1)-A(2,1)*A(3,3))
     2+  A(1,3)*(A(2,1)*A(3,2)-A(2,2)*A(3,1))
      RETURN
      END
C
C     ************************************************************
C
      SUBROUTINE SET(A,B,I,J,K)
      COMPLEX A(K,K),B(K-1,K-1)
      IFL=0
      JFL=0
      DO 20 I1=1,K
      IF(I1.EQ.I) THEN
      IFL=1
      GOTO 20
      ENDIF
      DO 10 J1=1,K
      IF(J1.EQ.J) THEN
      JFL=1
      GOTO 10
      ENDIF
      IF(IFL.EQ.0.AND.JFL.EQ.0) THEN
      B(I1,J1)=A(I1,J1)
      ELSE IF(IFL.EQ.0.AND.JFL.EQ.1) THEN
      B(I1,J1-1)=A(I1,J1)
      ELSE IF(IFL.EQ.1.AND.JFL.EQ.0) THEN
      B(I1-1,J1)=A(I1,J1)
      ELSE
      B(I1-1,J1-1)=A(I1,J1)
      ENDIF
  10  CONTINUE
      JFL=0
  20  CONTINUE
      RETURN
      END
