kl divergence and EMD function done