anchor.diff:      integer(kind=kint), intent(out) :: perm(:), iperm(:)
       call hecmw_matrix_ordering_CM(N, indexL, itemL, indexU, itemU, perm, iperm)
       call reverse_ordering(N, perm, iperm)
  +    if (DEBUG > 0) then
  +      call write_nonzero_profile(N, indexL, itemL, indexU, itemU, perm, iperm)
  +      call write_perm(N, perm, iperm)
  +    endif
     end subroutine hecmw_matrix_ordering_RCM
   
  -  subroutine ordering_CM_inner(N, indexL, itemL, indexU, itemU, nstart, &
  +  subroutine ordering_CM_inner(N, indexL, itemL, indexU, itemU, degs, nstart, &
         nlevel, lv_index, lv_item)
       implicit none
       integer(kind=kint), intent(in) :: N
       integer(kind=kint), intent(in) :: indexL(0:), indexU(0:)
       integer(kind=kint), intent(in) :: itemL(:), itemU(:)
  +    integer(kind=kint), intent(in) :: degs(:)
       integer(kind=kint), intent(in) :: nstart
       integer(kind=kint), intent(out) :: nlevel
       integer(kind=kint), intent(out) :: lv_index(0:)
  
positive.code:             cnt = cnt + 1
              cntall = cntall + 1
              lv_item(cntall) = knode
              if (cntall == N) exit PRLV
            end if
          end do
          do k = indexU(jnode-1)+1, indexU(jnode)
  
negative.code:     integer(kind=kint), parameter :: NMINMAX = 5
      integer(kind=kint) :: i, nmin
      integer(kind=kint) :: mins(NMINMAX)
      integer(kind=kint), allocatable :: degs(:)
      integer(kind=kint), allocatable :: nlevel(:)
      integer(kind=kint), allocatable :: lv_index(:,:), lv_item(:,:)
      integer(kind=kint) :: nlevel_max, max_id
      allocate(degs(N))
      call count_degrees(N, indexL, indexU, itemU, degs)
      call find_minimum_degrees(N, degs, NMINMAX, nmin, mins)
      allocate(nlevel(nmin), lv_index(0:N,nmin), lv_item(N,nmin))
      ! perform CM ordering starting from each minimum degree node
      !$omp parallel default(none),private(i), &
        !$omp&  shared(nmin,N,indexL,itemL,indexU,itemU,degs,mins,nlevel,lv_index,lv_item)
      !$omp do
      do i=1,nmin
        call ordering_CM_inner(N, indexL, itemL, indexU, itemU, degs, mins(i), &
          nlevel(i), lv_index(:,i), lv_item(:,i))
        if (DEBUG > 0) write(*,*) 'DEBUG:: hecmw_matrix_ordering_CM: i, nstart, nlevel = ', i, mins(i), nlevel(i)
      end do
      !$omp end do
      !$omp end parallel
      deallocate(degs)
      ! choose CM ordering with maximum nlevel
      nlevel_max = nlevel(1)
      max_id = 1
  