scipp.floor_divide

scipp.floor_divide(dividend, divisor)

Element-wise floor division.

This function corresponds to the __floordiv__ dunder method, i.e. dividend // divisor. The result is rounded down:

Parameters
  • dividend (VariableLike) – Dividend of the quotient.

  • divisor (VariableLike) – Divisor of the quotient.

Returns

Rounded down quotient.

Seealso

scipp.divide(), scipp.mod()

Return type

VariableLike

Examples:

>>> sc.floor_divide(sc.arange('x', -2, 3), sc.scalar(2)).values
array([-1, -1,  0,  0,  1])
>>> sc.floor_divide(sc.arange('x', -2.0, 3.0), sc.scalar(2.0)).values
array([-1., -1.,  0.,  0.,  1.])

Of equivalently in operator notation

>>> (sc.arange('x', -2.0, 3.0) // sc.scalar(2.0)).values
array([-1., -1.,  0.,  0.,  1.])

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