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
- Original Message - From: Robert Kern robert.k...@gmail.com To: Discussion of Numerical Python numpy-discussion@scipy.org Sent: Sunday, January 02, 2011 10:08 AM Subject: Re: [Numpy-discussion] Arrays with aliased elements? On Sat, Jan 1, 2011 at 19:42, Enzo Michelangeli enzom...@gmail.com