empty

Contents

empty#

class saiunit.math.empty(shape, dtype=None, unit=Unit('1'))#

Return a new quantity or array of given shape and type, without initializing entries.

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

  • dtype (str | type[Any] | dtype | SupportsDType | None) – Data-type of the output. Defaults to float.

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

Returns:

out – Array of uninitialized (arbitrary) data of the given shape and dtype.

Return type:

Array | saiunit.Quantity

Examples

>>> import saiunit as u
>>> result = u.math.empty((2, 3))
>>> result.shape
(2, 3)
>>> result = u.math.empty((2,), unit=u.meter)
>>> u.get_unit(result) == u.meter
True