anchor.diff:    implicit none
   
     integer(int32), intent(in)  :: n
  -  integer(int32), intent(in)  :: hist(n)
  +  integer(int32), intent(in)  :: counts(n)
     integer(int32), intent(in)  :: nc
     real(real64),   intent(in)  :: alpha
     real(real64),   intent(out) :: estimate
  
positive.code: 
  contains
  
    subroutine dirichlet_initialize(nc,hist)
  
      integer(int32), intent(in) :: nc
      integer(int32), intent(in) :: hist(:)
      integer(int32)              :: nbins
      integer(int32)              :: i,k,ni
      integer(int32)              :: err
  
negative.code:     integer(int32), allocatable :: multiplicities(:)
  
      alphabet_size = nc 
      ndata = sum(counts)
  
      ! compute multiplicities 
      ! nmax is the largest number of samples in a bin
      nbins = size(counts)
      nmax = maxval(counts)
      allocate(multiplicities(nmax+1),stat=err)
      multiplicities = 0
      multiplicities(1) = alphabet_size - nbins
      do i = 1,nbins
         ni = counts(i)
         multiplicities(ni+1) = multiplicities(ni+1) + 1
      end do
  
  