anchor.diff:      Nch(l) = Nch(l) - 1
       Nch(1) = -1
       DO ic = 2, Nstop - 1
  -       CALL S2UM(ic,Xlnzr,Colno,Zln,Diag,Nch,Parent,Temp,Indx)
  +      CALL S2UM(ic,Xlnzr,Colno,Zln,Diag,Nch,Parent,Temp,Indx)
       ENDDO
       !
       ! phase II
       !
       CALL PTIME(t2)
       DO ic = Nstop, Neqns
  -       CALL S2UM1(ic,Xlnzr,Colno,Zln,Temp,Indx)
  +      CALL S2UM1(ic,Xlnzr,Colno,Zln,Temp,Indx)
       ENDDO
       !
       ! phase III
  
positive.code: 
      IF ( Nhdsze<=0 ) RETURN
      DO inhd = 1, Nhdsze
         root = Nbrhd(inhd)
         Marker(root) = 0
      ENDDO
      DO inhd = 1, Nhdsze
         root = Nbrhd(inhd)
         Marker(root) = -1
         rchsze = 0
         novrlp = 0
         deg1 = 0
         DO
            jstrt = Xadj(root)
            jstop = Xadj(root+1) - 1
            DO j = jstrt, jstop
               nabor = Adjncy(j)
               root = -nabor
               IF ( nabor<0 ) GOTO 50
               IF ( nabor==0 ) EXIT
               mark = Marker(nabor)
  
               IF ( mark>=0 ) THEN
                  IF ( mark<=0 ) THEN
                     rchsze = rchsze + 1
                     Rchset(rchsze) = nabor
                     deg1 = deg1 + Qsize(nabor)
                     Marker(nabor) = 1
                  ELSEIF ( mark<=1 ) THEN
                     novrlp = novrlp + 1
                     Ovrlp(novrlp) = nabor
                     Marker(nabor) = 2
                  ENDIF
               ENDIF
            ENDDO
            EXIT
  50     ENDDO
         head = 0
         mrgsze = 0
         DO iov = 1, novrlp
            node = Ovrlp(iov)
            jstrt = Xadj(node)
            jstop = Xadj(node+1) - 1
            DO j = jstrt, jstop
               nabor = Adjncy(j)
               IF ( Marker(nabor)==0 ) THEN
                  Marker(node) = 1
                  GOTO 100
               ENDIF
            ENDDO
            mrgsze = mrgsze + Qsize(node)
            Marker(node) = -1
            lnode = node
            DO
               link = Qlink(lnode)
               IF ( link<=0 ) THEN
                  Qlink(lnode) = head
                  head = node
                  EXIT
               ELSE
                  lnode = link
               ENDIF
            ENDDO
  100    ENDDO
         IF ( head>0 ) THEN
            Qsize(head) = mrgsze
            Deg(head) = Deg0 + deg1 - 1
            Marker(head) = 2
         ENDIF
         root = Nbrhd(inhd)
         Marker(root) = 0
         IF ( rchsze>0 ) THEN
            DO irch = 1, rchsze
               node = Rchset(irch)
               Marker(node) = 0
            ENDDO
         ENDIF
      ENDDO
    END SUBROUTINE QMDMRG
  
  
negative.code:     CALL QMDRCH(node,Xadj,Adjncy,Deg,Marker,rchsze,Rchset,nhdsze,Nbrhd)
      nxnode = node
      DO
        num = num + 1
        np = Invp(nxnode)
        ip = Perm(num)
        Perm(np) = ip
        Invp(ip) = np
        Perm(num) = nxnode
        Invp(nxnode) = num
        Deg(nxnode) = -1
        nxnode = Qlink(nxnode)
        IF ( nxnode<=0 ) THEN
          IF ( rchsze>0 ) THEN
            CALL QMDUPD(Xadj,Adjncy,rchsze,Rchset,Deg,Qsize,Qlink,Marker,Rchset(rchsze+1),Nbrhd(nhdsze+1))
            Marker(node) = 0
            DO irch = 1, rchsze
              inode = Rchset(irch)
              IF ( Marker(inode)>=0 ) THEN
                Marker(inode) = 0
                ndeg = Deg(inode)
                IF ( ndeg<mindeg ) mindeg = ndeg
                IF ( ndeg<=thresh ) THEN
                  mindeg = thresh
                  thresh = ndeg
                  search = Invp(inode)
                ENDIF
              ENDIF
            ENDDO
            IF ( nhdsze>0 ) CALL QMDOT(node,Xadj,Adjncy,Marker,rchsze,Rchset,Nbrhd)
          ENDIF
          IF ( num>=Neqns ) EXIT
          GOTO 200
        ENDIF
      ENDDO
    END SUBROUTINE GENQMD
  
    !======================================================================!
    !> @brief GENPAQ
    !======================================================================!
    SUBROUTINE GENPAQ(Xadj,Adjncy,Invp,Iperm,Parent,Neqns,Ancstr)
      IMPLICIT NONE
      !------
      INTEGER, INTENT(IN):: Neqns
      INTEGER, INTENT(IN):: Xadj(*)
      INTEGER, INTENT(IN):: Adjncy(*)
      INTEGER, INTENT(IN):: Invp(*)
      INTEGER, INTENT(IN):: Iperm(*)
      INTEGER, INTENT(OUT):: Parent(*)
      INTEGER, INTENT(OUT):: Ancstr(*)
      !------
      INTEGER:: i
      INTEGER:: IDBg1
      INTEGER:: ip
      INTEGER:: it
      INTEGER:: k
      INTEGER:: l
      COMMON /DEBUG / IDBg1
  
      DO i = 1, Neqns
        Parent(i) = 0
        Ancstr(i) = 0
        ip = Iperm(i)
        DO k = Xadj(ip), Xadj(ip+1) - 1
          l = Invp(Adjncy(k))
          IF ( l<i ) THEN
            DO WHILE ( Ancstr(l)/=0 )
              IF ( Ancstr(l)==i ) GOTO 50
              it = Ancstr(l)
              Ancstr(l) = i
              l = it
            ENDDO
            Ancstr(l) = i
            Parent(l) = i
          ENDIF
  50    ENDDO
      ENDDO
      DO i = 1, Neqns
        IF ( Parent(i)==0 ) Parent(i) = Neqns + 1
      ENDDO
      Parent(Neqns+1) = 0
  
      IF ( IDBg1/=0 ) THEN
        WRITE (6,"(' parent')")
        WRITE (6,"(2I6)") (i,Parent(i),i=1,Neqns)
      ENDIF
    END SUBROUTINE GENPAQ
  
    !======================================================================!
    !> @brief GENBTQ
    !======================================================================!
    SUBROUTINE GENBTQ(Invp,Parent,Btree,Zpiv,Izz,Neqns)
      IMPLICIT NONE
      !------
      INTEGER, INTENT(IN):: Neqns
      INTEGER, INTENT(IN):: Parent(*)
      INTEGER, INTENT(IN):: Invp(*)
      INTEGER, INTENT(IN):: Zpiv(*)
      INTEGER, INTENT(OUT):: Btree(2,*)
      !------
      INTEGER:: i
      INTEGER:: ib
      INTEGER:: IDBg1
      INTEGER:: inext
      INTEGER:: ip
      INTEGER:: Izz
      COMMON /DEBUG / IDBg1
  
      Btree(1,1:Neqns + 1) = 0
      Btree(2,1:Neqns + 1) = 0
      DO i = 1, Neqns + 1
        ip = Parent(i)
        IF ( ip>0 ) THEN
          ib = Btree(1,ip)
          IF ( ib==0 ) THEN
            Btree(1,ip) = i
          ELSE
            DO
              inext = Btree(2,ib)
              IF ( inext==0 ) THEN
                Btree(2,ib) = i
              ELSE
                ib = inext
                CYCLE
              ENDIF
              EXIT
            ENDDO
          ENDIF
        ENDIF
      ENDDO
      !
      ! find zeropivot
      !
      DO i = 1, Neqns
        IF ( Zpiv(i)/=0 ) THEN
          IF ( Btree(1,Invp(i))==0 ) THEN
            Izz = i
            GOTO 100
          ENDIF
        ENDIF
      ENDDO
      Izz = 0
  
  100 CONTINUE
      IF ( IDBg1/=0 ) THEN
        WRITE (6,"(' binary tree')")
        WRITE (6,"(i6,'(',2I6,')')") (i,Btree(1,i),Btree(2,i),i=1,Neqns)
        WRITE (6,"(' the first zero pivot is ',i4)") Izz
      ENDIF
    END SUBROUTINE GENBTQ
  
    !======================================================================!
    !> @brief POSORD
    !======================================================================!
    SUBROUTINE POSORD(Parent,Btree,Invp,Iperm,Pordr,Nch,Neqns,Iw,Qarent,Mch)
      IMPLICIT NONE
      !------
      INTEGER, INTENT(IN):: Neqns
      INTEGER, INTENT(IN):: Btree(2,*)
      INTEGER, INTENT(IN):: Qarent(*)
      INTEGER, INTENT(OUT):: Parent(*)
      INTEGER, INTENT(OUT):: Pordr(*)
      INTEGER, INTENT(OUT):: Nch(*)
      INTEGER, INTENT(OUT):: Invp(*)
      INTEGER, INTENT(OUT):: Iperm(*)
      INTEGER, INTENT(OUT):: Iw(*)
      INTEGER, INTENT(OUT):: Mch(0:Neqns+1)
      !------
      INTEGER:: i
      INTEGER:: IDBg1
      INTEGER:: ii
      INTEGER:: invpos
      INTEGER:: ipinv
      INTEGER:: joc
      INTEGER:: l
      INTEGER:: locc
      INTEGER:: locp
      COMMON /DEBUG / IDBg1
  
      Mch(1:Neqns) = 0
      Pordr(1:Neqns) = 0
      l = 1
      locc = Neqns + 1
      DO
        joc = locc
        locc = Btree(1,joc)
        IF ( locc==0 ) THEN
          locp = Qarent(joc)
          Mch(locp) = Mch(locp) + 1
          DO
            Pordr(joc) = l
            IF ( l>=Neqns ) THEN
              DO i = 1, Neqns
                ipinv = Pordr(Invp(i))
                Invp(i) = ipinv
                Iperm(ipinv) = i
                Iw(Pordr(i)) = i
              ENDDO
              DO i = 1, Neqns
                invpos = Iw(i)
                Nch(i) = Mch(invpos)
                ii = Qarent(invpos)
                IF ( ii>0 .AND. ii<=Neqns ) THEN
                  Parent(i) = Pordr(ii)
                ELSE
                  Parent(i) = Qarent(invpos)
                ENDIF
              ENDDO
              IF ( IDBg1/=0 ) THEN
                WRITE (6,"(' post order')")
                WRITE (6,"(10I6)") (Pordr(i),i=1,Neqns)
                WRITE (6,"(/' invp ')")
                WRITE (6,"(/' parent')")
                WRITE (6,"(10I6)") (Parent(i),i=1,Neqns)
                WRITE (6,"(10I6)") (Invp(i),i=1,Neqns)
                WRITE (6,"(/' iperm ')")
                WRITE (6,"(10I6)") (Iperm(i),i=1,Neqns)
                WRITE (6,"(' nch')")
                WRITE (6,"(10I6)") (Nch(i),i=1,Neqns)
              ENDIF
              RETURN
            ELSE
              l = l + 1
              locc = Btree(2,joc)
              IF ( locc/=0 ) EXIT
              joc = Qarent(joc)
              locp = Qarent(joc)
              Mch(locp) = Mch(locp) + Mch(joc) + 1
            ENDIF
          ENDDO
        ENDIF
      ENDDO
    END SUBROUTINE POSORD
  
    !======================================================================!
    !> @brief GNLEAF
  