Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/emcee/moves/stretch.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,18 @@ def get_proposal(self, s, c, random):
zz = ((self.a - 1.0) * random.rand(Ns) + 1) ** 2.0 / self.a
factors = (ndim - 1.0) * np.log(zz)
rint = random.randint(Nc, size=(Ns,))
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps remove this line? It's no longer needed.

return c[rint] - (c[rint] - s) * zz[:, None], factors
# deterministic matching of c to s
# they should be the same size +- 1.
if Nc == Ns:
rint = Ellipsis
elif Nc == Ns + 1: # s is one shorter
rint = slice(0, Ns)
elif Nc == Ns - 1: # s is one longer, reuse one
rint = np.arange(Ns)
# RedBlueMove's permutation means the first element is not special
rint[-1] = 0
else:
# old resampling behaviour; this should not occur
rint = random.randint(Nc, size=(Ns,))
cc = c[rint]
return cc - (cc - s) * zz[:, None], factors