anchor.diff:      integer(int32)              :: i,k,ni
       integer(int32)              :: err
       integer(int32)              :: nmax
  -    integer(int32), allocatable :: multiplicities(:)
  +    integer(int32), allocatable :: multi0(:)
   
       alphabet_size = nc 
       ndata = sum(counts)
  
positive.code:   integer(int32) :: i
    real(real64)   :: ni,ndata
    integer(int32)              :: mi,nmax,err
    integer(int32), allocatable :: multiplicities(:)
  
    !! this is the old 'standard' implementation.
    !! the code using multiplicities is faster
  
negative.code:     ! nmax is the largest number of samples in a bin
      nbins = size(counts)
      nmax = maxval(counts)
      allocate(multi0(nmax+1),stat=err)
      multi0 = 0
      multi0(1) = alphabet_size - nbins
      do i = 1,nbins
         ni = counts(i)
         multi0(ni+1) = multi0(ni+1) + 1
      end do
  
       ! working arrays on bins visited at leat once 
      nmulti = count(multi0 > 0) 
      allocate(multi_x(nmulti),stat=err)
      allocate(multi(nmulti),stat=err)
  
      k = 0
      do i = 1,nmax+1
         if (multi0(i) > 0) then 
            k = k + 1
            multi_x(k) = i
            multi(k) = multi0(i)
         end if
      end do
      deallocate(multi0)
      
    end subroutine compute_multiplicities
  
  