Re: [Numpy-discussion] Why do mgrid and meshgrid not return broadcast arrays?

2017-03-09 Thread Per.Brodtkorb
2017 08:34 To: Discussion of Numerical Python Subject: Re: [Numpy-discussion] Why do mgrid and meshgrid not return broadcast arrays? Ah, fantastic, thanks Per! I'd still be interested to hear from the core devs as to why this isn't the default, both with meshgrid and mgrid... Juan. On 9 Mar

Re: [Numpy-discussion] Why do mgrid and meshgrid not return broadcast arrays?

2017-03-08 Thread Juan Nunez-Iglesias
ias > Sent: 9. mars 2017 04:20 > To: Discussion of Numerical Python > Subject: Re: [Numpy-discussion] Why do mgrid and meshgrid not return > broadcast arrays? > > Hi Warren, > > ogrid doesn’t solve my problem. Note that my code returns arrays that would > evaluate as e

Re: [Numpy-discussion] Why do mgrid and meshgrid not return broadcast arrays?

2017-03-08 Thread Per.Brodtkorb
. mars 2017 04:20 To: Discussion of Numerical Python Subject: Re: [Numpy-discussion] Why do mgrid and meshgrid not return broadcast arrays? Hi Warren, ogrid doesn’t solve my problem. Note that my code returns arrays that would evaluate as equal to the mgrid output. It’s just that they are copied

Re: [Numpy-discussion] Why do mgrid and meshgrid not return broadcast arrays?

2017-03-08 Thread Juan Nunez-Iglesias
Hi Warren, ogrid doesn’t solve my problem. Note that my code returns arrays that would evaluate as equal to the mgrid output. It’s just that they are copied in mgrid into a giant array, instead of broadcast: In [176]: a0, b0 = np.mgrid[:5, :5] In [177]: a1, b1 =

Re: [Numpy-discussion] Why do mgrid and meshgrid not return broadcast arrays?

2017-03-08 Thread Warren Weckesser
On Wed, Mar 8, 2017 at 9:48 PM, Juan Nunez-Iglesias wrote: > I was a bit surprised to discover that both meshgrid nor mgrid return > fully instantiated arrays, when simple broadcasting (ie with stride=0 for > other axes) is functionally identical and happens much, much

[Numpy-discussion] Why do mgrid and meshgrid not return broadcast arrays?

2017-03-08 Thread Juan Nunez-Iglesias
I was a bit surprised to discover that both meshgrid nor mgrid return fully instantiated arrays, when simple broadcasting (ie with stride=0 for other axes) is functionally identical and happens much, much faster. I wrote my own function to do this: def broadcast_mgrid(arrays):     shape =