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 (
Union[int,Sequence[int]]) – Shape of the empty quantity or array, e.g.,(2, 3)or2.dtype (
Union[str,type[Any],dtype,SupportsDType,None]) – Data-type of the output. Defaults tofloat.unit (saiunit.Unit) – Unit of the returned
Quantity. WhenUNITLESS(the default) a plain array is returned.
- Returns:
out – Array of uninitialized (arbitrary) data of the given shape and dtype.
- Return type:
Union[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