|
44 | 44 | 'max', 'min', 'amax', 'amin', 'logical_and', 'logical_or', 'logical_xor', |
45 | 45 | 'swapaxes', 'clip', 'argmax', 'argmin', 'std', 'var', 'indices', 'copysign', 'ravel', 'unravel_index', |
46 | 46 | 'diag_indices_from', 'hanning', 'hamming', 'blackman', 'flip', 'flipud', 'fliplr', |
47 | | - 'hypot', 'bitwise_and', 'bitwise_xor', 'bitwise_or', 'rad2deg', 'deg2rad', 'unique', 'lcm', |
| 47 | + 'hypot', 'bitwise_and', 'bitwise_xor', 'bitwise_or', 'rad2deg', 'deg2rad', 'unique', 'lcm', 'gcd', |
48 | 48 | 'tril', 'triu', 'tri', 'identity', 'take', 'ldexp', 'vdot', 'inner', 'outer', 'cross', 'kron', |
49 | 49 | 'equal', 'not_equal', 'greater', 'less', 'greater_equal', 'less_equal', 'roll', 'rot90', 'einsum', |
50 | 50 | 'true_divide', 'nonzero', 'quantile', 'percentile', 'shares_memory', 'may_share_memory', 'interp', |
@@ -2081,6 +2081,46 @@ def expand_dims(a, axis): |
2081 | 2081 | return _api_internal.expand_dims(a, axis) |
2082 | 2082 |
|
2083 | 2083 |
|
| 2084 | +@set_module('mxnet.ndarray.numpy') |
| 2085 | +@wrap_np_binary_func |
| 2086 | +def gcd(x1, x2, out=None, **kwargs): |
| 2087 | + """ |
| 2088 | + Returns the greatest common divisor of ``|x1|`` and ``|x2|`` |
| 2089 | +
|
| 2090 | + Parameters |
| 2091 | + ---------- |
| 2092 | + x1, x2 : ndarrays or scalar values |
| 2093 | + The arrays for computing greatest common divisor. If x1.shape != x2.shape, |
| 2094 | + they must be broadcastable to a common shape (which may be the shape of |
| 2095 | + one or the other). |
| 2096 | +
|
| 2097 | + out : ndarray or None, optional |
| 2098 | + A location into which the result is stored. If provided, it must have a shape |
| 2099 | + that the inputs broadcast to. If not provided or None, a freshly-allocated array |
| 2100 | + is returned. |
| 2101 | +
|
| 2102 | + Returns |
| 2103 | + ------- |
| 2104 | + y : ndarray or scalar |
| 2105 | + The greatest common divisor of the absolute value of the inputs |
| 2106 | + This is a scalar if both `x1` and `x2` are scalars. |
| 2107 | +
|
| 2108 | + See Also |
| 2109 | + -------- |
| 2110 | + lcm : The lowest common multiple |
| 2111 | +
|
| 2112 | + Examples |
| 2113 | + -------- |
| 2114 | + >>> np.gcd(12, 20) |
| 2115 | + 4 |
| 2116 | + >>> np.gcd(np.arange(6, dtype=int), 20) |
| 2117 | + array([20, 1, 2, 1, 4, 5], dtype=int64) |
| 2118 | + """ |
| 2119 | + if isinstance(x1, numeric_types) and isinstance(x2, numeric_types): |
| 2120 | + return _np.gcd(x1, x2, out=out) |
| 2121 | + return _api_internal.gcd(x1, x2, out) |
| 2122 | + |
| 2123 | + |
2084 | 2124 | @set_module('mxnet.ndarray.numpy') |
2085 | 2125 | @wrap_np_binary_func |
2086 | 2126 | def lcm(x1, x2, out=None, **kwargs): |
|
0 commit comments