Re: [Numpy-discussion] repeat array along new axis without making a copy

2012-02-15 Thread Robert Kern
On Wed, Feb 15, 2012 at 15:16, Samuel John wrote: > Wow, I wasn't aware of that even if I work with numpy for years now. > NumPy is amazing. It's deliberately unpublicized because you can cause segfaults if you get your math wrong. But once you get your math right and can wrap it up into a utilit

Re: [Numpy-discussion] repeat array along new axis without making a copy

2012-02-15 Thread Samuel John
Wow, I wasn't aware of that even if I work with numpy for years now. NumPy is amazing. Samuel ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] repeat array along new axis without making a copy

2012-02-15 Thread Steve Schmerler
On Feb 15 06:25 -0600, Warren Weckesser wrote: > Yes, such an array can be created using the as_strided() function from the > module numpy.lib.stride_tricks: Thank you, I will look into that. best, Steve ___ NumPy-Discussion mailing list NumPy-Discussio

Re: [Numpy-discussion] repeat array along new axis without making a copy

2012-02-15 Thread Warren Weckesser
On Wed, Feb 15, 2012 at 2:25 AM, Steve Schmerler wrote: > Hi > > I'd like to repeat an array along a new axis (like broadcast): > >In [8]: a >Out[8]: >array([[0, 1, 2], > [3, 4, 5]]) >In [9]: b=repeat(a[None,...], 3, axis=0) >In [10]: b >Out[10]: >array([[[0,

[Numpy-discussion] repeat array along new axis without making a copy

2012-02-15 Thread Steve Schmerler
Hi I'd like to repeat an array along a new axis (like broadcast): In [8]: a Out[8]: array([[0, 1, 2], [3, 4, 5]]) In [9]: b=repeat(a[None,...], 3, axis=0) In [10]: b Out[10]: array([[[0, 1, 2], [3, 4, 5]], [[0, 1, 2], [3