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.

  • x ({dpnp.ndarray, usm_ndarray}) -- An array of floats to be rounded.

  • 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

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])