Hello, I have looked around for an answer to this, but havent found exactly what I need. I want to be able to create a structured dtype representing a C struct with non-default alignment. An example struct:
struct *__attribute__((aligned(8)))* float2 { float x; float y; }; I can create dtype with two floats easily enough: float2_dtype = np.dtype( [ ( 'x', 'f4' ), ( 'y', 'f4' ) ], align=True ) but the alignment for this dtype (float2_dtype.alignment) will be 4. This means that if I pack this dtype into another structured dtype I will get alignment errors. What I would really like to do is float2_dtype.alignment = 8 # gives AttributeError: readonly attribute or float2_dtype = np.dtype( [ ( 'x', 'f4' ), ( 'y', 'f4' ) ], align=True, *alignment=8* ) # Invalid keyword argument for dtype() Is there a way to to this? I apologize if I have missed an obvious solution to this issue -- I have grepped around the internet and this mailing list with no success. Thanks keith -- *Selfishness is not living as one wishes to live, it is asking others to live as one wishes to live.- Oscar Wilde*
_______________________________________________ NumPy-Discussion mailing list -- numpy-discussion@python.org To unsubscribe send an email to numpy-discussion-le...@python.org https://mail.python.org/mailman3/lists/numpy-discussion.python.org/ Member address: arch...@mail-archive.com