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

Function divide

numpy/array_api/_elementwise_functions.py:277–288  ·  view source on GitHub ↗

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

(x1: Array, x2: Array, /)

Source from the content-addressed store, hash-verified

275
276
277def divide(x1: Array, x2: Array, /) -> Array:
278 """
279 Array API compatible wrapper for :py:func:`np.divide <numpy.divide>`.
280
281 See its docstring for more information.
282 """
283 if x1.dtype not in _floating_dtypes or x2.dtype not in _floating_dtypes:
284 raise TypeError("Only floating-point dtypes are allowed in divide")
285 # Call result type here just to raise on disallowed type combinations
286 _result_type(x1.dtype, x2.dtype)
287 x1, x2 = Array._normalize_two_args(x1, x2)
288 return Array._new(np.divide(x1._array, x2._array))
289
290
291def equal(x1: Array, x2: Array, /) -> Array:

Callers 13

__div__Method · 0.85
__rdiv__Method · 0.85
__idiv__Method · 0.85
__divmod__Method · 0.85
__rdivmod__Method · 0.85
pinvFunction · 0.85
__div__Method · 0.85
varMethod · 0.85
test_testArithmeticMethod · 0.85
test_basic_arithmeticMethod · 0.85

Calls 4

_result_typeFunction · 0.85
_normalize_two_argsMethod · 0.80
_newMethod · 0.80
divideMethod · 0.80