anchor.diff:            RETURN
           endif
           
  +        sumx = 0
  +        sump = 0.0
           do i=1,k
             if ((x(j,i) .LT. 0) .OR. (p_tmp(i) .LT. 1E-10)) then
               like = -infinity
  
positive.code: 
  c Multinomial log-likelihood function     
  c Updated 12/02/2007 DH. N-D still buggy.
  
  cf2py integer dimension(nx,k),intent(in) :: x
  cf2py integer dimension(nn), intent(in) :: n
  
negative.code:           endif
            
            like = like + x(j,i)*dlog(p_tmp(i)) - factln(x(j,i))
            
            sumx = sumx + x(j,i)
            sump = sump + p_tmp(i)
  
          enddo
  c This is to account for the kth term that is not passed!
          xk = n_tmp - sumx
          pk = 1.0 - sump
          if ((xk .LT. 0) .OR. (pk .LT. 0)) then
            like = -infinity
            RETURN
          endif
          like = like + (xk) * dlog(pk) 
          like = like - factln(xk)
          
          like = like + factln(n_tmp)
        enddo
        RETURN
  