loupe.subtract#

class loupe.subtract(x1, x2)[source]#

Subtract arrays element-wise.

Parameters:
  • x1 (array_like) – The arrays to be subtracted from each other. Arrays must either have the same shape or be broadcastable to a common shape (which becomes the shape of the output).

  • x2 (array_like) – The arrays to be subtracted from each other. Arrays must either have the same shape or be broadcastable to a common shape (which becomes the shape of the output).

Returns:

out – The difference of x1 and x2, element-wise.

Return type:

Function

Notes

Equivalent to x1 - x2.

Examples

>>> loupe.subtract(1.0, 4.0)
-3.0
>>> a = loupe.array([[1, 2], [3, 4]])
>>> b = loupe.array([1, 2])
>>> loupe.subtract(a, b)
array([[ 0.,  0.],
       [ 2.,  2.]])

The - operator can be used as shorthand for loupe.subtract.

>>> a = loupe.array([[1, 2], [3, 4]])
>>> b = loupe.array([1, 2])
>>> a - b
array([[ 0.,  0.],
       [ 2.,  2.]])