Skip to content

Commit

Permalink
ENH: Simplify the overflow avoidance in scipy.stats.norminvgauss.pdf().
Browse files Browse the repository at this point in the history
  • Loading branch information
pvanmulbregt committed Apr 12, 2018
1 parent 779e59e commit dcd56ce
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions scipy/stats/_continuous_distns.py
Original file line number Diff line number Diff line change
Expand Up @@ -3258,9 +3258,7 @@ def _argcheck(self, a, b):
def _pdf(self, x, a, b):
gamma = np.sqrt(a**2 - b**2)
fac1 = a / np.pi * np.exp(gamma)
x = np.asarray(x)
one = np.ones_like(x)
sq = np.hypot(one, x) # reduce overflows
sq = np.hypot(1, x) # reduce overflows
return fac1 * sc.k1e(a * sq) * np.exp(b*x - a*sq) / sq

def _rvs(self, a, b):
Expand Down

0 comments on commit dcd56ce

Please sign in to comment.