|
From: Sasha <nd...@ma...> - 2006-02-03 22:04:11
|
On 2/2/06, Travis Oliphant <oli...@ie...> wrote:
> ...
> Here's the issue. With records it is quite easy to generate strides
> that are not integer multiples of the data. For example, a record
> [('field1', 'f8),('field2', 'i2')] data-type would have floating point
> data separated by 10 bytes. When you get a view of field1 (but getting
> that attribute) you would get such a "misaligned" data.
>
> Look at the following:
>
> temp =3D array([(1.8,2),(1.7,3)],dtype=3D'f8,i2')
> temp['f1'].strides
> (10,)
>
> How would you represent that in the element-based strides report?
You are right. I cannot think of anything better than just byte-based
strides in this case. Maybe we could add a restriction
abs(strides[i]) >=3D itemsize? This will probably catch some of the more
common mistakes that are due to using number of elements instead
of number of bytes.
|