Re: [Numpy-discussion] Returning tuple of numpy arrays from a Numpy C-extension?

2011-12-27 Thread Åke Kullenberg
After diving deeper in the docs I found the PyTuple_New alternative to building tuples instead of Py_BuildValue. It seems to work fine. But I am unsure of the INCREF/DECREF refcounting thing. Will I need any of those in the code below? Also, for generic c extensions, how can I check the

[Numpy-discussion] Returning tuple of numpy arrays from a Numpy C-extension?

2011-12-27 Thread Åke Kullenberg
I have put together a few c extensions following the documentation on http://www.scipy.org/Cookbook/C_Extensions/NumPy_arrays. There is however one thing that stumps me. To illustrate with a simple code snippet, the test function below multiplies the input numpy double array by two. So far so

Re: [Numpy-discussion] dtype comparison, hash

2011-12-27 Thread Robert Kern
On Tue, Dec 27, 2011 at 01:22, Andreas Kloeckner li...@informa.tiker.net wrote: Hi all, Two questions: - Are dtypes supposed to be comparable (i.e. implement '==', '!=')? Yes. - Are dtypes supposed to be hashable? Yes, with caveats. Strictly speaking, we violate the condition that objects

Re: [Numpy-discussion] installing matplotlib in MacOs 10.6.8.

2011-12-27 Thread Chris Barker
I suspect your getting a bit tangled up in the multiple binaries of Python on the Mac. On the python.org site there are two binaries: 32bit, PPC_Intel, OS-X 10.3.9 and above. 32 and 64 bit, Intel only, OS-X 10.6 and above. You need to make sure that you get a matplotlib build for the python

Re: [Numpy-discussion] Returning tuple of numpy arrays from a Numpy C-extension?

2011-12-27 Thread Chris Barker
sorry to be a proselytizer, but this would be trivial with Cython: http://cython.org/ -Chris On Tue, Dec 27, 2011 at 1:52 AM, Åke Kullenberg ake.kullenb...@gmail.com wrote: After diving deeper in the docs I found the PyTuple_New alternative to building tuples instead of Py_BuildValue. It

[Numpy-discussion] Functions vs Methods

2011-12-27 Thread Jaidev Deshpande
Hi It is said that function calls are expensive. Does that mean one must use available methods instead? Eg. x is a NumPy array, and I need its transpose Should I use x.T or numpy.transpose(T) ? Does it matter which one I'm using ? If not, under what conditions does it become important