scipp.multiply#

scipp.multiply(left, right)#

Element-wise product.

Equivalent to:

left * right

In cases where the order of the operands matters, e.g. with vectors or matrices, it is as shown above.

Parameters:
  • left (VariableLike) – Left factor

  • right (VariableLike) – Right factor.

Returns:

VariableLike – Product of left and right.

Examples

>>> import scipp as sc
>>> a = sc.array(dims=['x'], values=[2, 3, 4])
>>> b = sc.array(dims=['x'], values=[5, 6, 7])
>>> sc.multiply(a, b)
<scipp.Variable> (x: 3)      int64  [dimensionless]  [10, 18, 28]

Or equivalently in operator notation:

>>> a * b
<scipp.Variable> (x: 3)      int64  [dimensionless]  [10, 18, 28]

Units are multiplied:

>>> sc.multiply(sc.scalar(2.0, unit='m'), sc.scalar(3.0, unit='s'))
<scipp.Variable> ()    float64            [m*s]  6

Note

See the guide on computation for general concepts and broadcasting behavior.