From 7fac45e6a95b99fa50c5f4e9ef2bc6a46b7ae6f1 Mon Sep 17 00:00:00 2001 From: btracey Date: Wed, 24 Jul 2013 00:09:10 -0700 Subject: [PATCH] Changed name of output of LogSumExp --- sliceops.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sliceops.go b/sliceops.go index 2f31f885..2f841108 100644 --- a/sliceops.go +++ b/sliceops.go @@ -154,7 +154,7 @@ func LogSpan(dst []float64, l, u float64) { } // Logsumexp returns the log of the sum of the exponentials of the values in s -func LogSumExp(s []float64) (logsumexp float64) { +func LogSumExp(s []float64) (lse float64) { // Want to do this in a numerically stable way which avoids // overflow and underflow // First, find the maximum value in the slice. @@ -171,10 +171,10 @@ func LogSumExp(s []float64) (logsumexp float64) { // compute the sumexp part for _, val := range s { - logsumexp += math.Exp(val) + lse += math.Exp(val) } // Take the log and add back on the constant taken out - logsumexp = math.Log(logsumexp) + maxval + lse = math.Log(lse) + maxval return logsumexp }