From b9031f8a22a023efd4eb0b2fadc6e5fda8dc22d8 Mon Sep 17 00:00:00 2001 From: "Per.Andreas.Brodtkorb" Date: Tue, 11 Mar 2014 10:52:55 +0000 Subject: [PATCH] Added fix for genpareto.logpdf --- pywafo/src/wafo/stats/_continuous_distns.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pywafo/src/wafo/stats/_continuous_distns.py b/pywafo/src/wafo/stats/_continuous_distns.py index 58dd2c1..427d4c2 100644 --- a/pywafo/src/wafo/stats/_continuous_distns.py +++ b/pywafo/src/wafo/stats/_continuous_distns.py @@ -1639,7 +1639,10 @@ class genpareto_gen(rv_continuous): return exp(self._logpdf(x, c)) def _logpdf(self, x, c): - return -(c + 1.) * self._log1pcx(x, c) + return _lazywhere((x == x) & (c != 0), (x, c), + lambda x, c: -special.xlog1py(c+1., c*x) / c, + -x) + #return -(c + 1.) * self._log1pcx(x, c) # x1 = where((c == 0) & (x == inf), 0.0, x) # cx = where((c == 0) & (x == inf), 0.0, c * x1) # logpdf = where((cx == inf) | (cx == -1),