MCPcopy Create free account
hub / github.com/numpy/numpy / subtract

Function subtract

numpy/array_api/_elementwise_functions.py:718–729  ·  view source on GitHub ↗

Array API compatible wrapper for :py:func:`np.subtract `. See its docstring for more information.

(x1: Array, x2: Array, /)

Source from the content-addressed store, hash-verified

716
717
718def subtract(x1: Array, x2: Array, /) -> Array:
719 """
720 Array API compatible wrapper for :py:func:`np.subtract <numpy.subtract>`.
721
722 See its docstring for more information.
723 """
724 if x1.dtype not in _numeric_dtypes or x2.dtype not in _numeric_dtypes:
725 raise TypeError("Only numeric dtypes are allowed in subtract")
726 # Call result type here just to raise on disallowed type combinations
727 _result_type(x1.dtype, x2.dtype)
728 x1, x2 = Array._normalize_two_args(x1, x2)
729 return Array._new(np.subtract(x1._array, x2._array))
730
731
732def tan(x: Array, /) -> Array:

Callers 6

_lerpFunction · 0.85
__isub__Method · 0.85
__sub__Method · 0.85
__rsub__Method · 0.85
test_testArithmeticMethod · 0.85
test_basic_arithmeticMethod · 0.85

Calls 3

_result_typeFunction · 0.85
_normalize_two_argsMethod · 0.80
_newMethod · 0.80

Tested by 2

test_testArithmeticMethod · 0.68
test_basic_arithmeticMethod · 0.68