KLdivergence and JKdivergence, not yet c++11 style