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 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 functions) and could

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

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 g

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 wrote: > > > On Sun, Nov 8, 2009 at 9:43 PM, David Cournapeau wrote: > >> On Mon, Nov 9, 2009 at 12:49 PM, Charles R Harris >> wrote: >> >> >> >> > >> > Umm, PPC doesn't have ieee quad, it is an amalgam of two doubles. >> >> Good catch ! I added

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 wrote: > On Mon, Nov 9, 2009 at 12:49 PM, Charles R Harris > 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 ha

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],

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 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 npy_nextafterl gives a

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

2009-11-08 Thread Anne Archibald
2009/11/8 David Goldsmith : > On Sun, Nov 8, 2009 at 7:40 PM, Anne Archibald > 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 arr

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 wrote: > On Sun, Nov 8, 2009 at 7:23 PM, wrote: >> >> On Sun, Nov 8, 2009 at 10:03 PM, David Goldsmith >> wrote: >> > OK, now I'm trying to wrap my brain around broadcasting in choose when >> > both >> > `a` *and* `choices` need to be (non-trivial

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 wrote: > On Sun, Nov 8, 2009 at 7:40 PM, Anne Archibald > 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 th

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 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 can't change, but you sho

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

2009-11-08 Thread David Goldsmith
On Sun, Nov 8, 2009 at 7:23 PM, wrote: > On Sun, Nov 8, 2009 at 10:03 PM, David Goldsmith > 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.: > >

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 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 can't change, but you s

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 wrote: > Hi Michael, > > On Thu, Nov 5, 2009 at 2:15 AM, Michael Droettboom > 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 e

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 d

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 doubl

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 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)) # shape is (2,1,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 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, so I'm > will

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) arr

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

2009-11-08 Thread Keith Goodman
On Sun, Nov 8, 2009 at 5:02 PM, Ravi 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 > Out[1]: [[[],

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 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

[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 r

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 wrote: > On Sun, Nov 8, 2009 at 12:57 AM, Anne Archibald > wrote: >> >> 2009/11/8 David Goldsmith : >> > On Sat, Nov 7, 2009 at 11:59 PM, Anne Archibald >> > >> > wrote: >> >> >> >> 2009/11/7 David Goldsmith : >> >> > So in essence, at least as it

[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 :: arg

[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 "/usr/lib64/python2.6/distuti

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 wrote: > David Cournapeau wrote: > > On Fri, Nov 6, 2009 at 6:54 AM, David Goldsmith

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 wrote: > 2009/11/8 David Goldsmith : > > On Sat, Nov 7, 2009 at 11:59 PM, Anne Archibald < > peridot.face...@gmail.com> > > wrote: > >> > >> 2009/11/7 David Goldsmith : > >> > So in essence, at least as it presently functions, the shape of 'a' > >> >

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

2009-11-08 Thread Anne Archibald
2009/11/8 David Goldsmith : > On Sat, Nov 7, 2009 at 11:59 PM, Anne Archibald > wrote: >> >> 2009/11/7 David Goldsmith : >> > 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 par

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 wrote: > 2009/11/7 David Goldsmith : > > 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 parsed into an integer number of such individ

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

2009-11-08 Thread Anne Archibald
2009/11/8 : > On Sat, Nov 7, 2009 at 7:53 PM, David Goldsmith > wrote: >> Thanks, Anne. >> >> On Sat, Nov 7, 2009 at 1:32 PM, Anne Archibald >> wrote: >>> >>> 2009/11/7 David Goldsmith : >> >> >> >>> >>> > Also, my experimenting suggests that the index array ('a', the first >>> > argument in t