Re: [Numpy-discussion] Allow == and != to raise errors

2013-07-15 Thread bruno Piguet
ay, if we make all comparison behave like ufunc, there is array_equal > as said to have the python behavior of ==, is it useful to have equivalent > function the other comparison? Do they already exist. > > thanks > > Fred > > > On Mon, Jul 15, 2013 at 10:20 AM, Nathaniel S

Re: [Numpy-discussion] Allow == and != to raise errors

2013-07-15 Thread bruno Piguet
a try/except clause, wouldn't it feel more "natural" to write " np.equal(x, y)" ? Bruno. 2013/7/15 Nathaniel Smith > On Mon, Jul 15, 2013 at 2:09 PM, bruno Piguet > wrote: > > Python itself doesn't raise an exception in such cases : > > &g

Re: [Numpy-discussion] Allow == and != to raise errors

2013-07-15 Thread bruno Piguet
Python itself doesn't raise an exception in such cases : >>> (3,4) != (2, 3, 4) True >>> (3,4) == (2, 3, 4) False Should numpy behave differently ? Bruno. 2013/7/12 Frédéric Bastien > I also don't like that idea, but I'm not able to come to a good reasoning > like Benjamin. > > I don't see

Re: [Numpy-discussion] Could numpy.fromfile() work with gzip-compressed files ?

2010-07-26 Thread bruno Piguet
2010/7/26 bruno Piguet > > - I'm thinking of using something like np.array(f.read(), > dtype=some_type). > Actually : data=np.fromstring(f.read(), dtype=some_type, count=-1) Bruno. ___ NumPy-Discussion mailing list NumPy-Discussi

[Numpy-discussion] Could numpy.fromfile() work with gzip-compressed files ?

2010-07-26 Thread bruno Piguet
Hi all, I've got some code which basically does : f = open (path, 'rb') header = f.read (some_length) data = np.fromfile (f, dtype= some_type, count=-1) In order to process compressed files, I switched the open sequence to : if (plain): f = open (path, 'rb') else: f

Re: [Numpy-discussion] Howto vectorise a dot product ?

2009-06-09 Thread bruno Piguet
2009/6/9 Charles R Harris > > Well, in this case you can use complex multiplication and either work with > just the x,y components or use two complex components, i.e., [x + 1j*y, z]. > In the first case you can then do the rotation as V*exp(1j*phi). In the real case, it's a real 3-axes rotation

[Numpy-discussion] Howto vectorise a dot product ?

2009-06-09 Thread bruno Piguet
Dear all, Can someone point me to a doc on dot product vectorisation ? Here is what I try to do : I've got a rotation function which looks like : def rotat_scal(phi, V): s = math.sin(phi) c = math.cos(phi) M = np.zeros((3, 3)) M[2, 2] = M[1, 1] = c M[1, 2] = -s M[2, 1

[Numpy-discussion] loadtxt example problem ?

2009-05-04 Thread bruno Piguet
Hello, I'm new to numpy, and considering using loadtxt() to read a data file. As a starter, I tried the example of the doc page ( http://docs.scipy.org/doc/numpy/reference/generated/numpy.loadtxt.html) : >>> from StringIO import StringIO # StringIO behaves like a file object >>> c = Strin