[Numpy-discussion] Memory layout of record arrays

Nicolas Rougier Nicolas.Rougier@loria...
Thu Jul 30 13:01:11 CDT 2009



Thanks for the quick answer. It makes sense.
I will have to find some other way to do it then.

Nicolas


On 30 Jul, 2009, at 18:52 , David Cournapeau wrote:

> On Fri, Jul 31, 2009 at 12:53 AM, Nicolas
> Rougier<Nicolas.Rougier@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
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion



More information about the NumPy-Discussion mailing list