Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mod is an alias of remainder #1882

Merged
merged 2 commits into from
Jun 15, 2024
Merged
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
65 changes: 8 additions & 57 deletions dpnp/dpnp_iface_mathematical.py
Original file line number Diff line number Diff line change
Expand Up @@ -2245,63 +2245,6 @@ def gradient(f, *varargs, axis=None, edge_order=1):
)


def mod(
x1,
x2,
/,
out=None,
*,
where=True,
order="K",
dtype=None,
subok=True,
**kwargs,
):
"""
Compute element-wise remainder of division.

For full documentation refer to :obj:`numpy.mod`.

Returns
-------
out : dpnp.ndarray
The element-wise remainder of the quotient `floor_divide(x1, x2)`.

Limitations
-----------
Parameters `x1` and `x2` are supported as either scalar,
:class:`dpnp.ndarray` or :class:`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 :ref:`Data types`.

See Also
--------
:obj:`dpnp.fmod` : Calculate the element-wise remainder of division
:obj:`dpnp.remainder` : Remainder complementary to floor_divide.
:obj:`dpnp.divide` : Standard division.

Notes
-----
This function works the same as :obj:`dpnp.remainder`.

"""

return dpnp.remainder(
x1,
x2,
out=out,
where=where,
order=order,
dtype=dtype,
subok=subok,
**kwargs,
)


def modf(x1, **kwargs):
"""
Return the fractional and integral parts of an array, element-wise.
Expand Down Expand Up @@ -2818,6 +2761,12 @@ def prod(
:obj:`dpnp.floor_divide` : Compute the largest integer smaller or equal to the division of the inputs.
:obj:`dpnp.mod` : Calculate the element-wise remainder of division.

Notes
-----
Returns ``0`` when `x2` is ``0`` and both `x1` and `x2` are (arrays of)
integers.
:obj:`dpnp.mod` is an alias of :obj:`dpnp.remainder`.

Examples
--------
>>> import dpnp as np
Expand All @@ -2843,6 +2792,8 @@ def prod(
binary_inplace_fn=ti._remainder_inplace,
)

mod = remainder


_RINT_DOCSTRING = """
Rounds each element `x_i` of the input array `x` to
Expand Down
Loading