Speed up loglikelihood function.

Switch formula to approximation using Kullback.
Keep for loop for clarity.
Remove safety conditional for speed.
This particular function is run a arge number of times as it's used by
the knn, so that for loop has quite a big impact.