From d9788a71c07e8395d58cb8d28901b0ebc117ffb6 Mon Sep 17 00:00:00 2001 From: toni Date: Fri, 24 Mar 2017 17:37:05 +0100 Subject: [PATCH] fixed bugs in jensenshannon.h --- math/divergence/JensenShannon.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/math/divergence/JensenShannon.h b/math/divergence/JensenShannon.h index a76686d..5c9bbb3 100644 --- a/math/divergence/JensenShannon.h +++ b/math/divergence/JensenShannon.h @@ -11,6 +11,7 @@ namespace Divergence { template class JensenShannon { +public: /** Calculate the Jensen Shannon Divergece from a set of sample densities * Info: https://en.wikipedia.org/wiki/Jensen–Shannon_divergence * @param P is the vector containing the densities of a set of samples @@ -19,7 +20,7 @@ template class JensenShannon { static inline Scalar getGeneralFromSamples(Eigen::VectorXd P, Eigen::VectorXd Q, LOGMODE mode){ Eigen::VectorXd M = 0.5 * (P + Q); - return (0.5 * KullbackLeibler::getGeneralFromSamples(P, M, mode)) + (0.5 * KullbackLeibler::getGeneralFromSamples(Q, M, mode)); + return (0.5 * KullbackLeibler::getGeneralFromSamples(P, M, mode)) + (0.5 * KullbackLeibler::getGeneralFromSamples(Q, M, mode)); } };