[Numpy-discussion] "aligned" matrix / ctypes

Robert Kern robert.kern@gmail....
Wed Apr 23 16:45:05 CDT 2008


On Wed, Apr 23, 2008 at 4:26 PM, Zachary Pincus <zachary.pincus@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