diff options
| author | Albert Thomas <albertthomas88@gmail.com> | 2019-01-15 06:37:11 +0100 |
|---|---|---|
| committer | Matti Picus <matti.picus@gmail.com> | 2019-01-15 07:37:11 +0200 |
| commit | 4e532b858e5ccdcbc32051df18e9b8467d755bc0 (patch) | |
| tree | 93d8479fe3bfd2b963835a0eb1feed5f4d7a54c8 /numpy | |
| parent | f7d4688af45976e7d79c21bb5bdcc4ab6cee7a90 (diff) | |
| download | numpy-4e532b858e5ccdcbc32051df18e9b8467d755bc0.tar.gz | |
DOC: fix docstrings for broadcastable inputs in ufunc (#12463)
Diffstat (limited to 'numpy')
| -rw-r--r-- | numpy/core/code_generators/ufunc_docstrings.py | 110 |
1 files changed, 48 insertions, 62 deletions
diff --git a/numpy/core/code_generators/ufunc_docstrings.py b/numpy/core/code_generators/ufunc_docstrings.py index 267e63b2d..6dd6982df 100644 --- a/numpy/core/code_generators/ufunc_docstrings.py +++ b/numpy/core/code_generators/ufunc_docstrings.py @@ -32,6 +32,9 @@ subst = { For other keyword-only arguments, see the :ref:`ufunc docs <ufuncs.kwargs>`. """).strip(), + 'BROADCASTABLE_2': ("If ``x1.shape != x2.shape``, they must be " + "broadcastable to a common shape (which becomes the " + "shape of the output)."), 'OUT_SCALAR_1': "This is a scalar if `x` is a scalar.", 'OUT_SCALAR_2': "This is a scalar if both `x1` and `x2` are scalars.", } @@ -104,9 +107,7 @@ add_newdoc('numpy.core.umath', 'add', Parameters ---------- x1, x2 : array_like - The arrays to be added. If ``x1.shape != x2.shape``, they must be - broadcastable to a common shape (which may be the shape of one or - the other). + The arrays to be added. $BROADCASTABLE_2 $PARAMS Returns @@ -432,8 +433,7 @@ add_newdoc('numpy.core.umath', 'arctan2', x1 : array_like, real-valued `y`-coordinates. x2 : array_like, real-valued - `x`-coordinates. `x2` must be broadcastable to match the shape of - `x1` or vice versa. + `x`-coordinates. $BROADCASTABLE_2 $PARAMS Returns @@ -556,7 +556,7 @@ add_newdoc('numpy.core.umath', 'bitwise_and', Parameters ---------- x1, x2 : array_like - Only integer and boolean types are handled. + Only integer and boolean types are handled. $BROADCASTABLE_2 $PARAMS Returns @@ -609,7 +609,7 @@ add_newdoc('numpy.core.umath', 'bitwise_or', Parameters ---------- x1, x2 : array_like - Only integer and boolean types are handled. + Only integer and boolean types are handled. $BROADCASTABLE_2 $PARAMS Returns @@ -667,7 +667,7 @@ add_newdoc('numpy.core.umath', 'bitwise_xor', Parameters ---------- x1, x2 : array_like - Only integer and boolean types are handled. + Only integer and boolean types are handled. $BROADCASTABLE_2 $PARAMS Returns @@ -970,7 +970,7 @@ add_newdoc('numpy.core.umath', 'heaviside', x1 : array_like Input values. x2 : array_like - The value of the function when x1 is 0. + The value of the function when x1 is 0. $BROADCASTABLE_2 $PARAMS Returns @@ -1005,7 +1005,7 @@ add_newdoc('numpy.core.umath', 'divide', x1 : array_like Dividend array. x2 : array_like - Divisor array. + Divisor array. $BROADCASTABLE_2 $PARAMS Returns @@ -1074,7 +1074,7 @@ add_newdoc('numpy.core.umath', 'equal', Parameters ---------- x1, x2 : array_like - Input arrays of the same shape. + Input arrays. $BROADCASTABLE_2 $PARAMS Returns @@ -1321,7 +1321,7 @@ add_newdoc('numpy.core.umath', 'floor_divide', x1 : array_like Numerator. x2 : array_like - Denominator. + Denominator. $BROADCASTABLE_2 $PARAMS Returns @@ -1361,7 +1361,7 @@ add_newdoc('numpy.core.umath', 'fmod', x1 : array_like Dividend. x2 : array_like - Divisor. + Divisor. $BROADCASTABLE_2 $PARAMS Returns @@ -1411,9 +1411,7 @@ add_newdoc('numpy.core.umath', 'greater', Parameters ---------- x1, x2 : array_like - Input arrays. If ``x1.shape != x2.shape``, they must be - broadcastable to a common shape (which may be the shape of one or - the other). + Input arrays. $BROADCASTABLE_2 $PARAMS Returns @@ -1449,9 +1447,7 @@ add_newdoc('numpy.core.umath', 'greater_equal', Parameters ---------- x1, x2 : array_like - Input arrays. If ``x1.shape != x2.shape``, they must be - broadcastable to a common shape (which may be the shape of one or - the other). + Input arrays. $BROADCASTABLE_2 $PARAMS Returns @@ -1484,7 +1480,7 @@ add_newdoc('numpy.core.umath', 'hypot', Parameters ---------- x1, x2 : array_like - Leg of the triangle(s). + Leg of the triangle(s). $BROADCASTABLE_2 $PARAMS Returns @@ -1783,6 +1779,7 @@ add_newdoc('numpy.core.umath', 'left_shift', Input values. x2 : array_like of integer type Number of zeros to append to `x1`. Has to be non-negative. + $BROADCASTABLE_2 $PARAMS Returns @@ -1818,9 +1815,7 @@ add_newdoc('numpy.core.umath', 'less', Parameters ---------- x1, x2 : array_like - Input arrays. If ``x1.shape != x2.shape``, they must be - broadcastable to a common shape (which may be the shape of one or - the other). + Input arrays. $BROADCASTABLE_2 $PARAMS Returns @@ -1848,9 +1843,7 @@ add_newdoc('numpy.core.umath', 'less_equal', Parameters ---------- x1, x2 : array_like - Input arrays. If ``x1.shape != x2.shape``, they must be - broadcastable to a common shape (which may be the shape of one or - the other). + Input arrays. $BROADCASTABLE_2 $PARAMS Returns @@ -2034,7 +2027,7 @@ add_newdoc('numpy.core.umath', 'logaddexp', Parameters ---------- x1, x2 : array_like - Input values. + Input values. $BROADCASTABLE_2 $PARAMS Returns @@ -2076,7 +2069,7 @@ add_newdoc('numpy.core.umath', 'logaddexp2', Parameters ---------- x1, x2 : array_like - Input values. + Input values. $BROADCASTABLE_2 $PARAMS Returns @@ -2167,14 +2160,14 @@ add_newdoc('numpy.core.umath', 'logical_and', Parameters ---------- x1, x2 : array_like - Input arrays. `x1` and `x2` must be of the same shape. + Input arrays. $BROADCASTABLE_2 $PARAMS Returns ------- y : ndarray or bool - Boolean result with the same shape as `x1` and `x2` of the logical - AND operation on corresponding elements of `x1` and `x2`. + Boolean result of the logical OR operation applied to the elements + of `x1` and `x2`; the shape is determined by broadcasting. $OUT_SCALAR_2 See Also @@ -2237,14 +2230,14 @@ add_newdoc('numpy.core.umath', 'logical_or', ---------- x1, x2 : array_like Logical OR is applied to the elements of `x1` and `x2`. - They have to be of the same shape. + $BROADCASTABLE_2 $PARAMS Returns ------- y : ndarray or bool - Boolean result with the same shape as `x1` and `x2` of the logical - OR operation on elements of `x1` and `x2`. + Boolean result of the logical OR operation applied to the elements + of `x1` and `x2`; the shape is determined by broadcasting. $OUT_SCALAR_2 See Also @@ -2272,16 +2265,14 @@ add_newdoc('numpy.core.umath', 'logical_xor', Parameters ---------- x1, x2 : array_like - Logical XOR is applied to the elements of `x1` and `x2`. They must - be broadcastable to the same shape. + Logical XOR is applied to the elements of `x1` and `x2`. $BROADCASTABLE_2 $PARAMS Returns ------- y : bool or ndarray of bool Boolean result of the logical XOR operation applied to the elements - of `x1` and `x2`; the shape is determined by whether or not - broadcasting of one or both arrays was required. + of `x1` and `x2`; the shape is determined by broadcasting. $OUT_SCALAR_2 See Also @@ -2321,8 +2312,7 @@ add_newdoc('numpy.core.umath', 'maximum', Parameters ---------- x1, x2 : array_like - The arrays holding the elements to be compared. They must have - the same shape, or shapes that can be broadcast to a single shape. + The arrays holding the elements to be compared. $BROADCASTABLE_2 $PARAMS Returns @@ -2380,8 +2370,7 @@ add_newdoc('numpy.core.umath', 'minimum', Parameters ---------- x1, x2 : array_like - The arrays holding the elements to be compared. They must have - the same shape, or shapes that can be broadcast to a single shape. + The arrays holding the elements to be compared. $BROADCASTABLE_2 $PARAMS Returns @@ -2439,8 +2428,7 @@ add_newdoc('numpy.core.umath', 'fmax', Parameters ---------- x1, x2 : array_like - The arrays holding the elements to be compared. They must have - the same shape. + The arrays holding the elements to be compared. $BROADCASTABLE_2 $PARAMS Returns @@ -2497,8 +2485,7 @@ add_newdoc('numpy.core.umath', 'fmin', Parameters ---------- x1, x2 : array_like - The arrays holding the elements to be compared. They must have - the same shape. + The arrays holding the elements to be compared. $BROADCASTABLE_2 $PARAMS Returns @@ -2711,7 +2698,7 @@ add_newdoc('numpy.core.umath', 'multiply', Parameters ---------- x1, x2 : array_like - Input arrays to be multiplied. + Input arrays to be multiplied. $BROADCASTABLE_2 $PARAMS Returns @@ -2792,7 +2779,7 @@ add_newdoc('numpy.core.umath', 'not_equal', Parameters ---------- x1, x2 : array_like - Input arrays. + Input arrays. $BROADCASTABLE_2 $PARAMS Returns @@ -2841,7 +2828,7 @@ add_newdoc('numpy.core.umath', 'power', x1 : array_like The bases. x2 : array_like - The exponents. + The exponents. $BROADCASTABLE_2 $PARAMS Returns @@ -2900,7 +2887,7 @@ add_newdoc('numpy.core.umath', 'float_power', x1 : array_like The bases. x2 : array_like - The exponents. + The exponents. $BROADCASTABLE_2 $PARAMS Returns @@ -3072,7 +3059,7 @@ add_newdoc('numpy.core.umath', 'remainder', x1 : array_like Dividend array. x2 : array_like - Divisor array. + Divisor array. $BROADCASTABLE_2 $PARAMS Returns @@ -3117,7 +3104,7 @@ add_newdoc('numpy.core.umath', 'divmod', x1 : array_like Dividend array. x2 : array_like - Divisor array. + Divisor array. $BROADCASTABLE_2 $PARAMS Returns @@ -3156,7 +3143,7 @@ add_newdoc('numpy.core.umath', 'right_shift', x1 : array_like, int Input values. x2 : array_like, int - Number of bits to remove at the right of `x1`. + Number of bits to remove at the right of `x1`. $BROADCASTABLE_2 $PARAMS Returns @@ -3283,16 +3270,14 @@ add_newdoc('numpy.core.umath', 'copysign', """ Change the sign of x1 to that of x2, element-wise. - If both arguments are arrays or sequences, they have to be of the same - length. If `x2` is a scalar, its sign will be copied to all elements of - `x1`. + If `x2` is a scalar, its sign will be copied to all elements of `x1`. Parameters ---------- x1 : array_like Values to change the sign of. x2 : array_like - The sign of `x2` is copied to `x1`. + The sign of `x2` is copied to `x1`. $BROADCASTABLE_2 $PARAMS Returns @@ -3327,6 +3312,7 @@ add_newdoc('numpy.core.umath', 'nextafter', Values to find the next representable value of. x2 : array_like The direction where to look for the next representable value of `x1`. + $BROADCASTABLE_2 $PARAMS Returns @@ -3598,7 +3584,7 @@ add_newdoc('numpy.core.umath', 'subtract', Parameters ---------- x1, x2 : array_like - The arrays to be subtracted from each other. + The arrays to be subtracted from each other. $BROADCASTABLE_2 $PARAMS Returns @@ -3739,7 +3725,7 @@ add_newdoc('numpy.core.umath', 'true_divide', x1 : array_like Dividend array. x2 : array_like - Divisor array. + Divisor array. $BROADCASTABLE_2 $PARAMS Returns @@ -3836,7 +3822,7 @@ add_newdoc('numpy.core.umath', 'ldexp', x1 : array_like Array of multipliers. x2 : array_like, int - Array of twos exponents. + Array of twos exponents. $BROADCASTABLE_2 $PARAMS Returns @@ -3874,7 +3860,7 @@ add_newdoc('numpy.core.umath', 'gcd', Parameters ---------- x1, x2 : array_like, int - Arrays of values + Arrays of values. $BROADCASTABLE_2 Returns ------- @@ -3904,7 +3890,7 @@ add_newdoc('numpy.core.umath', 'lcm', Parameters ---------- x1, x2 : array_like, int - Arrays of values + Arrays of values. $BROADCASTABLE_2 Returns ------- |
