shape

Contents

shape#

class saiunit.math.shape(a)#

Return the shape of an array.

Parameters:

a (saiunit.Quantity | Array | ndarray | bool | number | bool | int | float | complex) – Input array.

Returns:

shape – The elements of the shape tuple give the lengths of the corresponding array dimensions.

Return type:

tuple[int, ...]

See also

len

len(a) is equivalent to np.shape(a)[0] for N-D arrays with N>=1.

ndarray.shape

Equivalent array method.

Examples

>>> saiunit.math.shape(saiunit.math.eye(3))
(3, 3)
>>> saiunit.math.shape([[1, 3]])
(1, 2)
>>> saiunit.math.shape([0])
(1,)
>>> saiunit.math.shape(0)
()