Skip to content
Discussion options

You must be logged in to vote

Yes, for example you can do this via broadcasting within a standard mod operation:

import numpy as np
import jax.numpy as jnp

a = jnp.array([1, 2, 3, 4])
b = jnp.array([1, 2, 3, 4, 5])

print(a[:, None] % b)
# [[0 1 1 1 1]
#  [0 0 2 2 2]
#  [0 1 0 3 3]
#  [0 0 1 0 4]]

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@romilly
Comment options

Answer selected by romilly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants