Skip to content

Commit d33db68

Browse files
committed
Stopping condition comment
1 parent 3526b62 commit d33db68

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tsdate/approx.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ def approximate_gamma_kl(x, logx):
7575
assert alpha > 0, "kl-min: bad initial condition"
7676
last = np.inf
7777
itt = 0
78-
while np.abs(alpha - last) > alpha * 1e-8:
78+
# determine convergence when the change in alpha falls below
79+
# some small value (e.g. square root of machine precision)
80+
while np.abs(alpha - last) > alpha * np.sqrt(np.finfo(np.float64).eps):
7981
last = alpha
8082
numer = hypergeo._digamma(alpha) - np.log(alpha) - logx + np.log(x)
8183
denom = hypergeo._trigamma(alpha) - 1 / alpha

0 commit comments

Comments
 (0)