Re: [Numpy-discussion] Optimization suggestion sought

2011-01-01 Thread Enzo Michelangeli
- Original Message - From: Robert Bradshaw rober...@math.washington.edu Sent: Wednesday, December 29, 2010 4:47 PM [...] Regarding Justin's suggestion, before trying Cython (which, according to http://wiki.cython.org/tutorials/numpy , seems to require a bit of work to handle numpy

Re: [Numpy-discussion] Giving numpy the ability to multi-iterate excluding an axis

2011-01-01 Thread John Salvatier
This thread is a bit old, but since it's not possible to use the C-API is possible to accomplish this same thing with the Python API? On Tue, Dec 21, 2010 at 5:12 PM, Mark Wiebe mwwi...@gmail.com wrote: On Mon, Dec 20, 2010 at 1:42 PM, John Salvatier jsalv...@u.washington.edu wrote: A while

Re: [Numpy-discussion] Arrays with aliased elements?

2011-01-01 Thread Zachary Pincus
def repeat(arr, num): arr = numpy.asarray(arr) return numpy.ndarray(arr.shape+(num,), dtype=arr.dtype, buffer=arr, strides=arr.strides+(0,)) There are limits to what these sort of stride tricks can accomplish, but repeating as above, or similar, is feasible. On Jan 1, 2011, at 8:42

Re: [Numpy-discussion] Arrays with aliased elements?

2011-01-01 Thread Robert Kern
On Sat, Jan 1, 2011 at 19:42, Enzo Michelangeli enzom...@gmail.com wrote: Is there any way, not involving compilation of C code, to define ndarrays where some rows or columns share the same data buffers? For example, something built by a hypothetical variant of the np.repeat() function, such

Re: [Numpy-discussion] Arrays with aliased elements?

2011-01-01 Thread Enzo Michelangeli
Thanks. Meanwhile, I had arrived to a solution similar to the one suggested by Zachary: a = array([2,3]) ndarray((3,a.shape[0]), strides=(0,a.itemsize), buffer = a, offset=0, dtype=a.dtype) array([[2, 3], [2, 3], [2, 3]]) ...but I'd say that numpy.broadcast_arrays is the