      LOGICAL FUNCTION D4SSOD(E, NX, M, MMAX, KMAX, SLOGN, BETA,
     1   GAMMA, DELTA, F, POW, LDONE, ILDONE, KOPTO)
      INTEGER KMAX, MMAX, NX
      INTEGER M, LDONE, ILDONE, KOPTO
      REAL E(NX, KMAX), F(KMAX), POW(KMAX)
      DOUBLE PRECISION SLOGN(MMAX), BETA, GAMMA, DELTA
      INTEGER JHI, LMJ, MMJ, LDONEO, MIN0, I
      INTEGER J, L, LMAX, LGIVE, JSAVE
      INTEGER TEMP1
      LOGICAL TEMP
      DATA LGIVE/1/
C RETURN LDONE = THE LEVEL WHERE CONVERGENCE IS EXPECTED.
C
C IF M = KOPTO+1, RETURN ILDONE=LDONE.
C IF M > KOPTO+1, DO NOT LET LDONE > ILDONE+1 HAPPEN IN THE FIRST
C KOPTO COLUMNS.
C
C D4SSOD = TRUE IF WILL NOT CONVERGE IN THIS LOZENGE.
C D4SSOD = FALSE IF WILL CONVERGE.
      D4SSOD = .TRUE.
C INITIALLY, FLAG NOT CONVERGENT.
      LDONE = 0
      IF (M .LE. KOPTO+1) GOTO 1
         LMAX = MIN0(ILDONE+LGIVE, MMAX)
         GOTO  2
   1     LMAX = MMAX
   2  IF (M .GE. LMAX) GOTO 10
         TEMP1 = M+1
         DO  9 L = TEMP1, LMAX
            IF (LDONE .GT. 0 .AND. (L .LT. LMAX .OR. M .LE. KOPTO+1))
     1         GOTO  9
C     LDONEO DETERMINES IF WILL CONVERGE IN THE FIRST KOPTO
C     COLUMNS. SET TRUE INITIALLY.
            LDONEO = L
            JHI = MIN0(M-1, KMAX)
C COMPUTE THE FACTORS USED FOR CONVERGENCE CHECK.
            DO  3 J = 1, JHI
               MMJ = M-J
               LMJ = L-J
               F(J) = POW(J)*GAMMA*((SLOGN(M)-SLOGN(L))-(SLOGN(MMJ)-
     1            SLOGN(LMJ)))
   3           CONTINUE
C SEE IF THE I-TH VARIABLE WILL CONVERGE AT M=L.
            DO  7 I = 1, NX
C FLAG NOT CONVERGENT.
               JSAVE = 0
C CHECK EACH COLUMN FOR CONVERGENCE.
               DO  5 J = 1, JHI
                  IF (E(I, J) .LT. F(J)) GOTO 4
                     JSAVE = J
                     GOTO  6
   4              CONTINUE
   5              CONTINUE
   6           IF (JSAVE .EQ. 0) GOTO  8
C NO CONVERGENCE.
               IF (JSAVE .GT. KOPTO) LDONEO = 0
C NO CONVERGENCE IN
C COLUMNS 1,...,KOPTO.
   7           CONTINUE
   8        IF (JSAVE .EQ. 0) GOTO  9
C NO CONVERGENCE, TRY THE NEXT L.
            IF (LDONE .EQ. 0) LDONE = L
   9        CONTINUE
  10  TEMP = LDONE .NE. 0
      IF (TEMP) TEMP = LDONEO .NE. 0
      IF (.NOT. TEMP) GOTO 11
         IF (M .EQ. KOPTO+1) ILDONE = LDONE
C WILL CONVERGE AT M = LDONE.
         D4SSOD = .FALSE.
  11  RETURN
      END
