[Numpy-discussion] dimensions of zero length

Konrad Hinsen hinsen at cnrs-orleans.fr
Sun Nov 24 10:04:04 EST 2002


<verveer at embl-heidelberg.de> writes:

> I noticed that in Numeric and in numarray it is possible to create
> arrays with axes of zero length. For instance: zeros([1, 0]). There
> seems not be much that can be done with them. What is the reason for
> their existence?

They often result as special cases from some operations. Think of them
as the array equivalents of empty lists.

Creating zero-size arrays explicitly can be useful when suitable
starting values for iterations are needed.

> My real question is: When writing an extension in C, how to deal with such 
> arrays? Should I treat them as empty arrays, that do not have any data?

Exactly.

Konrad.




More information about the NumPy-Discussion mailing list