Re: [Numpy-discussion] vectorizing loops

2007-10-29 Thread David Cournapeau
Timothy Hochberg wrote: > > > On 10/29/07, *Christopher Barker* <[EMAIL PROTECTED] > > wrote: > > >> (incidently, the kind of things 'we' are doing seem like the most > > simple things to JIT). > > Wouldn't a numpy-aware psyco be cool then? > > Oh well, I'

[Numpy-discussion] numpy version and numpy.asarray behavior issue

2007-10-29 Thread Ray S
I just installed 1.0.3.1 on top of Enthought's and asarray() works. But... Although the creation of an array from an address via a Dummy class is kosher in one process (as in the previous attachment), it fails across processes - the array is created, but gives a "Python has generated errors" w

[Numpy-discussion] numpy version and numpy.asarray behavior issue

2007-10-29 Thread Ray S
I have 2 PCs with 2 different installs: ActivePython 2.4.3 Build 12 with numpy version '1.0b1' and Enthought 2.4.3 (1.0.0 #69) with numpy version '0.9.7.2476' The attached runs Ok on numpy v1.0, but on Enthought's, print a1[0] gives: IndexError: 0-d arrays can't be indexed. It seems that the

Re: [Numpy-discussion] Getting an item in an array with its coordinates given by another array

2007-10-29 Thread Matthieu Brucher
> > In this case the constructor > > tuple(arr) > > should work just fine. > Sorry, I didn't know it could work (shame on me I should have tested). -- French PhD student Website : http://miles.developpez.com/ Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92 ___

Re: [Numpy-discussion] Getting an item in an array with its coordinates given by another array

2007-10-29 Thread Travis E. Oliphant
> > Thank you, I have my explanation, but perhaps a totuple() method could > be added so that a double conversion is not needed anymore when an > array is used for indexing ? In this case the constructor tuple(arr) should work just fine. The tolist() method is really more useful for converti

Re: [Numpy-discussion] vectorizing loops

2007-10-29 Thread Timothy Hochberg
On 10/29/07, Christopher Barker <[EMAIL PROTECTED]> wrote: > > >> (incidently, the kind of things 'we' are doing seem like the most > > simple things to JIT). > > Wouldn't a numpy-aware psyco be cool then? > > Oh well, I'm not going to write it! > > (though as I think about it, for the special case

Re: [Numpy-discussion] vectorizing loops

2007-10-29 Thread Christopher Barker
>> (incidently, the kind of things 'we' are doing seem like the most > simple things to JIT). Wouldn't a numpy-aware psyco be cool then? Oh well, I'm not going to write it! (though as I think about it, for the special case of a contiguous array, it would be awfully similar to an array.array --

Re: [Numpy-discussion] Getting an item in an array with its coordinates given by another array

2007-10-29 Thread Matthieu Brucher
> > What do you mean by "item" in an array? Usually, when I refer to an > "item" in the array, I'm talking about getting a particular element of > the array. In fact, I have a multi-dimensional array, and the last dimension is the vector I want to get (I needed it for tests for my dense deforma

Re: [Numpy-discussion] Getting an item in an array with its coordinates given by another array

2007-10-29 Thread Travis E. Oliphant
Matthieu Brucher wrote: > Hi, > > I'm trying to get an item in an array when I only have another array > giving the position. > > For instance: > > >>> c = numpy.arange(0., 3*4*5).reshape((3,4,5)) > >>> c***(numpy.array ((2,3), dtype=int)) > [55, 56, 57, 58, 59] > > I'm trying to figure what to pu

[Numpy-discussion] More intel about the bug "Reference count error detected"

2007-10-29 Thread Matthieu Brucher
Hi, Instead of using : xp = (x-self.loc) * (1/self.scale) I've decided to use : xp = (x-self.loc) / self.scale and by some miracle, the bug does not show up in almost all tests. Before this bug, the program seems to be hung in a DOUBLE_substract function() for quite some time (umathmodule.c file)

Re: [Numpy-discussion] Getting an item in an array with its coordinates given by another array

2007-10-29 Thread Timothy Hochberg
On 10/28/07, Matthieu Brucher <[EMAIL PROTECTED]> wrote: > > > Little correction, only c[(2,3)] gives me what I expect, not c[[2,3]], > > which > > > is even stranger. > > > > c[(2,3)] is the same as c[2,3] and obviously works as you expected. > > > > Well, this is not indicated in the documentatio

[Numpy-discussion] numpy distutils patch

2007-10-29 Thread Jarrod Millman
Hey, I was looking at numpy/distutils/ccompiler.py and noticed that it has a fix for distutils.util.split_quoted. Here is the relevant code from split_quoted in numpy.distutils.ccompiler: --- def split_quoted(s): if _has_white_re.search(s[beg+1:end-1]

Re: [Numpy-discussion] Getting an item in an array with its coordinates given by another array

2007-10-29 Thread Matthieu Brucher
> > > But if I have the coordinates of the points in an array, I have to > reshape it > > and then convert it into a list. Or convert it into a list and then > convert it > > to a tuple. I know that advanced indexing is useful, but here it is not > > coherent. tuples and lists should have the same

Re: [Numpy-discussion] Getting an item in an array with its coordinates given by another array

2007-10-29 Thread Christian K .
Matthieu Brucher gmail.com> writes: > But if I have the coordinates of the points in an array, I have to reshape it > and then convert it into a list. Or convert it into a list and then convert it > to a tuple. I know that advanced indexing is useful, but here it is not > coherent. tuples and lis

Re: [Numpy-discussion] Error in deallocation ?

2007-10-29 Thread Matthieu Brucher
It seems this could be a deadlock somewhere ? The line 835 is where threads are allowed. I had another problem today with the same instruction ((x-self.loc) * (1/self.scale)), the computation just hung. I'm trying to test without the thread lock. Matthieu 2007/10/19, Matthieu Brucher <[EMAIL PROT

Re: [Numpy-discussion] Getting an item in an array with its coordinates given by another array

2007-10-29 Thread [EMAIL PROTECTED]
Take a look at numpy.ix_ http://www.scipy.org/Numpy_Example_List_With_Doc#head-603de8bdb62d0412798c45fe1db0648d913c8a9c This method creates the index array for you. You only have to specify the coordinates in each dimesion. Bernhard On Oct 29, 8:46 am, "Matthieu Brucher" <[EMAIL PROTECTED]> wrot