Skip to content

Commit a910039

Browse files
matkrajpavanky
authored andcommitted
Update arith.py
Add missing python code for modulus function af.mod()
1 parent 6c9a4db commit a910039

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

arrayfire/arith.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,26 @@ def clamp(val, low, high):
164164

165165
return out
166166

167+
def mod(lhs, rhs):
168+
"""
169+
Find the modulus.
170+
Parameters
171+
----------
172+
lhs : af.Array or scalar
173+
Multi dimensional arrayfire array or a scalar number.
174+
rhs : af.Array or scalar
175+
Multi dimensional arrayfire array or a scalar number.
176+
Returns
177+
--------
178+
out : af.Array
179+
Contains the moduli after dividing each value of lhs` with those in `rhs`.
180+
Note
181+
-------
182+
- Atleast one of `lhs` and `rhs` needs to be af.Array.
183+
- If `lhs` and `rhs` are both af.Array, they must be of same size.
184+
"""
185+
return _arith_binary_func(lhs, rhs, backend.get().af_mod)
186+
167187
def rem(lhs, rhs):
168188
"""
169189
Find the remainder.

0 commit comments

Comments
 (0)