Re: [Numpy-discussion] Median advice

2008-02-13 Thread Gael Varoquaux
On Tue, Feb 12, 2008 at 09:09:11PM +, Matthew Brett 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,

Re: [Numpy-discussion] String sort

2008-02-13 Thread Francesc Altet
A Tuesday 12 February 2008, Charles R Harris escrigué: On Feb 12, 2008 9:07 AM, Francesc Altet [EMAIL PROTECTED] wrote: * The newqsort performs the best on all the platforms we have checked (ranging from a 5% of improvement on Opteron/SuSe, up to 3.8x with some Pentium4/Ubuntu systems).

Re: [Numpy-discussion] String sort

2008-02-13 Thread Francesc Altet
A Tuesday 12 February 2008, Bruce Southey escrigué: 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 That's very intersting. In a similar configuration,

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

2008-02-13 Thread David Cournapeau
On Feb 14, 2008 12:14 AM, Lou Pecora [EMAIL PROTECTED] wrote: --- David Cournapeau [EMAIL PROTECTED] wrote: Oh, I may have misunderstood what you are trying to do then. You just want to call a shared library from another shared library ? This is possible on any platform supporting

Re: [Numpy-discussion] New bug with setup,py develop

2008-02-13 Thread Charles R Harris
On Feb 11, 2008 9:24 PM, David Cournapeau [EMAIL PROTECTED] wrote: On Mon, 2008-02-11 at 20:42 -0700, Charles R Harris wrote: On Feb 11, 2008 7:10 PM, David Cournapeau [EMAIL PROTECTED] wrote: On Feb 11, 2008 5:40 PM, Charles R Harris [EMAIL PROTECTED] wrote:

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

2008-02-13 Thread Lou Pecora
--- David Cournapeau [EMAIL PROTECTED] wrote: But the real question is : if you are concerned with code bload, why using static lib at all ? Why not using shared library, which is exactly designed to solve what you are trying to do ? cheers, David Yes, a good question. Two reasons I

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

2008-02-13 Thread Lou Pecora
--- David Cournapeau [EMAIL PROTECTED] wrote: Oh, I may have misunderstood what you are trying to do then. You just want to call a shared library from another shared library ? This is possible on any platform supporting shared library (including but not limited to mac os x, windows,

Re: [Numpy-discussion] String sort

2008-02-13 Thread Bruce Southey
Hi, I added gcc 4.2 from the openSUSE 10.1 repository so I now have both the 4.1.2 and 4.2.1 compilers installed. But still have glibc-2.4-31.1 installed. I see your result with 4.2.1 but not with 4.1.2 so I think that there could be a difference in the compiler flags. I don't know enough about

Re: [Numpy-discussion] String sort

2008-02-13 Thread Charles R Harris
On Feb 13, 2008 9:19 AM, Bruce Southey [EMAIL PROTECTED] wrote: Hi, I added gcc 4.2 from the openSUSE 10.1 repository so I now have both the 4.1.2 and 4.2.1 compilers installed. But still have glibc-2.4-31.1 installed. I see your result with 4.2.1 but not with 4.1.2 so I think that there

Re: [Numpy-discussion] String sort

2008-02-13 Thread Charles R Harris
On Feb 13, 2008 10:56 AM, Francesc Altet [EMAIL PROTECTED] wrote: A Wednesday 13 February 2008, Charles R Harris escrigué: OK, The new quicksorts are in svn. Francesc, can you check them out? Looks good here. However, you seem to keep using your own copy_string() instead of plain

Re: [Numpy-discussion] String sort

2008-02-13 Thread Francesc Altet
A Wednesday 13 February 2008, Charles R Harris escrigué: OK, The new quicksorts are in svn. Francesc, can you check them out? Looks good here. However, you seem to keep using your own copy_string() instead of plain memcpy(). In previous benchmarks, I've seen that copy_string() is faster

Re: [Numpy-discussion] String sort

2008-02-13 Thread Charles R Harris
On Feb 13, 2008 12:37 PM, Francesc Altet [EMAIL PROTECTED] wrote: A Wednesday 13 February 2008, Francesc Altet escrigué: A Wednesday 13 February 2008, Bruce Southey escrigué: Hi, I added gcc 4.2 from the openSUSE 10.1 repository so I now have both the 4.1.2 and 4.2.1 compilers

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

2008-02-13 Thread Matthew Brett
Ah, To answer my own question: Suggestion 1: Wrap the .sort method call in a tiny python wrapper of the form: def sort(self, axis=-1, kind='quicksort', order=None): if axis=None: _c_sort(self.ravel(), axis, kind, order) else: _c_sort(self, axis, kind, order) I guess

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

2008-02-13 Thread Matthew Brett
Hi, 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? Sorry to press on, but it would be good to resolve this somehow. Is there some reason not to:

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

2008-02-13 Thread Charles R Harris
On Feb 13, 2008 1:52 PM, Matthew Brett [EMAIL PROTECTED] wrote: Ah, To answer my own question: Suggestion 1: Wrap the .sort method call in a tiny python wrapper of the form: def sort(self, axis=-1, kind='quicksort', order=None): if axis=None: _c_sort(self.ravel(), axis,

Re: [Numpy-discussion] unexpected downcast

2008-02-13 Thread Christopher Barker
Robert Kern wrote: That's just what asfarray is designed to do. If you don't give it a dtype, it uses float64. For the record, it upcasts float32 arrays also. So why does it exist at all? Is is just syntactic sugar for: asarray(a, dtype=float64) Which kind of seems to be not worth it. If,

Re: [Numpy-discussion] unexpected downcast

2008-02-13 Thread Robert Kern
Alan G Isaac wrote: On Tue, 12 Feb 2008, dmitrey apparently wrote: 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' Dmitrey noted an unexpected down cast (above). Is

Re: [Numpy-discussion] String sort

2008-02-13 Thread Scott Ransom
On Wednesday 13 February 2008 02:37:37 pm Francesc Altet wrote: So, I'd say that the guilty is the gcc 4.2.1, 64-bit (or at very least, AMD Opteron architecture) and that newqsort performs really well in general (provided that the compiler can find the best path for optimizing its code).

[Numpy-discussion] test failures

2008-02-13 Thread Charles R Harris
Hi Stefan, I believe these come from your latest commit. File /usr/lib/python2.5/site-packages/numpy/lib/tests/test_ufunclike.py, line 25, in test_ufunclike Failed example: nx.sign(a) Expected: array([ 1., -1., 0., 0., 1., -1.]) Got: array([ 1., -1., -1., 0., 1., -1.])

[Numpy-discussion] Proxy array class and units

2008-02-13 Thread Dan Goodman
Hi all, I'm looking for some advice on how to implement a 'unit checking proxy array'. Background: I'm writing a package to run simulations which make extensive use of linear algebra, for which I'm using numpy. However - it is important to my package that quantities can have dimesions, so I've

[Numpy-discussion] Question for Travis

2008-02-13 Thread Charles R Harris
Travis, I notice that you used PyDataMem_NEW, PyDimMem_NEW, and friends to allocate memory in the sort routines. Is there a good reason to use these rather than malloc? Chuck ___ Numpy-discussion mailing list Numpy-discussion@scipy.org

Re: [Numpy-discussion] Question for Travis

2008-02-13 Thread Travis E. Oliphant
Charles R Harris wrote: Travis, I notice that you used PyDataMem_NEW, PyDimMem_NEW, and friends to allocate memory in the sort routines. Is there a good reason to use these rather than malloc? Only to allow for the possibility of different allocation routines. There is an option to use

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

2008-02-13 Thread Garry Willgoose
Thanks for that. The docs suggest library dl is Unix only. Does that mean this solution will not work on Windows? Windows is on my implementation roadmap but I'm not quite there yet to test it. I guess I am now thinking maybe I can assemble (using f2py) an (aggregated) shared library on the

Re: [Numpy-discussion] Proxy array class and units

2008-02-13 Thread Anne Archibald
On 13/02/2008, Dan Goodman [EMAIL PROTECTED] wrote: Background: I'm writing a package to run simulations which make extensive use of linear algebra, for which I'm using numpy. However - it is important to my package that quantities can have dimesions, so I've written a class Quantity