[Numpy-discussion] repeat an array without allocation

Eelco Hoogendoorn hoogendoorn.eelco at gmail.com
Mon May 5 01:45:51 EDT 2014


nope; its impossible to express A as a strided view on x, for the repeats
you have.

even if you had uniform repeats, it still would not work. that would make
it easy to add an extra axis to x without a new allocation; but
reshaping/merging that axis with axis=0 would again trigger a copy, as it
would require a non-integer stride.


On Mon, May 5, 2014 at 6:34 AM, srean <srean.list at gmail.com> wrote:

> Hi all,
>
>   is there an efficient way to do the following without allocating A where
>
>  A = np.repeat(x, [4, 2, 1, 3], axis=0)
>  c = A.dot(b)    # b.shape
>
> thanks
> -- srean
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20140505/5cb9429d/attachment.html>


More information about the NumPy-Discussion mailing list