loupe.add#
- class loupe.add(x1, x2)[source]#
Add arrays element-wise.
- Parameters:
x1 (array_like) – The arrays to be added. 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 added. Arrays must either have the same shape or be broadcastable to a common shape (which becomes the shape of the output).
- Returns:
out – The sum of x1 and x2, element-wise.
- Return type:
Notes
Equivalent to x1 + x2.
Examples
>>> loupe.add(1.0, 4.0) 5.0 >>> x1 = loupe.array([[1, 2], [3, 4]]) >>> x2 = loupe.array([1, 2]) >>> loupe.add(x1, x2) array([[ 2., 4.], [ 4., 6.]])
The
+
operator can be used as shorthand forloupe.add
.>>> x1 = loupe.array([[1, 2], [3, 4]]) >>> x2 = loupe.array([1, 2]) >>> x1 + x2 array([[ 2., 4.], [ 4., 6.]])