[Numpy-discussion] Memory layout of record arrays

David Cournapeau cournape at gmail.com
Thu Jul 30 12:52:46 EDT 2009


On Fri, Jul 31, 2009 at 12:53 AM, Nicolas
Rougier<Nicolas.Rougier at loria.fr> wrote:
>
>
> Hello,
>
> I've been using record arrays to create arrays with different types
> and since I'm doing a lot of computation on each of the different
> fields, the default memory layout does not serve my computations.
> Ideally, I would like to have record arrays where each field is a
> contiguous block of memory.

I don't think you can do it with record arrays: one of the fundamental
design choice of numpy array layout is that the data pointer points to
one block of N items, where each item is described by the dtype. To
have contiguous layout for each member of the structured dtype, you
need two arrays with the corresponding dtype.

cheers,

David



More information about the NumPy-Discussion mailing list