anchor.diff:    implicit none
   
     integer, intent(in)  :: n
  -  real(float64), intent(in)    :: hn1(n)
  -  real(float64), intent(in)    :: hz1(n)
  +  real(float64), intent(in)    :: nk1(n)
  +  real(float64), intent(in)    :: zk1(n)
     real(float64), intent(in)    :: nc
     real(float64),   intent(out) :: estimate
     real(float64),   intent(out) :: err_estimate
     integer :: err
   
  -  call initialize_from_multiplicities(hn1, hz1, nc)
  +  call initialize_from_multiplicities(nk1, zk1, nc)
   
     call compute_integration_range()
   
  
positive.code:   real(float64), intent(out) :: y
    y = trigamma(x)
  end subroutine gamma1
  
  module counts
    use constants
    implicit none
    integer, allocatable :: nk(:)
    integer, allocatable :: zk(:)
    integer :: ndata
    integer :: nbins
    integer :: k1
  contains
    subroutine fit(ar)
      implicit none
      integer, intent(in) :: ar(:)
      integer :: i, j, u
      integer :: x, err
      integer :: xmax
      integer, allocatable :: wrk(:)
  
      xmax = maxval(ar)
      allocate(wrk(0:xmax), stat=err)
      wrk = 0
      u = 0
      do i = 1,ubound(ar, 1)
         x = ar(i)
         if (wrk(x) == 0) then
            u = u + 1
         end if
         wrk(x) = wrk(x) + 1
      end do
  
      if (allocated(nk)) then
         deallocate(nk)
      end if
      if (allocated(zk)) then
         deallocate(zk)
      end if
      allocate(nk(u), zk(u), stat=err)
  
      u = 0
      do i = 0, xmax
         x = wrk(i)
         if (x > 0) then
            u = u + 1
            nk(u) = i
            zk(u) = x
         end if
      end do
  
      ndata = sum(zk * nk)
      nbins = sum(zk)
      k1 = sum(zk, nk>0)
  
      deallocate(wrk)
    end subroutine fit
  end module counts
  
  
negative.code:     real(float64), intent(in) :: alpha
      integer :: i_
  
      h_dir = - sum(zk * (nk + alpha) * digamma(nk + alpha + one))
      h_dir = h_dir / (n_data + alpha * alphabet_size)
      h_dir = h_dir + digamma(n_data + alpha * alphabet_size + one)
  
  