loupe.multiply#

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

Multiply arrays element-wise.

Parameters:
  • x1 (array_like) – The arrays to be multiplied. 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 multiplied. Arrays must either have the same shape or be broadcastable to a common shape (which becomes the shape of the output).

Returns:

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

Return type:

Function

Notes

Equivalent to x1 * x2.

Examples

>>> loupe.multiply(2.0, 4.0)
8.0
>>> x1 = loupe.array([[1, 2], [3, 4]])
>>> x2 = loupe.array([1, 2])
>>> loupe.multiply(x1, x2)
array([[ 1.,  4.],
       [ 3.,  8.]])

The * operator can be used as shorthand for loupe.multiply.

>>> x1 = loupe.array([[1, 2], [3, 4]])
>>> x2 = loupe.array([1, 2])
>>> x1 * x2
array([[ 1.,  4.],
       [ 3.,  8.]])