Skip to content

Commit a1bdc39

Browse files
authored
Merge pull request #103 from SCIInstitute/gamma-dist-fix
Affine map + sample construction
2 parents 1bef8bd + b38cd94 commit a1bdc39

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

UncertainSCI/distributions.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -531,11 +531,11 @@ def __init__(self, k=1., theta=1., shift=0., flip=False):
531531
self.transform_standard_dist_to_poly = AffineTransform(A=A, b=b)
532532

533533
if not flip:
534-
A = 1/self.theta
534+
A *= 1/self.theta
535535
else:
536-
A = -1/self.theta
536+
A *= -1/self.theta
537537

538-
b = -A*self.shift
538+
b = -A @ (self.shift*np.ones(1))
539539
self.transform_to_standard = AffineTransform(A=A, b=b)
540540

541541
# Construct 1D polynomial families
@@ -544,6 +544,12 @@ def __init__(self, k=1., theta=1., shift=0., flip=False):
544544
Ls.append(LaguerrePolynomials())
545545
self.polys = TensorialPolynomials(polys1d=Ls)
546546

547+
self.standard_domain = np.zeros([2, 1])
548+
self.standard_domain[0, :] = 0.
549+
self.standard_domain[1, :] = np.inf
550+
551+
self.poly_domain = self.standard_domain
552+
547553
self.indices = None
548554

549555
def MC_samples(self, M=100):
@@ -1164,7 +1170,8 @@ def MC_samples(self, M=100):
11641170
p = np.zeros([M, self.dim])
11651171
counter = 0
11661172
for dist in self.distributions:
1167-
p[:, range(counter, counter+dist.dim)] = dist.MC_samples(M=M)
1173+
p[:, range(counter, counter+dist.dim)] = np.reshape(dist.MC_samples(M=M), [M, dist.dim])
1174+
#p[:, range(counter, counter+dist.dim)] = dist.MC_samples(M=M)
11681175
counter += dist.dim
11691176

11701177
# Each component distribution already applies

0 commit comments

Comments
 (0)