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
On Sat, Jan 1, 2011 at 19:42, Enzo Michelangeli 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
> that, if a = arr
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
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
that, if a = array([2,3]), calling:
b = np.aliasedrepeat(x, [1, 2], axis=0
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 wrote:
> On Mon, Dec 20, 2010 at 1:42 PM, John Salvatier > wrote:
>
>> A while ago, I asked a whether it was possible
On Sat, Jan 1, 2011 at 5:44 AM, Gideon wrote:
> I noticed that 1.5.1 was released, and sourceforge is suggesting I use
> the package numpy-1.5.1-py2.6-python.org-macosx10.3.dmg. However, I
> have an OS X 10.6 machine.
>
> Can/should I use this binary?
>
Yes you can. The naming scheme correspond
- Original Message -
From: "Robert Bradshaw"
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 arrays properly)
>
>