Re: [Numpy-discussion] A bug in numpy.random.shuffle?

2013-09-05 Thread josef . pktd
On Thu, Sep 5, 2013 at 9:33 PM, Charles R Harris wrote: > > > > On Thu, Sep 5, 2013 at 3:40 PM, wrote: >> >> >> > >> >> > In [4]: x[0], x[1] = x[1], x[0] >> >> Is this ever predictable? >> sounds to me like the inplace question a few days ago >> result depends on the underlying iterator >> >> >>>

Re: [Numpy-discussion] A bug in numpy.random.shuffle?

2013-09-05 Thread Charles R Harris
On Thu, Sep 5, 2013 at 3:40 PM, wrote: > >> > > >> > In [4]: x[0], x[1] = x[1], x[0] > > Is this ever predictable? > sounds to me like the inplace question a few days ago > result depends on the underlying iterator > > >>> a = np.arange(5*3).reshape((5,3), order='F') > >>> a > array([[ 0, 5, 10]

[Numpy-discussion] Weird behavior of gufuncs

2013-09-05 Thread Jaime Fernández del Río
Hi all, I am seeing some very weird behavior on a gufunc I coded. It has a pretty complicated signature: '(r,c,p),(i,j,k,n),(u,v),(d),(n,q)->(q,r,c)' And a single registered loop function, for types: uint8, uint16, uint16, uintp, uint8->uint8. In general it performs beautifully well, returning

Re: [Numpy-discussion] A bug in numpy.random.shuffle?

2013-09-05 Thread Charles R Harris
On Thu, Sep 5, 2013 at 12:35 PM, Jonathan Helmus wrote: > On 09/05/2013 01:29 PM, Warren Weckesser wrote: > > > > On Thu, Sep 5, 2013 at 2:11 PM, Fernando Perez wrote: > >> Hi all, >> >> I just ran into this rather weird behavior: >> >> http://nbviewer.ipython.org/6453869 >> >> In summary, as fa

Re: [Numpy-discussion] fast_any_all , a trivial but fast/useful helper function for numpy

2013-09-05 Thread Julian Taylor
hi, its not np.any that is slow in this case its np.array([A, B, C]) np.dstack([A, B, C]) is better but writing it like this has the same performance as your code: a = empty([3] list(A.shape) a[0] = A>5; a[1] = B<2; a[2] = A>10; np.any(a, 0) I'll check if creating an array from a sequence can be

Re: [Numpy-discussion] Stick intersection path algorithm

2013-09-05 Thread Josè Luis Mietta
Thanks so much!!   Best regards, José Luis De: Daπid Para: Discussion of Numerical Python Enviado: jueves, 5 de septiembre de 2013 12:56 Asunto: Re: [Numpy-discussion] Stick intersection path algorithm On 5 September 2013 17:03, Josè Luis Mietta wrote: T

Re: [Numpy-discussion] A bug in numpy.random.shuffle?

2013-09-05 Thread Fernando Perez
On Thu, Sep 5, 2013 at 11:43 AM, Charles R Harris wrote: > Oh, nice one ;) Should be fixable if you want to submit a patch. Strategy? One option is to do, for structured arrays, a shuffle of the indices and then an in-place arr = arr[shuffled_indices] But there may be a cleaner/faster way to

Re: [Numpy-discussion] A bug in numpy.random.shuffle?

2013-09-05 Thread Charles R Harris
On Thu, Sep 5, 2013 at 12:35 PM, Jonathan Helmus wrote: > On 09/05/2013 01:29 PM, Warren Weckesser wrote: > > > > On Thu, Sep 5, 2013 at 2:11 PM, Fernando Perez wrote: > >> Hi all, >> >> I just ran into this rather weird behavior: >> >> http://nbviewer.ipython.org/6453869 >> >> In summary, as fa

Re: [Numpy-discussion] A bug in numpy.random.shuffle?

2013-09-05 Thread josef . pktd
>> > >> > In [4]: x[0], x[1] = x[1], x[0] Is this ever predictable? sounds to me like the inplace question a few days ago result depends on the underlying iterator >>> a = np.arange(5*3).reshape((5,3), order='F') >>> a array([[ 0, 5, 10], [ 1, 6, 11], [ 2, 7, 12], [ 3, 8,

Re: [Numpy-discussion] Stick intersection path algorithm

2013-09-05 Thread Josè Luis Mietta
Hi experts! How can I create a networkx graph from the adjacency matrix M?   Thanks a lot, José Luis De: Daπid Para: Discussion of Numerical Python Enviado: jueves, 5 de septiembre de 2013 12:56 Asunto: Re: [Numpy-discussion] Stick intersection path algorit

Re: [Numpy-discussion] A bug in numpy.random.shuffle?

2013-09-05 Thread Charles R Harris
On Thu, Sep 5, 2013 at 2:27 PM, Nathaniel Smith wrote: > On Thu, Sep 5, 2013 at 9:06 PM, Charles R Harris > wrote: > > This behavior is not new, it is also present in 1.6.x > > > > In [1]: x = np.zeros(5, dtype=[('n', 'S1'), ('s', 'S1')]) > > > > In [2]: x['s'] = [c for c in 'abcde'] > > > > In

Re: [Numpy-discussion] A bug in numpy.random.shuffle?

2013-09-05 Thread Charles R Harris
On Thu, Sep 5, 2013 at 1:45 PM, Charles R Harris wrote: > > > > On Thu, Sep 5, 2013 at 1:34 PM, Bradley M. Froehle > wrote: > >> I put this test case through `git bisect run` and here's what came >> back. I haven't confirmed this manually yet, but the blamed commit >> does seem reasonable: >> >>

Re: [Numpy-discussion] A bug in numpy.random.shuffle?

2013-09-05 Thread Nathaniel Smith
On Thu, Sep 5, 2013 at 9:06 PM, Charles R Harris wrote: > This behavior is not new, it is also present in 1.6.x > > In [1]: x = np.zeros(5, dtype=[('n', 'S1'), ('s', 'S1')]) > > In [2]: x['s'] = [c for c in 'abcde'] > > In [3]: x > Out[3]: > array([('', 'a'), ('', 'b'), ('', 'c'), ('', 'd'), ('',

[Numpy-discussion] A bug in numpy.random.shuffle?

2013-09-05 Thread Fernando Perez
Hi all, I just ran into this rather weird behavior: http://nbviewer.ipython.org/6453869 In summary, as far as I can tell, shuffle is misbehaving when acting on arrays that have structured dtypes. I've seen the problem on 1.7.1 (official on ubuntu 13.04) as well as master as of a few minutes ago.

Re: [Numpy-discussion] A bug in numpy.random.shuffle?

2013-09-05 Thread Charles R Harris
On Thu, Sep 5, 2013 at 1:34 PM, Bradley M. Froehle wrote: > I put this test case through `git bisect run` and here's what came > back. I haven't confirmed this manually yet, but the blamed commit > does seem reasonable: > > b26c675e2a91e1042f8f8d634763942c87fbbb6e is the first bad commit > commit

Re: [Numpy-discussion] A bug in numpy.random.shuffle?

2013-09-05 Thread Bradley M. Froehle
I put this test case through `git bisect run` and here's what came back. I haven't confirmed this manually yet, but the blamed commit does seem reasonable: b26c675e2a91e1042f8f8d634763942c87fbbb6e is the first bad commit commit b26c675e2a91e1042f8f8d634763942c87fbbb6e Author: Nathaniel J. Smith

Re: [Numpy-discussion] A bug in numpy.random.shuffle?

2013-09-05 Thread Jonathan Helmus
On 09/05/2013 01:50 PM, Fernando Perez wrote: > On Thu, Sep 5, 2013 at 11:43 AM, Charles R Harris > wrote: > > >> Oh, nice one ;) Should be fixable if you want to submit a patch. > Strategy? One option is to do, for structured arrays, a shuffle of the > indices and then an in-place > > arr = arr[s

Re: [Numpy-discussion] A bug in numpy.random.shuffle?

2013-09-05 Thread Charles R Harris
On Thu, Sep 5, 2013 at 12:50 PM, Fernando Perez wrote: > On Thu, Sep 5, 2013 at 11:43 AM, Charles R Harris > wrote: > > > > Oh, nice one ;) Should be fixable if you want to submit a patch. > > Strategy? One option is to do, for structured arrays, a shuffle of the > indices and then an in-place >

Re: [Numpy-discussion] numpy 1.8.0b1 mkl test_xerbla failure

2013-09-05 Thread Charles R Harris
On Thu, Sep 5, 2013 at 5:34 AM, Neal Becker wrote: > Just want to make sure this post had been noted: > > Neal Becker wrote: > > > Built on fedora linux 19 x86_64 using mkl: > > > > build OK using: > > env ATLAS=/usr/lib64 FFTW=/usr/lib64 BLAS=/usr/lib64 > LAPACK=/usr/lib64 > > CFLAGS="-mtune=nat

Re: [Numpy-discussion] A bug in numpy.random.shuffle?

2013-09-05 Thread Jonathan Helmus
On 09/05/2013 01:29 PM, Warren Weckesser wrote: On Thu, Sep 5, 2013 at 2:11 PM, Fernando Perez > wrote: Hi all, I just ran into this rather weird behavior: http://nbviewer.ipython.org/6453869 In summary, as far as I can tell, shuffle is misbehav

Re: [Numpy-discussion] A bug in numpy.random.shuffle?

2013-09-05 Thread Bradley M. Froehle
Looks like a bug. FWIW, NumPy 1.6.1 on Scientific Linux 6.4 does not suffer from this malady. -Brad $ python Python 2.6.6 (r266:84292, Feb 21 2013, 19:26:11) [GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>>

Re: [Numpy-discussion] A bug in numpy.random.shuffle?

2013-09-05 Thread Warren Weckesser
On Thu, Sep 5, 2013 at 2:11 PM, Fernando Perez wrote: > Hi all, > > I just ran into this rather weird behavior: > > http://nbviewer.ipython.org/6453869 > > In summary, as far as I can tell, shuffle is misbehaving when acting > on arrays that have structured dtypes. I've seen the problem on 1.7.1

Re: [Numpy-discussion] Stick intersection path algorithm

2013-09-05 Thread Josè Luis Mietta
Hi experts! The array ([ 0, 39,  7,  3,  1,  1,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0, 0,  0,  1]) means that in the sistem (graph) are : 4 cluster of size 1, one cluster of size 3, one cluster of size 7 and one cluste of size 39? What does means 'zero' (13 times) in the array? Thans a lo

[Numpy-discussion] dtype "metadata" attribute

2013-09-05 Thread Andrew Collette
Hi, We have a pull request pending at the h5py project to use the dtype "metadata" attribute to implement special type support, as opposed to the current hacked-together solution based on field names: >>> dt = dtype('i', metadata={"key": 42}) >>> dt.metadata However, I can't find documentation

Re: [Numpy-discussion] fast_any_all , a trivial but fast/useful helper function for numpy

2013-09-05 Thread Chris Barker - NOAA Federal
This is good stuff, but I can't help thinking that if I needed to do an any/all test on a number of arrays with common and/or combos -- I'd probably write a Cython function to do it. It could be a bit tricky to make it really general, but not bad for a couple specific dtypes / use cases. -just a

Re: [Numpy-discussion] ANN: Numpy 1.8.0 beta 1 release

2013-09-05 Thread Christoph Gohlke
On 9/5/2013 1:18 AM, Sebastian Berg wrote: > On Wed, 2013-09-04 at 22:08 -0700, Christoph Gohlke wrote: >> On 9/1/2013 9:54 AM, Charles R Harris wrote: > > > >> >> Hello, >> >> is this IndexError intentional in numpy 1.8? Matplotlib 1.3 fails some >> tests because of this. >> > numpy.zeros(1)[

Re: [Numpy-discussion] Error occurance on Skimage 0.9.0 version

2013-09-05 Thread Jaime Fernández del Río
I haven't tried to compile skimage, but the easiest way to get set up for compilation with Windows and MSVC is to follow the instructions in the Cython wiki. It is routinely spammed, so here's a link to the last non-corrupt version as of right now: http://wiki.cython.org/64BitCythonExtensionsOnWin

Re: [Numpy-discussion] Stick intersection path algorithm

2013-09-05 Thread Daπid
On 5 September 2013 17:03, Josè Luis Mietta wrote: > The array ([ 0, 39, 7, 3, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, > 0, 0, 0, 0, 1]) means that in the sistem (graph) are : 4 cluster of > size 1, one cluster of size 3, one cluster of size 7 and one cluste of size > 39? > No, it means

Re: [Numpy-discussion] Error occurance on Skimage 0.9.0 version

2013-09-05 Thread Happyman
Yeap I have installed visual studio, but I am a bit far away from installation and dealing vs such problems.. :)) My computer is Win64. I woulb be grateful if you could give me the steps of installation with some comments for Win64 thanks Четверг, 5 сентября 2013, 16:10 +02:00 от Jerome Kie

Re: [Numpy-discussion] Error occurance on Skimage 0.9.0 version

2013-09-05 Thread Jerome Kieffer
On Thu, 05 Sep 2013 17:35:16 +0400 Happyman wrote: > Hello, > > I downloaded skimage 0.9.0dev version and installed like following on Windows; > cd C:\skimage\python setup.py install. > > One error occurred: Unable to find vcvarsall.bat . It is not the first time I > have been taken such an e

Re: [Numpy-discussion] Stick intersection path algorithm

2013-09-05 Thread Daπid
On 5 September 2013 13:14, Josè Luis Mietta wrote: > 2. Using networkx or other tool: how can I obtain the 'clusters size' > distribution (that is: number of clusters of size 'D', for all > cluster-sizes)? This is best asked in their mailing list. A possible way is: np.bincount([len(i) for i in

Re: [Numpy-discussion] Minimal NumPy for distribution

2013-09-05 Thread Frédéric Bastien
Hi, thanks for the information. It is very useful to know that the c code could call back to python. Fred On Wed, Sep 4, 2013 at 2:14 PM, Nathaniel Smith wrote: > There do exist numpy c functions that call .py file routines. I don't know > how likely you are to find them in practice, but it d

[Numpy-discussion] Error occurance on Skimage 0.9.0 version

2013-09-05 Thread Happyman
Hello, I downloaded skimage 0.9.0dev version and installed like following on Windows; cd C:\skimage\python setup.py install. One error occurred: Unable to find vcvarsall.bat . It is not the first time I have been taken such an error. What is the best way to avoid this problem??? Any answers wi

[Numpy-discussion] numpy 1.8.0b1 mkl test_xerbla failure

2013-09-05 Thread Neal Becker
Just want to make sure this post had been noted: Neal Becker wrote: > Built on fedora linux 19 x86_64 using mkl: > > build OK using: > env ATLAS=/usr/lib64 FFTW=/usr/lib64 BLAS=/usr/lib64 LAPACK=/usr/lib64 > CFLAGS="-mtune=native -march=native -O3" LDFLAGS="-Wl,- > rpath=/opt/intel/mkl/lib/i

Re: [Numpy-discussion] Stick intersection path algorithm

2013-09-05 Thread Josè Luis Mietta
Thanks experts! Thanks Robert Kern! Two more questions about it: 1. networkx.has_path(G, first_stick, second_stick) stop when find second_stick or compute all the sub-graph and then evaluate if first_stick and second_stick are connected? 2. Using networkx or other tool: how can I obtain the 'c

Re: [Numpy-discussion] find appropriate dtype based on a set of values

2013-09-05 Thread Gregorio Bastardo
Hi Stéfan, I ran into a problem: >>> min_typecode( (18446744073709551615L,) ) # ok >>> min_typecode( (0, 18446744073709551615L,) ) # ? Traceback (most recent call last): ... ValueError: Can only handle integer arrays. It seems that np.asarray converts the input sequence into a float64 array in

Re: [Numpy-discussion] fast_any_all , a trivial but fast/useful helper function for numpy

2013-09-05 Thread Graeme B. Bell
Hi Julian, Thanks for the post. It's great to hear that the main numpy function is improving in 1.8, though I think there is still plenty of value here for performance junkies :-) I don't have 1.8beta installed (and I can't conveniently install it on my machines just now). If you have ti

Re: [Numpy-discussion] fast_any_all , a trivial but fast/useful helper function for numpy

2013-09-05 Thread Graeme B. Bell
Hi Robert, Thanks for proposing an alternative implementation approach. However, did you test your proposal before you made the assertion about its behaviour? >reduce(np.logical_or, inputs, False) >reduce(np.logical_and, inputs, True) This code consistently benchmarks 20% slower than the met

Re: [Numpy-discussion] ANN: Numpy 1.8.0 beta 1 release

2013-09-05 Thread Sebastian Berg
On Wed, 2013-09-04 at 22:08 -0700, Christoph Gohlke wrote: > On 9/1/2013 9:54 AM, Charles R Harris wrote: > > Hello, > > is this IndexError intentional in numpy 1.8? Matplotlib 1.3 fails some > tests because of this. > > >>> numpy.zeros(1)[[0], :] > Traceback (most recent call last): >Fi