[Scipy-svn] r5111 - trunk/scipy/stats

scipy-svn at scipy.org scipy-svn at scipy.org
Fri Nov 14 22:45:43 EST 2008


Author: josef
Date: 2008-11-14 21:45:41 -0600 (Fri, 14 Nov 2008)
New Revision: 5111

Modified:
   trunk/scipy/stats/distributions.py
Log:
fix entropy for continuous rv with numargs==0

Modified: trunk/scipy/stats/distributions.py
===================================================================
--- trunk/scipy/stats/distributions.py	2008-11-15 03:45:23 UTC (rev 5110)
+++ trunk/scipy/stats/distributions.py	2008-11-15 03:45:41 UTC (rev 5111)
@@ -848,12 +848,16 @@
     def entropy(self, *args, **kwds):
         loc,scale=map(kwds.get,['loc','scale'])
         args, loc, scale = self._fix_loc_scale(args, loc, scale)
-        args = map(arr,args)
+        args = tuple(map(arr,args))
         cond0 = self._argcheck(*args) & (scale > 0) & (loc==loc)
         output = zeros(shape(cond0),'d')
         place(output,(1-cond0),self.badvalue)
         goodargs = argsreduce(cond0, *args)
-        place(output,cond0,self.vecentropy(*goodargs)+log(scale))
+        #I don't know when or why vecentropy got broken when numargs == 0
+        if self.numargs == 0:
+            place(output,cond0,self._entropy()+log(scale))
+        else:
+            place(output,cond0,self.vecentropy(*goodargs)+log(scale))
         return output
 
 _EULER = 0.577215664901532860606512090082402431042  # -special.psi(1)




More information about the Scipy-svn mailing list