dpnp.fmod

dpnp.fmod(x1, x2, /, out=None, *, where=True, dtype=None, subok=True, **kwargs)[source]

Returns the element-wise remainder of division.

For full documentation refer to numpy.fmod.

Returns:

out – The remainder of the division of x1 by x2.

Return type:

dpnp.ndarray

Limitations

Parameters x1 and x2 are supported as either scalar, dpnp.ndarray or dpctl.tensor.usm_ndarray, but both x1 and x2 can not be scalars at the same time. Parameters where, dtype and subok are supported with their default values. Keyword argument kwargs is currently unsupported. Otherwise the function will be executed sequentially on CPU. Input array data types are limited by supported DPNP Available array data types.

See also

dpnp.remainder

Remainder complementary to floor_divide.

dpnp.divide

Standard division.

Examples

>>> import dpnp as np
>>> a = np.array([-3, -2, -1, 1, 2, 3])
>>> np.fmod(a, 2)
array([-1,  0, -1,  1,  0,  1])
>>> np.remainder(a, 2)
array([1, 0, 1, 1, 0, 1])
>>> a = np.array([5, 3])
>>> b = np.array([2, 2.])
>>> np.fmod(a, b)
array([1., 1.])
>>> a = np.arange(-3, 3).reshape(3, 2)
>>> a
array([[-3, -2],
       [-1,  0],
       [ 1,  2]])
>>> b = np.array([2, 2])
>>> np.fmod(a, b)
array([[-1,  0],
       [-1,  0],
       [ 1,  0]])