Re: [Numpy-discussion] Viewing a float64 array with a float32 array

2012-03-21 Thread Zachary Pincus
> I'm not sure if you are referring to rounding errors but that's OK with > me. > > I was thinking something along the lines of changing how numpy looks at > the data of A's view by modifying say the stride attribute, etc. Yes, so was I. As you can see in my example with ints below, you could ski

Re: [Numpy-discussion] Viewing a float64 array with a float32 array

2012-03-21 Thread Hugo Gagnon
I'm not sure if you are referring to rounding errors but that's OK with me. I was thinking something along the lines of changing how numpy looks at the data of A's view by modifying say the stride attribute, etc. -- Hugo Gagnon On Wed, Mar 21, 2012, at 11:19, Zachary Pincus wrote: > > Hi, > >

Re: [Numpy-discussion] Viewing a float64 array with a float32 array

2012-03-21 Thread Zachary Pincus
> Hi, > > Is it possible to have a view of a float64 array that is itself float32? > So that: > A = np.arange(5, dtype='d') A.view(dtype='f') > > would return a size 5 float32 array looking at A's data? I think not. The memory layout of a 32-bit IEEE float is not a subset of that of

[Numpy-discussion] Viewing a float64 array with a float32 array

2012-03-21 Thread Hugo Gagnon
Hi, Is it possible to have a view of a float64 array that is itself float32? So that: >>> A = np.arange(5, dtype='d') >>> A.view(dtype='f') would return a size 5 float32 array looking at A's data? Thanks, -- Hugo Gagnon ___ NumPy-Discussion mailing