zeros

Contents

zeros#

class brainunit.math.zeros(shape, dtype=None, unit=Unit('1'))#

Return a new quantity or array of given shape and type, filled with zeros.

Parameters:
  • shape (int | Sequence[int]) – Shape of the new quantity or array, e.g., (2, 3) or 2.

  • dtype (str | type[Any] | dtype | SupportsDType | None) – The desired data-type for the array. Default is float.

  • unit (saiunit.Unit) – Unit of the returned Quantity. When UNITLESS (the default) a plain array is returned.

Returns:

out – Array of zeros with the given shape and dtype.

Return type:

Array | saiunit.Quantity

Examples

>>> import saiunit as u
>>> u.math.zeros((3,))
Array([0., 0., 0.], dtype=float32)
>>> u.math.zeros((2,), unit=u.second)
Quantity([0. 0.], "s")