Skip to content

Commit 4c4d71c

Browse files
ArmavicaricardoV94
authored andcommitted
Remove unused integrate_nd function
1 parent 75c795c commit 4c4d71c

File tree

1 file changed

+0
-38
lines changed

1 file changed

+0
-38
lines changed

pymc/tests/distributions/test_distribution.py

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -21,51 +21,13 @@
2121
import pytest
2222

2323
from aesara.tensor import TensorVariable
24-
from scipy import integrate
2524

2625
import pymc as pm
2726

2827
from pymc.distributions import MvNormal, MvStudentT, joint_logp, logp
2928
from pymc.distributions.distribution import _moment, moment
3029
from pymc.distributions.shape_utils import to_tuple
3130
from pymc.tests.distributions.util import assert_moment_is_expected
32-
from pymc.vartypes import continuous_types
33-
34-
35-
def integrate_nd(f, domain, shape, dtype):
36-
if shape == () or shape == (1,):
37-
if dtype in continuous_types:
38-
return integrate.quad(f, domain.lower, domain.upper, epsabs=1e-8)[0]
39-
else:
40-
return sum(f(j) for j in range(domain.lower, domain.upper + 1))
41-
elif shape == (2,):
42-
43-
def f2(a, b):
44-
return f([a, b])
45-
46-
return integrate.dblquad(
47-
f2,
48-
domain.lower[0],
49-
domain.upper[0],
50-
lambda _: domain.lower[1],
51-
lambda _: domain.upper[1],
52-
)[0]
53-
elif shape == (3,):
54-
55-
def f3(a, b, c):
56-
return f([a, b, c])
57-
58-
return integrate.tplquad(
59-
f3,
60-
domain.lower[0],
61-
domain.upper[0],
62-
lambda _: domain.lower[1],
63-
lambda _: domain.upper[1],
64-
lambda _, __: domain.lower[2],
65-
lambda _, __: domain.upper[2],
66-
)[0]
67-
else:
68-
raise ValueError("Dont know how to integrate shape: " + str(shape))
6931

7032

7133
class TestBugfixes:

0 commit comments

Comments
 (0)