[Numpy-discussion] structured array with submember assign

2011-12-26 Thread Fabian Dill
Hello! I have a problem with a structured numpy array. I create is like this: tiles = numpy.zeros((header[width], header[height],3), dtype = numpy.uint8) and later on, assignments such as this: tiles[x, y,0] = 3 Now uint8 is not sufficient anymore, but only for the first of the 3 values. uint16

Re: [Numpy-discussion] Indexing empty dimensions with empty arrays

2011-12-26 Thread Ralf Gommers
2011/12/25 Jordi Gutiérrez Hermoso jord...@octave.org I have been instructed to bring this issue to the mailing list: http://projects.scipy.org/numpy/ticket/1994 The issue is this corner case: idx = [] x = np.array([]) x[idx] #works array([], dtype=float64) x[:, idx] #works

Re: [Numpy-discussion] Indexing empty dimensions with empty arrays

2011-12-26 Thread josef . pktd
On Mon, Dec 26, 2011 at 1:51 PM, Ralf Gommers ralf.gomm...@googlemail.com wrote: 2011/12/25 Jordi Gutiérrez Hermoso jord...@octave.org I have been instructed to bring this issue to the mailing list:   http://projects.scipy.org/numpy/ticket/1994 The issue is this corner case: idx = [] x

Re: [Numpy-discussion] Indexing empty dimensions with empty arrays

2011-12-26 Thread Ralf Gommers
On Mon, Dec 26, 2011 at 8:50 PM, josef.p...@gmail.com wrote: On Mon, Dec 26, 2011 at 1:51 PM, Ralf Gommers ralf.gomm...@googlemail.com wrote: 2011/12/25 Jordi Gutiérrez Hermoso jord...@octave.org I have been instructed to bring this issue to the mailing list:

Re: [Numpy-discussion] structured array with submember assign

2011-12-26 Thread Derek Homeier
On 26.12.2011, at 7:37PM, Fabian Dill wrote: I have a problem with a structured numpy array. I create is like this: tiles = numpy.zeros((header[width], header[height],3), dtype = numpy.uint8) and later on, assignments such as this: tiles[x, y,0] = 3 Now uint8 is not sufficient anymore,

Re: [Numpy-discussion] structured array with submember assign

2011-12-26 Thread Fabian Dill
tiles = numpy.zeros((header[width], header[height]), dtype = [(0,u2),(1,|u1),(2,|u1)]) tiles[0][0,0] = 1 that does work now. however it's much slower in assigning and I cannot use integers for the first index. As it's now I might as well do: tiles = [numpy.zeros((header[width],

Re: [Numpy-discussion] Indexing empty dimensions with empty arrays

2011-12-26 Thread Jordi Gutiérrez Hermoso
On 26 December 2011 14:56, Ralf Gommers ralf.gomm...@googlemail.com wrote: On Mon, Dec 26, 2011 at 8:50 PM, josef.p...@gmail.com wrote: I have a hard time thinking through empty 2-dim arrays, and don't know what rules should apply. However, in my code I might want to catch these cases rather

Re: [Numpy-discussion] Indexing empty dimensions with empty arrays

2011-12-26 Thread josef . pktd
2011/12/26 Jordi Gutiérrez Hermoso jord...@octave.org: On 26 December 2011 14:56, Ralf Gommers ralf.gomm...@googlemail.com wrote: On Mon, Dec 26, 2011 at 8:50 PM, josef.p...@gmail.com wrote: I have a hard time thinking through empty 2-dim arrays, and don't know what rules should apply.

[Numpy-discussion] dtype comparison, hash

2011-12-26 Thread Andreas Kloeckner
Hi all, Two questions: - Are dtypes supposed to be comparable (i.e. implement '==', '!=')? - Are dtypes supposed to be hashable? PyCUDA and PyOpenCL assume both in a few places, but at least hashability doesn't seem to be true. (If so, __hash__ should be implemented to throw an error. If not,

Re: [Numpy-discussion] Indexing empty dimensions with empty arrays

2011-12-26 Thread Jordi Gutiérrez Hermoso
On 26 December 2011 19:56, josef.p...@gmail.com wrote: I don't think I ever ran into an empty matrix in matlab, and wouldn't know how it behaves. I think they behave like Octave matrices. I'm not sure about all cases because I don't have access to Matlab, but I think Matlab handles it about