Re: [Numpy-discussion] Use-case for np.choose

2009-11-08 Thread Anne Archibald
2009/11/8 josef.p...@gmail.com: On Sat, Nov 7, 2009 at 7:53 PM, David Goldsmith d.l.goldsm...@gmail.com wrote: Thanks, Anne. On Sat, Nov 7, 2009 at 1:32 PM, Anne Archibald peridot.face...@gmail.com wrote: 2009/11/7 David Goldsmith d.l.goldsm...@gmail.com: snip Also, my

Re: [Numpy-discussion] Use-case for np.choose

2009-11-08 Thread David Goldsmith
On Sat, Nov 7, 2009 at 11:59 PM, Anne Archibald peridot.face...@gmail.comwrote: 2009/11/7 David Goldsmith d.l.goldsm...@gmail.com: So in essence, at least as it presently functions, the shape of 'a' *defines* what the individual choices are within 'choices`, and if 'choices' can't be

Re: [Numpy-discussion] Use-case for np.choose

2009-11-08 Thread Anne Archibald
2009/11/8 David Goldsmith d.l.goldsm...@gmail.com: On Sat, Nov 7, 2009 at 11:59 PM, Anne Archibald peridot.face...@gmail.com wrote: 2009/11/7 David Goldsmith d.l.goldsm...@gmail.com: So in essence, at least as it presently functions, the shape of 'a' *defines* what the individual choices

Re: [Numpy-discussion] Use-case for np.choose

2009-11-08 Thread David Goldsmith
On Sun, Nov 8, 2009 at 12:57 AM, Anne Archibald peridot.face...@gmail.comwrote: 2009/11/8 David Goldsmith d.l.goldsm...@gmail.com: On Sat, Nov 7, 2009 at 11:59 PM, Anne Archibald peridot.face...@gmail.com wrote: 2009/11/7 David Goldsmith d.l.goldsm...@gmail.com: So in essence, at

Re: [Numpy-discussion] Random int64 and float64 numbers

2009-11-08 Thread David Goldsmith
Thanks, Sturla, you've confirmed what I thought was the case (and explained more thoroughly the answer others gave more succinctly, but also more opaquely). :-) DG On Sat, Nov 7, 2009 at 11:40 AM, Sturla Molden stu...@molden.no wrote: David Cournapeau wrote: On Fri, Nov 6, 2009 at 6:54 AM,

[Numpy-discussion] distutils, fcompiler and Mayavi

2009-11-08 Thread Nadav Horesh
Hi all, Recentrly I tried to install mayavi-3,3,0, and it failed with a long chain of error messages ended with . . . File /usr/lib64/python2.6/site-packages/numpy/distutils/command/config_compiler.py, line 66, in finalize_options v = getattr(c,a) File

[Numpy-discussion] f2py function callback: error while using repeated arguments in function call

2009-11-08 Thread Yves Frederix
Hi, I am doing a simple function callback from fortran to python for which the actual function call in fortran has repeated arguments. ! callback_error.f90: subroutine testfun(x)    double precision, intent(in) :: x    double precision :: y !f2py intent(callback) foo !f2py double precision ::

Re: [Numpy-discussion] Use-case for np.choose

2009-11-08 Thread josef . pktd
On Sun, Nov 8, 2009 at 5:00 AM, David Goldsmith d.l.goldsm...@gmail.com wrote: On Sun, Nov 8, 2009 at 12:57 AM, Anne Archibald peridot.face...@gmail.com wrote: 2009/11/8 David Goldsmith d.l.goldsm...@gmail.com: On Sat, Nov 7, 2009 at 11:59 PM, Anne Archibald peridot.face...@gmail.com

[Numpy-discussion] problem with FortranFile

2009-11-08 Thread Brennan Williams
I'm using FortranFile to read a binary Fortran file. It has a bit of header data at the top of the file which I'm reading with a combination of readString and struct.unpack This is then followed by a number of lines/records, each of which has 20 double precision reals/floats. For some reason it

Re: [Numpy-discussion] initializing an array of lists

2009-11-08 Thread alan
On 11/7/2009 10:56 PM, a...@ajackson.org wrote: I want to build a 2D array of lists, and so I need to initialize the array with empty lists : myarray = array([[[],[],[]] ,[[],[],[]]]) [[[] for i in range(3)] for j in range(2) ] fwiw, Alan Isaac Thanks! I like that - concise and a little

Re: [Numpy-discussion] initializing an array of lists

2009-11-08 Thread Ravi
On Saturday 07 November 2009 22:56:29 a...@ajackson.org wrote: I want to build a 2D array of lists, and so I need to initialize the array with empty lists : myarray = array([[[],[],[]] ,[[],[],[]]]) In [1]: [[[]]*3]*2 Out[1]: [[[], [], []], [[], [], []]] Hope this helps. Ravi

Re: [Numpy-discussion] initializing an array of lists

2009-11-08 Thread Keith Goodman
On Sun, Nov 8, 2009 at 5:02 PM, Ravi lists_r...@lavabit.com wrote: On Saturday 07 November 2009 22:56:29 a...@ajackson.org wrote: I want to build a 2D array of lists, and so I need to initialize the array with empty lists : myarray = array([[[],[],[]] ,[[],[],[]]]) In [1]: [[[]]*3]*2

Re: [Numpy-discussion] Use-case for np.choose

2009-11-08 Thread David Goldsmith
OK, now I'm trying to wrap my brain around broadcasting in choose when both `a` *and* `choices` need to be (non-trivially) broadcast in order to arrive at a common shape, e.g.: c=np.arange(4).reshape((2,1,2)) # shape is (2,1,2) a=np.eye(2, dtype=int) # shape is (2,2) np.choose(a,c) array([[2,

Re: [Numpy-discussion] Solaris Sparc build broken

2009-11-08 Thread David Cournapeau
Hi Michael, On Thu, Nov 5, 2009 at 2:15 AM, Michael Droettboom md...@stsci.edu wrote: I'm getting the following from r7603 on Solaris Sparc -- somehow related to not having a long double version of next after available.  I realise not everyone has access to (or is dependent on) this platform,

Re: [Numpy-discussion] Use-case for np.choose

2009-11-08 Thread josef . pktd
On Sun, Nov 8, 2009 at 10:03 PM, David Goldsmith d.l.goldsm...@gmail.com wrote: OK, now I'm trying to wrap my brain around broadcasting in choose when both `a` *and* `choices` need to be (non-trivially) broadcast in order to arrive at a common shape, e.g.: c=np.arange(4).reshape((2,1,2)) #

Re: [Numpy-discussion] Use-case for np.choose

2009-11-08 Thread Anne Archibald
As Josef said, this is not correct. I think the key point of confusion is this: Do not pass choose two arrays. Pass it one array and a *list* of arrays. The fact that choices can be an array is a quirk we can't change, but you should think of the second argument as a list of arrays, possibly of

Re: [Numpy-discussion] Solaris Sparc build broken

2009-11-08 Thread Charles R Harris
On Sun, Nov 8, 2009 at 8:12 PM, David Cournapeau courn...@gmail.com wrote: Hi Michael, On Thu, Nov 5, 2009 at 2:15 AM, Michael Droettboom md...@stsci.edu wrote: I'm getting the following from r7603 on Solaris Sparc -- somehow related to not having a long double version of next after

Re: [Numpy-discussion] Use-case for np.choose

2009-11-08 Thread josef . pktd
On Sun, Nov 8, 2009 at 10:40 PM, Anne Archibald peridot.face...@gmail.com wrote: As Josef said, this is not correct. I think the key point of confusion is this: Do not pass choose two arrays. Pass it one array and a *list* of arrays. The fact that choices can be an array is a quirk we

Re: [Numpy-discussion] problem with FortranFile

2009-11-08 Thread Neil Martinsen-Burrell
On 2009-11-08 17:33 , Brennan Williams wrote: I'm using FortranFile to read a binary Fortran file. It has a bit of header data at the top of the file which I'm reading with a combination of readString and struct.unpack This is then followed by a number of lines/records, each of which has 20

Re: [Numpy-discussion] Use-case for np.choose

2009-11-08 Thread David Goldsmith
On Sun, Nov 8, 2009 at 7:23 PM, josef.p...@gmail.com wrote: On Sun, Nov 8, 2009 at 10:03 PM, David Goldsmith d.l.goldsm...@gmail.com wrote: OK, now I'm trying to wrap my brain around broadcasting in choose when both `a` *and* `choices` need to be (non-trivially) broadcast in order to

Re: [Numpy-discussion] Use-case for np.choose

2009-11-08 Thread David Goldsmith
On Sun, Nov 8, 2009 at 7:40 PM, Anne Archibald peridot.face...@gmail.comwrote: As Josef said, this is not correct. I think the key point of confusion is this: Do not pass choose two arrays. Pass it one array and a *list* of arrays. The fact that choices can be an array is a quirk we can't

Re: [Numpy-discussion] Use-case for np.choose

2009-11-08 Thread David Goldsmith
On Sun, Nov 8, 2009 at 8:08 PM, David Goldsmith d.l.goldsm...@gmail.comwrote: On Sun, Nov 8, 2009 at 7:40 PM, Anne Archibald peridot.face...@gmail.comwrote: As Josef said, this is not correct. I think the key point of confusion is this: Do not pass choose two arrays. Pass it one array

Re: [Numpy-discussion] Use-case for np.choose

2009-11-08 Thread josef . pktd
On Sun, Nov 8, 2009 at 10:57 PM, David Goldsmith d.l.goldsm...@gmail.com wrote: On Sun, Nov 8, 2009 at 7:23 PM, josef.p...@gmail.com wrote: On Sun, Nov 8, 2009 at 10:03 PM, David Goldsmith d.l.goldsm...@gmail.com wrote: OK, now I'm trying to wrap my brain around broadcasting in choose when

Re: [Numpy-discussion] Use-case for np.choose

2009-11-08 Thread Anne Archibald
2009/11/8 David Goldsmith d.l.goldsm...@gmail.com: On Sun, Nov 8, 2009 at 7:40 PM, Anne Archibald peridot.face...@gmail.com wrote: As Josef said, this is not correct. I think the key point of confusion is this: Do not pass choose two arrays. Pass it one array and a *list* of arrays. The

Re: [Numpy-discussion] Solaris Sparc build broken

2009-11-08 Thread David Cournapeau
On Mon, Nov 9, 2009 at 12:49 PM, Charles R Harris charlesr.har...@gmail.com wrote: Umm, PPC doesn't have ieee quad, it is an amalgam of two doubles. Good catch ! I added a new type define for this case, with the corresponding union. I have quickly tested it under rosetta, and it seems that

Re: [Numpy-discussion] Use-case for np.choose

2009-11-08 Thread David Goldsmith
OK, let me see if I'm interpreting this example correctly: c1=np.arange(2).reshape(2,1,1); c1 array([[[0]], [[1]]]) c2=2+np.arange(2).reshape(1,1,2); c2 array([[[2, 3]]]) a=np.eye(2,dtype=int) np.choose(a, [c1, c2]) array([[[2, 0], [0, 3]], [[2, 1], [1, 3]]])

Re: [Numpy-discussion] Solaris Sparc build broken

2009-11-08 Thread Charles R Harris
On Sun, Nov 8, 2009 at 9:43 PM, David Cournapeau courn...@gmail.com wrote: On Mon, Nov 9, 2009 at 12:49 PM, Charles R Harris charlesr.har...@gmail.com wrote: Umm, PPC doesn't have ieee quad, it is an amalgam of two doubles. Good catch ! I added a new type define for this case, with the

Re: [Numpy-discussion] Solaris Sparc build broken

2009-11-08 Thread Charles R Harris
On Sun, Nov 8, 2009 at 10:11 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Sun, Nov 8, 2009 at 9:43 PM, David Cournapeau courn...@gmail.comwrote: On Mon, Nov 9, 2009 at 12:49 PM, Charles R Harris charlesr.har...@gmail.com wrote: Umm, PPC doesn't have ieee quad, it is an

Re: [Numpy-discussion] Solaris Sparc build broken

2009-11-08 Thread David Cournapeau
Charles R Harris wrote: I don't remember how PPC does it's arithmetic with the two doubles, but one holds small values that are added to the other double, so I don't think it can be just like a double in some circumstances. That's not how it seems to work on mac os x - when I look at the

Re: [Numpy-discussion] Solaris Sparc build broken

2009-11-08 Thread Charles R Harris
On Sun, Nov 8, 2009 at 10:04 PM, David Cournapeau da...@ar.media.kyoto-u.ac.jp wrote: Charles R Harris wrote: I don't remember how PPC does it's arithmetic with the two doubles, but one holds small values that are added to the other double, so I don't think it can be just like a double

Re: [Numpy-discussion] Accessing LAPACK and BLAS from the numpy C API

2009-11-08 Thread Fernando Perez
On Sat, Nov 7, 2009 at 12:41 PM, Sturla Molden stu...@molden.no wrote: You find a C function pointer wrapped in a CObject in the ._cpointer attribute. Sorry, in the ._cpointer attribute of what precisely? I tried introspecting in various parts of np.linalg (down to the 'bare' lapack_lite