[Numpy-discussion] problem with view() and strided arrays?
Thu Apr 24 11:00:24 CDT 2008
> It seems like 'view' won't create a view where the stride length is
> not a whole multiple of the dtype's itemsize. However, since strides
> are measured in bytes (right?), this shouldn't be a problem.
Actually -- it seems like view() doesn't work with strided arrays at
In : a = numpy.ones((4,32), dtype=numpy.uint8)
In : a.view(numpy.uint16).shape
Out: (4, 16)
In : a[:,:16].view(numpy.uint16)
ValueError: new type not compatible with array.
I think this might be a recent regression, because before I updated my
numpy installation to the latest SVN version (to check if the bug was
fixed!), I'm pretty sure this kind of operation worked.
More information about the Numpy-discussion