Skip to content

Commit

Permalink
Make note of new syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
RadostW committed Oct 23, 2024
1 parent 146f1c4 commit 5ee2184
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pychastic/vectorized_I_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,9 @@ def make_D_mat(eta, zeta):
def take(tensor, idx, fill=0):
# Non jit-friendly implementation
# illegal = jnp.logical_or(idx > p,idx < 1)
# return tensor[..., idx-1].at[..., illegal].set(fill)
# return tensor[..., idx-1].at[..., illegal].set(fill)
legalized_idx = jnp.clip(idx, a_min=1, a_max=p)
# legalized_idx = jnp.clip(idx, min=1, max=p) # python 3.9+
illegal_mask = jnp.logical_or(idx > p, idx < 1)
return (
tensor[..., legalized_idx - 1] * (1 - 1 * illegal_mask)
Expand Down

0 comments on commit 5ee2184

Please sign in to comment.