Re: [Numpy-discussion] String sort

2008-02-12 Thread Francesc Altet
A Monday 11 February 2008, Charles R Harris escrigué: On Feb 11, 2008 1:15 PM, Francesc Altet [EMAIL PROTECTED] wrote: Here are the results of running it in several platforms: 1) My laptop: Ubuntu 7.1 (gcc 4.1.3, Pentium 4 @ 2 GHz) Benchmark with 100 strings of size 15 C qsort with

Re: [Numpy-discussion] Median advice

2008-02-12 Thread Anne Archibald
On 12/02/2008, Matthew Brett [EMAIL PROTECTED] wrote: Suggestion 1: def median(a, axis=0, out=None) [...] Suggestion 2: def median(a, axis=0, scratch_input=False) No reason not to combine the two. It's a pretty straightforward modification to do the sorting in place, and it could make a lot

Re: [Numpy-discussion] C Extensions, CTypes and external code librarie

2008-02-12 Thread Lou Pecora
--- Albert Strasheim [EMAIL PROTECTED] wrote: Hello, Sounds about right. I don't know the Mac that well as far as the various types of dynamic libraries go, so just check that you're working with the right type of libraries, but you've got the right idea. Regards, Albert Thanks,

Re: [Numpy-discussion] C Extensions, CTypes and external code libraries

2008-02-12 Thread Lou Pecora
--- Jon Wright [EMAIL PROTECTED] wrote: Lou Pecora wrote: ... This appears to be the way static and shared libraries work, especially on Mac OS X, maybe elsewhere. Have you tried linking against a GSL static library? I don't have a mac, but most linkers only pull in the routines

Re: [Numpy-discussion] sort method raises unexpected error with axis=None

2008-02-12 Thread Anne Archibald
On 12/02/2008, Matthew Brett [EMAIL PROTECTED] wrote: Is it possible, in fact, to do an inplace sort on an array with axis=None (ie flat sort)? It is, sometimes; just make an array object to point to the flattened version and sort that: In [16]: b = a[:] In [17]: b.shape = (16,) In [18]:

Re: [Numpy-discussion] sort method raises unexpected error with axis=None

2008-02-12 Thread Anne Archibald
On 12/02/2008, Anne Archibald [EMAIL PROTECTED] wrote: An efficient way to handle in-place (or out-of-place, come to think of it) median along multiple axes is actually to take medians along all axes in succession. That saves you some sorting effort, and some programming effort, and doesn't

Re: [Numpy-discussion] sort method raises unexpected error with axis=None

2008-02-12 Thread Matthew Brett
Hi, To rephrase: Is it possible, in fact, to do an inplace sort on an array with axis=None (ie flat sort)? Should the sort method have its docstring changed to reflect the fact that axis=None is not valid? Matthew On Feb 10, 2008 7:50 PM, Matthew Brett [EMAIL PROTECTED] wrote: Hi, I just

Re: [Numpy-discussion] Median advice

2008-02-12 Thread Matthew Brett
Hi, On Feb 12, 2008 8:48 PM, Anne Archibald [EMAIL PROTECTED] wrote: On 12/02/2008, Matthew Brett [EMAIL PROTECTED] wrote: Suggestion 1: def median(a, axis=0, out=None) [...] Suggestion 2: def median(a, axis=0, scratch_input=False) No reason not to combine the two. It's a pretty

Re: [Numpy-discussion] String sort

2008-02-12 Thread Bruce Southey
Hi, I have a Opteron 248 (2.66GHz) that with gcc 4.1.0 (SUSE10.1?) that gives C qsort with C style compare: 0.65 C qsort with Python style compare: 0.64 NumPy newqsort: 0.36 I did notice that -O3 was essential to get the performance gain as -O2 gave: C qsort with C style compare:

Re: [Numpy-discussion] C Extensions, CTypes and external code libraries

2008-02-12 Thread David Cournapeau
Lou Pecora wrote: --- Jon Wright [EMAIL PROTECTED] wrote: Lou Pecora wrote: ... This appears to be the way static and shared libraries work, especially on Mac OS X, maybe elsewhere. Have you tried linking against a GSL static library? I don't have a mac, but most linkers only pull in

Re: [Numpy-discussion] String sort

2008-02-12 Thread Charles R Harris
On Feb 12, 2008 9:07 AM, Francesc Altet [EMAIL PROTECTED] wrote: A Monday 11 February 2008, Charles R Harris escrigué: I'll check it out when I get home. As I say, it was running about 10% slower on my machine, but if it does better on most platforms it is probably the way to go. We can

Re: [Numpy-discussion] String sort

2008-02-12 Thread Charles R Harris
OK, The new quicksorts are in svn. Francesc, can you check them out? Chuck ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] C Extensions, CTypes and external code librarie

2008-02-12 Thread Albert Strasheim
Hello, On Feb 12, 2008 6:19 PM, Lou Pecora [EMAIL PROTECTED] wrote: Albert, Yes, I think you got the idea right. I want to call my own C code using CTypes interface, then from within my C code call GSL C code, i.e. a C function calling another C function directly. I do *not* want to go

Re: [Numpy-discussion] Median advice

2008-02-12 Thread Robert Kern
On Feb 12, 2008 6:33 AM, Joris De Ridder [EMAIL PROTECTED] wrote: On 12 Feb 2008, at 12:31, Matthew Brett wrote: def median(a, axis=0, out=None) (same signature as max, min etc) I would be slightly in favour of this option. Using the same signature would be convenient in code like def

Re: [Numpy-discussion] C Extensions, CTypes and external code libraries

2008-02-12 Thread Jon Wright
Lou Pecora wrote: ... This appears to be the way static and shared libraries work, especially on Mac OS X, maybe elsewhere. Have you tried linking against a GSL static library? I don't have a mac, but most linkers only pull in the routines you need. For example, using windows and mingw:

Re: [Numpy-discussion] C Extensions, CTypes and external code libraries

2008-02-12 Thread Lou Pecora
Albert Strasheim [EMAIL PROTECTED] wrote: Hello, I only quickly read through the previous thread, but I get that idea that what you want to do is to link your shared library against the the GSL shared library and then access your own library using ctypes. If done like this, you don't need to

[Numpy-discussion] C Extensions, CTypes and external code libraries

2008-02-12 Thread Lou Pecora
First, thanks to all who answered my questions about trying to use a large library with CTypes and my own shared library. The bottom line seems to be this: There is no way to incorporate code external to your own shared library. You have to either pull out the code you want from the static

Re: [Numpy-discussion] CTypes: How to incorporate a library with shared library module?

2008-02-12 Thread Lou Pecora
Damian, Lots of good info there. Thanks very much. -- Lou --- Damian Eads [EMAIL PROTECTED] wrote: Dear Lou, You may want to try using distutils or setuputils, which makes compiling extensions much easier. It does the hard work of finding out which flags are needed to compile

Re: [Numpy-discussion] Median advice

2008-02-12 Thread Joris De Ridder
On 12 Feb 2008, at 12:31, Matthew Brett wrote: def median(a, axis=0, out=None) (same signature as max, min etc) I would be slightly in favour of this option. Using the same signature would be convenient in code like def myfunc(myarray, somefunc): # do stuff ... x =

[Numpy-discussion] asfarray() drops precision (float128-float64) - is it correct?

2008-02-12 Thread dmitrey
As for me, it yields lots of inconveniences (lots of my code should be rewritten, since I didn't know it before): from numpy import * a = array((1.0, 2.0), float128) b=asfarray(a) type(a[0]) #type 'numpy.float128' type(b[0]) #type 'numpy.float64' __version__ '1.0.5.dev4767' Shouldn't it be

Re: [Numpy-discussion] f2py: sharing F90 module data between modules

2008-02-12 Thread Pearu Peterson
On Tue, February 12, 2008 7:52 am, Garry Willgoose wrote: I have a suite of fortran modules that I want to wrap with f2py independently (so they appear to python as seperate imports) but where each module has access to another fortran module (which contains global data that is shared between