Re: [Numpy-discussion] Find indices of largest elements

2010-04-15 Thread Nikolaus Rath
eat writes: > Nikolaus Rath rath.org> writes: > > [snip] >> Not quite, because I'm interested in the n largest values over all >> elements, not the largest element in each row or column. But Keith's >> solution seems to work fine, even though I'm still struggling to >> understand what's going on

Re: [Numpy-discussion] rc2 for NumPy 1.4.1 and Scipy 0.7.2

2010-04-15 Thread Ralf Gommers
2010/4/16 Charles سمير Doutriaux > Thx Ralf, > > I was able to get the 64bit version going. But as I mentioned earlier this > doesn't help me since I have other externals dying... > > I'll try the 32bit one again with these hints. > > The dmg installer on sourceforge is 32-bit, so unless you're a

Re: [Numpy-discussion] Numpy+SWIG with arrays in input and output of a function

2010-04-15 Thread Bill Spotz
Antoine, You want a python function with two python array arguments, therefore you are dealing with two different typemaps, each of which requires its own %apply directive: %apply (double* IN_ARRAY1, int DIM1) {(double* vec , int m)}; %apply (double* ARGOUT_ARRAY1, int DIM1) {(double* vec

Re: [Numpy-discussion] rc2 for NumPy 1.4.1 and Scipy 0.7.2

2010-04-15 Thread Charles سمير Doutriaux
Thx Ralf, I was able to get the 64bit version going. But as I mentioned earlier this doesn't help me since I have other externals dying... I'll try the 32bit one again with these hints. Thanks again, C. On Apr 15, 2010, at 4:53 PM, Ralf Gommers wrote: > > 2010/4/16 Charles سمير Doutriaux >

Re: [Numpy-discussion] Find indices of largest elements

2010-04-15 Thread Keith Goodman
On Thu, Apr 15, 2010 at 1:48 PM, Keith Goodman wrote: > On Thu, Apr 15, 2010 at 12:41 PM, Nikolaus Rath wrote: >> Keith Goodman writes: >>> On Wed, Apr 14, 2010 at 12:39 PM, Nikolaus Rath wrote: Keith Goodman writes: > On Wed, Apr 14, 2010 at 8:49 AM, Keith Goodman > wrote:

Re: [Numpy-discussion] rc2 for NumPy 1.4.1 and Scipy 0.7.2

2010-04-15 Thread Ralf Gommers
2010/4/16 Charles سمير Doutriaux > Hi There, > > 1.4.1rc2 > gcc 4.2.1 > > And yes I'm trying to build a 32bit python because a lot of externals seem > to be breaking with the 64bit stuff... > > But I'm giving it another shot building 64bit > For 64-bit the command is: $ LDFLAGS="-arch x86_64" FF

[Numpy-discussion] Numpy+SWIG with arrays in input and output of a function

2010-04-15 Thread Antoine Delmotte
Dear Numpy and SWIG users, I am currently trying to use SWIG and Numpy to launch C++ codes from python. My C++ code takes an array as an input (as well as integers, but this will be my next problem...) and returns a different array (with different dimensions). I have managed to make ve

Re: [Numpy-discussion] Find indices of largest elements

2010-04-15 Thread eat
Nikolaus Rath rath.org> writes: [snip] > Not quite, because I'm interested in the n largest values over all > elements, not the largest element in each row or column. But Keith's > solution seems to work fine, even though I'm still struggling to > understand what's going on there . My bad. I jus

Re: [Numpy-discussion] Find indices of largest elements

2010-04-15 Thread Keith Goodman
On Thu, Apr 15, 2010 at 12:41 PM, Nikolaus Rath wrote: > Keith Goodman writes: >> On Wed, Apr 14, 2010 at 12:39 PM, Nikolaus Rath wrote: >>> Keith Goodman writes: On Wed, Apr 14, 2010 at 8:49 AM, Keith Goodman wrote: > On Wed, Apr 14, 2010 at 8:16 AM, Nikolaus Rath wrote: >> Hell

Re: [Numpy-discussion] Find indices of largest elements

2010-04-15 Thread Nikolaus Rath
Keith Goodman writes: > On Wed, Apr 14, 2010 at 12:39 PM, Nikolaus Rath wrote: >> Keith Goodman writes: >>> On Wed, Apr 14, 2010 at 8:49 AM, Keith Goodman wrote: On Wed, Apr 14, 2010 at 8:16 AM, Nikolaus Rath wrote: > Hello, > > How do I best find out the indices of the larges

Re: [Numpy-discussion] Find indices of largest elements

2010-04-15 Thread Nikolaus Rath
eat writes: >> How do I best find out the indices of the largest x elements in an >> array? > > Just > a= np.asarray([[1, 8, 2], [2, 1, 3]]) > print np.where((a.T== a.max(axis= 1)).T) > > However, if any row contains more than 1 max entity, above will fail. Please > let me to know if that's relev

Re: [Numpy-discussion] simple rectangular grid

2010-04-15 Thread Robert Kern
On Thu, Apr 15, 2010 at 13:42, Neal Becker wrote: > Is there a simple way to create a rectangular grid, like this loopy code: > (This is for a QAM256 constellation, btw): > > import numpy as np > > u = np.arange (-7.5, 8) > > const = np.empty ((16,16), dtype=complex) > > for ix in range (16): >  

Re: [Numpy-discussion] simple rectangular grid

2010-04-15 Thread josef . pktd
On Thu, Apr 15, 2010 at 2:42 PM, Neal Becker wrote: > Is there a simple way to create a rectangular grid, like this loopy code: > (This is for a QAM256 constellation, btw): > > import numpy as np > > u = np.arange (-7.5, 8) > > const = np.empty ((16,16), dtype=complex) > > for ix in range (16): >

[Numpy-discussion] simple rectangular grid

2010-04-15 Thread Neal Becker
Is there a simple way to create a rectangular grid, like this loopy code: (This is for a QAM256 constellation, btw): import numpy as np u = np.arange (-7.5, 8) const = np.empty ((16,16), dtype=complex) for ix in range (16): for iy in range (16): const[ix, iy] = u[ix] + 1j*u[iy] __

Re: [Numpy-discussion] rc2 for NumPy 1.4.1 and Scipy 0.7.2

2010-04-15 Thread Charles سمير Doutriaux
Hi There, 1.4.1rc2 gcc 4.2.1 And yes I'm trying to build a 32bit python because a lot of externals seem to be breaking with the 64bit stuff... But I'm giving it another shot building 64bit C. On Apr 14, 2010, at 5:48 PM, Ralf Gommers wrote: > > > 2010/4/15 Charles سمير Doutriaux > Just

Re: [Numpy-discussion] Math Library

2010-04-15 Thread Keith Goodman
On Wed, Apr 14, 2010 at 9:32 PM, James Bergstra wrote: > On Tue, Apr 6, 2010 at 10:08 AM, David Cournapeau wrote: >> could be put out of multiarray proper. Also, exposing an API for >> things like fancy indexing would be very useful, but I don't know if >> it even makes sense - I think a pure pyth

Re: [Numpy-discussion] use of %extend

2010-04-15 Thread Michel Dupront
Yes. I am really sorry about that. > From: seb.ha...@gmail.com > Date: Thu, 15 Apr 2010 13:24:10 +0200 > To: numpy-discussion@scipy.org > Subject: Re: [Numpy-discussion] use of %extend > > did you mean to send this to the SWIG list !? > -S. > > > On Thu, Apr 15, 2010 at 11:53 AM, Michel Du

Re: [Numpy-discussion] use of %extend

2010-04-15 Thread Sebastian Haase
did you mean to send this to the SWIG list !? -S. On Thu, Apr 15, 2010 at 11:53 AM, Michel Dupront wrote: > Hello, > > With the following example, given in the documentation: > > struct Vector { >    double x,y,z; > }; > %extend Vector { >     Vector __add__(Vector *other) { > Vector v;

[Numpy-discussion] use of %extend

2010-04-15 Thread Michel Dupront
Hello, With the following example, given in the documentation: struct Vector { double x,y,z; }; %extend Vector { Vector __add__(Vector *other) { Vector v; v.x = $self->x + other->x; v.y = $self->y + other->y; v.z = $self->z + other->z; retu