fix dev by 0 in KL-Divergence

This commit is contained in:
gleb.sternharz 2014-02-17 04:08:30 +01:00
parent 05b9c991dd
commit f85aa929f1

View File

@ -741,7 +741,7 @@ struct KL_Divergence
Iterator1 last = a + size;
while (a < last) {
if (* a != 0) {
if (* b != 0) {
ResultType ratio = (ResultType)(*a / *b);
if (ratio>0) {
result += *a * log(ratio);