multiply

Contents

multiply#

class brainunit.math.multiply(x, y, **kwargs)#

Multiply arguments element-wise.

The resulting unit is the product of the units of the two inputs.

Parameters:
  • x (saiunit.Quantity | Array | ndarray | bool | number | bool | int | float | complex) – First input array.

  • y (saiunit.Quantity | Array | ndarray | bool | number | bool | int | float | complex) – Second input array. If x.shape != y.shape, they must be broadcastable to a common shape.

Returns:

out – The product of x and y, element-wise. This is a scalar if both x and y are scalars. The resulting unit is x.unit * y.unit.

Return type:

saiunit.Quantity | Array | ndarray | bool | number | bool | int | float | complex

Examples

>>> import saiunit as u
>>> a = u.math.array([1.0, 2.0, 3.0]) * u.meter
>>> b = u.math.array([4.0, 5.0, 6.0]) * u.second
>>> u.math.multiply(a, b)  # unit is meter * second