full#
- class saiunit.math.full(shape, fill_value, dtype=None)#
Return a new quantity or array of given shape, filled with
fill_value.If
fill_valueis aQuantity, the result is aQuantitycarrying the same unit. Otherwise a plain JAX array is returned.- Parameters:
shape (
int|Sequence[int]) – Shape of the new array, e.g.,(2, 3)or2.fill_value (saiunit.Quantity |
int|float) – Fill value. When aQuantityis given its unit is preserved.dtype (
str|type[Any] |dtype|SupportsDType|None) – The desired data-type for the array. The default,None, means the dtype is inferred fromfill_value.
- Returns:
out – Array (or
Quantity) offill_valuewith the given shape and dtype.- Return type:
Array| saiunit.Quantity
Examples
>>> import saiunit as u >>> u.math.full((2, 3), 7.0) Array([[7., 7., 7.], [7., 7., 7.]], dtype=float32) >>> u.math.full((3,), 5.0 * u.meter) Quantity([5. 5. 5.], "m")