[Numpy-discussion] "aligned" matrix / ctypes

Robert Kern robert.kern at gmail.com
Wed Apr 23 17:45:05 EDT 2008


On Wed, Apr 23, 2008 at 4:26 PM, Zachary Pincus <zachary.pincus at yale.edu> wrote:
[ I wrote]
>  > To solve the initial alignment, you overallocate a 1D array by 3 bytes
>  > and find the offset from the allocated initial address which is
>  > correctly aligned.
>
>  Sorry -- I haven't had to ever concern myself with alignment before
>  this, so I'm not sure how to go about this step. Do I just look at the
>  raw pointer address and see what offset I need to give it to get it to
>  be divisible by four?

Yes.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
 -- Umberto Eco



More information about the NumPy-Discussion mailing list