[NumPy-Tickets] [NumPy] #966: Enhance meshgrid to generate 3D grids + add option for sparse grids
NumPy Trac
numpy-tickets@scipy....
Tue Nov 8 02:13:41 CST 2011
#966: Enhance meshgrid to generate 3D grids + add option for sparse grids
-------------------------+--------------------------------------------------
Reporter: pbrod | Owner: charris
Type: enhancement | Status: needs_review
Priority: normal | Milestone: Unscheduled
Component: numpy.lib | Version: devel
Keywords: meshgrid |
-------------------------+--------------------------------------------------
Comment(by pbrod):
However, the timings for the new version is even better when the size of
the input vectors are larger. The timings for the original version with
size=100:
{{{
In [36]: x = np.arange(100)
In [37]: %timeit X,Y = np.meshgrid(x,x)
10000 loops, best of 3: 96.8 us per loop
}}}
compared to the new proposal:
{{{
In [38]: %timeit X,Y = meshgrid(x,x, sparse=False, copy=True,
indexing='xy')
10000 loops, best of 3: 109 us per loop
In [39]: %timeit X,Y = meshgrid(x,x, sparse=True, copy=True,
indexing='xy')
100000 loops, best of 3: 18.5 us per loop
In [40]: %timeit X,Y = meshgrid(x,x, sparse=True, copy=True,
indexing='ij')
100000 loops, best of 3: 15.5 us per loop
In [41]: %timeit X,Y = meshgrid(x,x, sparse=True, copy=False,
indexing='ij')
10000 loops, best of 3: 12 us per loop
In [42]: %timeit X,Y = meshgrid(x,x, sparse=False, copy=False,
indexing='ij')
10000 loops, best of 3: 62.2 us per loop
}}}
--
Ticket URL: <http://projects.scipy.org/numpy/ticket/966#comment:6>
NumPy <http://projects.scipy.org/numpy>
My example project
More information about the NumPy-Tickets
mailing list