[Numpy-discussion] Accessing irregular sized array data from C

Nathaniel Smith njs at pobox.com
Wed Jul 2 15:16:54 EDT 2014


On 2 Jul 2014 20:12, "Sturla Molden" <sturla.molden at gmail.com> wrote:
>
> Julian Taylor <jtaylor.debian at googlemail.com> wrote:
>
> > another thing, don't use int as the index to the array, use npy_intp
> > which is large enough to also index arrays > 4GB if the platform
> > supports it.
>
> With double* a 32-bit int can index 16 GB, a 32-bit unsigned int can index
> 32 GB.
>
> With char* a 32-bit int can only index 2 GB.

Per dimension, if we're talking about addressing.

Numpy internally does all index/stride calculations in units of bytes,
though, so if accessing the data array directly and using strides, the only
reliable approach is to use intp or equivalent.

-n
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20140702/03b8c8b6/attachment.html>


More information about the NumPy-Discussion mailing list