Skip to content

Commit 6b18f6d

Browse files
committed
Added further protection from undeflows.
1 parent 3eae1f0 commit 6b18f6d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

structure_threader/wrappers/maverick_wrapper.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,12 +325,13 @@ def maverick_normalization(x_mean, x_sd, klist, draws=int(1e6), limit=95):
325325
# Just like in the original implementation
326326
x_mean = [x - max(x_mean) for x in x_mean]
327327

328-
z_array = np.zeros([len(x_mean), draws])
328+
z_array = np.zeros([len(x_mean), draws], dtype=np.longdouble)
329329

330330
# draw random values of Z, exponentiate, and sort them in a bidimensional
331331
# array
332332
for i in range(z_array.shape[0]):
333-
y_array = np.array([np.exp(rnorm(x_mean[i], x_sd[i]))
333+
y_array = np.array([np.exp(rnorm(x_mean[i], x_sd[i]),
334+
dtype=np.longdouble)
334335
for _ in range(draws)])
335336

336337
z_array[i] = y_array

0 commit comments

Comments
 (0)