[Numpy-discussion] extension to xrange for numpy
Gary Ruben
gruben at bigpond.net.au
Sun Apr 2 16:06:10 CDT 2006
Doh!
It's OK Arnd; I've recently seen you (or someone else withe the same
name) acknowledged in a PhD I've been reading so I suspect you're a nice
guy :-)
And, thanks Alan.
I knew about mgrid but not ogrid.
One small way in which that example might be better than using ogrid is
that you could avoid creating the index arrays and lazily generate the
indices. However, ogrid is better than mgrid in this respect.
thanks,
Gary
Alan G Isaac wrote:
> On Sun, 02 Apr 2006, Gary Ruben apparently wrote:
>> I'd find some sort of numpy iterator equivalents of these more
>> useful. This would allow list comprehensions like
>> [f(x,y,z) for (x,y,z) in ndrange(10,10,10)]
>
> How is this better than using ogrid? E.g.,
>
>>>> x=N.ogrid[:3,:2]
>>>> N.power(*x)
> array([[1, 0],
> [1, 1],
> [1, 2]])
>
> Thanks,
> Alan
More information about the Numpy-discussion
mailing list