dpnp.gcd
- dpnp.gcd(x1, x2, out=None, where=True, order='K', dtype=None, subok=True, **kwargs)
Returns the greatest common divisor of
|x1|
and|x2|
.For full documentation refer to
numpy.gcd
.- Parameters:
x1 ({dpnp.ndarray, usm_ndarray, scalar}) -- First input array, expected to have an integer data type. Both inputs x1 and x2 can not be scalars at the same time.
x2 ({dpnp.ndarray, usm_ndarray, scalar}) -- Second input array, also expected to have an integer data type. Both inputs x1 and x2 can not be scalars at the same time. If
x1.shape != x2.shape
, they must be broadcastable to a common shape (which becomes the shape of the output).out ({None, dpnp.ndarray, usm_ndarray}, optional) -- Output array to populate. Array must have the correct shape and the expected data type. Default:
None
.order ({"C", "F", "A", "K"}, optional) -- Memory layout of the newly output array, if parameter out is
None
. Default:"K"
.
- Returns:
out -- The greatest common divisor of the absolute value of the inputs.
- Return type:
dpnp.ndarray
Limitations
Parameters where and subok are supported with their default values. Keyword argument kwargs is currently unsupported. Otherwise
NotImplementedError
exception will be raised.See also
dpnp.lcm
The lowest common multiple.
Examples
>>> import dpnp as np >>> np.gcd(np.array(12), 20) array(4) >>> np.gcd(np.arange(6), 20) array([20, 1, 2, 1, 4, 5])