nums.numpy.api.properties module

nums.numpy.api.properties.ndim(a)[source]

Return the number of dimensions of an array.

This docstring was copied from numpy.ndim.

Some inconsistencies with the NumS version may exist.

Parameters

a (BlockArray) – Input array. If it is not already an BlockArray, a conversion is attempted.

Returns

number_of_dimensions – The number of dimensions in a. Scalars are zero-dimensional.

Return type

int

See also

shape

dimensions of array

Examples

The doctests shown below are copied from NumPy. They won’t show the correct result until you operate get().

>>> nps.ndim(nps.array([[1,2,3],[4,5,6]])).get()  
2
nums.numpy.api.properties.shape(a)[source]

Return the shape of an array.

This docstring was copied from numpy.shape.

Some inconsistencies with the NumS version may exist.

Parameters

a (BlockArray) – Input array.

Returns

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

Return type

tuple of ints

Examples

The doctests shown below are copied from NumPy. They won’t show the correct result until you operate get().

>>> nps.shape(nps.eye(3))  
(3, 3)
nums.numpy.api.properties.size(a)[source]

Return the number of elements along a given axis.

This docstring was copied from numpy.size.

Some inconsistencies with the NumS version may exist.

Parameters

a (BlockArray) – Input data.

Returns

element_count – Number of elements along the specified axis.

Return type

int

See also

shape

dimensions of array

Examples

The doctests shown below are copied from NumPy. They won’t show the correct result until you operate get().

>>> a = nps.array([[1,2,3],[4,5,6]])  
>>> nps.size(a)  
6