Re: [Numpy-discussion] [cython-users] errors with numpy 1.5.1

2011-03-08 Thread Robert Bradshaw
On Fri, Mar 4, 2011 at 4:19 PM, Choy matthew.i...@gmail.com wrote: Hello -- I recently upgraded from python 2.6 - 2.7, cython 0.13 - 14.1, and numpy 1.4.1 - 1.5.1.  Unfortunately, one of my cython modules no longer works. I tracked my bug and used the web to see that there is already a

Re: [Numpy-discussion] [cython-users] errors with numpy 1.5.1

2011-03-08 Thread Pauli Virtanen
Tue, 08 Mar 2011 00:12:35 -0800, Robert Bradshaw wrote: [clip] Unfortunately, I don't think anyone's actively working on it right now. It's probably a superficial fix for someone who knows NumPy and Cython decently well, but I have no idea myself (not having looked that deeply into it.) Does

Re: [Numpy-discussion] rewriting NumPy code in C or C++ or similar

2011-03-08 Thread Sebastien Binet
On Mon, 7 Mar 2011 23:07:32 -0500, Dan Halbert halb...@halwitz.org wrote: On 3/7/2011 9:25 PM, Nathaniel Smith wrote: On Mon, Mar 7, 2011 at 3:36 PM, Dan Halberthalb...@halwitz.org wrote: Or is there some higher-level compiled array language that looks something like NumPy code? You

[Numpy-discussion] Boolean indexing

2011-03-08 Thread Sam Tygier
Hi I am having an issue with boolean slicing. it seems to work fine for reading a value, but I can use it to set a value: import numpy b = numpy.array([[1,2],[3,4],[5,6],[7,8],[9,10]]) m = numpy.array([0,1,0,0,0], dtype=bool) print b[m] print b[m][0,0] b[m][0,0] = -1 print b[m][0,0] I think

[Numpy-discussion] [ANN] Bento 0.0.5, a packaging solution for python software

2011-03-08 Thread David Cournapeau
Hi, I am pleased to announce a new release of bento, a packaging solution for python which aims at reproducibility, extensibility and simplicity. You can take a look at its main features on bento's main documentation page (http://cournape.github.com/Bento). The main features of this 0.0.5

Re: [Numpy-discussion] rewriting NumPy code in C or C++ or similar

2011-03-08 Thread Sturla Molden
Den 08.03.2011 05:05, skrev Dan Halbert: Thanks, that's a good suggestion. I have not written Fortran since 1971, but it's come a long way. I was a little worried about the row-major vs column-major issue, but perhaps that can be handled just by remembering to reverse the subscript order

Re: [Numpy-discussion] Boolean indexing

2011-03-08 Thread Sturla Molden
Den 08.03.2011 14:59, skrev Sam Tygier: I think the boolean slicing is making a copy instead of a view. Yes. is there a way around this? A boolean slice cannot be indexed with the dot product of dimensions and strides, hence the copy. You probably want to use masked arrays instead. Sturla

Re: [Numpy-discussion] Boolean indexing

2011-03-08 Thread Sam Tygier
2011-03-08 14:29:07 GMT, Sturla Molden: A boolean slice cannot be indexed with the dot product of dimensions and strides, hence the copy. You probably want to use masked arrays instead. Masked array does not seem to help. when i do: am = numpy.ma.array(a, mask=a[n]['name']==foo) am['x'] += 1

Re: [Numpy-discussion] Boolean indexing

2011-03-08 Thread Robert Kern
On Tue, Mar 8, 2011 at 07:59, Sam Tygier sam.tyg...@hep.manchester.ac.uk wrote: Hi I am having an  issue with boolean slicing. it seems to work fine for reading a value, but I can use it to set a value: import numpy b =  numpy.array([[1,2],[3,4],[5,6],[7,8],[9,10]]) m =

Re: [Numpy-discussion] How to sum weighted matrices

2011-03-08 Thread Nicolas SCHEFFER
Or just with a dot: === In [17]: np.tensordot(weights, matrices, (0,0)) Out[17]: array([[ 5., 5., 5.], [ 5., 5., 5.]]) In [18]: np.dot(matrices.T,weights).T Out[18]: array([[ 5., 5., 5.], [ 5., 5., 5.]]) == make matrices.T C_CONTIGUOUS for maximum speed. -n On Mon, Mar

[Numpy-discussion] Is there a memory-efficient alternative to choose?

2011-03-08 Thread Josh Hykes
Hello, I am writing a small PDE code in Python using a Cartesian mesh. Each mesh cell is one of a few materials, with associated properties. I store these properties in a dictionary and have a mesh map that tells me which material is in each cell. At some point in my code, I need to do a

[Numpy-discussion] Is this the optimal way to take index along a single axis?

2011-03-08 Thread Jonathan Taylor
I am wanting to use an array b to index into an array x with dimension bigger by 1 where the element of b indicates what value to extract along a certain direction. For example, b = x.argmin(axis=1). Perhaps I want to use b to create x.min(axis=1) but also to index perhaps another array of the

Re: [Numpy-discussion] Is this the optimal way to take index along a single axis?

2011-03-08 Thread josef . pktd
On Tue, Mar 8, 2011 at 3:03 PM, Jonathan Taylor jonathan.tay...@utoronto.ca wrote: I am wanting to use an array b to index into an array x with dimension bigger by 1 where the element of b indicates what value to extract along a certain direction.  For example, b = x.argmin(axis=1). Perhaps I

Re: [Numpy-discussion] Is there a memory-efficient alternative to choose?

2011-03-08 Thread Lutz Maibaum
On Mar 8, 2011, at 11:56 AM, Josh Hykes wrote: At some point in my code, I need to do a cell-wise multiplication of the properties with a state variable. The ideal method would (1) be fast (no Python loops) and (2) not waste memory constructing an entire property map. My best attempt using

[Numpy-discussion] Inaccuracy in documentation of np.linalg.pinv

2011-03-08 Thread Hao Xiong
I think the documentation for np.linalg.pinv contains some inaccuracies. Most importantly, Moore-Penrose is not defined by the solution to the least-square problem. It was defined by the unique solution to 4 equations. Since SVD can be easily shown to satisfy the same 4 equations, it is the

Re: [Numpy-discussion] Request for a bit more info on structured arrays in the basics page

2011-03-08 Thread Skipper Seabold
On Sun, Mar 6, 2011 at 11:12 PM, Ralf Gommers ralf.gomm...@googlemail.com wrote: On Sun, Mar 6, 2011 at 1:10 AM, Skipper Seabold jsseab...@gmail.com wrote: On Sat, Mar 5, 2011 at 9:28 AM, Ralf Gommers ralf.gomm...@googlemail.com wrote: On Sat, Mar 5, 2011 at 8:09 AM, Russell E. Owen

[Numpy-discussion] append_fields behavior with a (sort of) empty array

2011-03-08 Thread Skipper Seabold
First consider this example of column_stack import numpy as np x = np.random.random((5,1)) y = np.random.random((5,3)) arr = np.column_stack((x[[]], y)) # this fails which is expected arr = np.column_stack((x[:,[]], y)) # this happily works I guess because x[:,[]] # array([], shape=(5, 0),