Anne Archibald wrote: > Well, it can be done in Python: just allocate a too-big ndarray and > take a slice that's the right shape and has the right alignment. But > this sucks. Stephen G. Johnson posted code earlier in this thread that > provides a portable aligned-memory allocator - it handles the freeing > by (always) storing enough information to recover the original pointer > in the padding space. (This means you always need to pad, which is a > pain, but there's not much you can do about that.) This is indeed no rocket science, I feel a bit ashamed :) I don't see the problem with padding (except wasted time) ? > His implementation > stores the original pointer just before the beginning of the aligned > data, so _aligned_free is free(((void**)ptr)[-1]). If you were worried > about space (rather than time) you could store a single byte just > before the pointer whose value indicated how much padding was done, or > whatever. I really don't see how space would be a problem in our situation: it is not like we will pad more than a few bytes; in the case it is, I don't see how python would be the right choice anymore anyway. I will try to prepare a patch the next few days, then.
cheers, David _______________________________________________ Numpy-discussion mailing list [email protected] http://projects.scipy.org/mailman/listinfo/numpy-discussion
