[Numpy-discussion] np.dot and array order
josef.pktd at gmail.com
josef.pktd at gmail.com
Wed Nov 30 21:31:57 EST 2011
np.__version__ '1.5.1' official win32 installer
(playing with ipython for once)
I thought np.dot is Lapack based and favors fortran order, but if the
second array is fortran ordered, then dot takes twice as long. The
order of the first array seems irrelevant
(or maybe just with my shapes, in case it matters: the first array is
float64, the second is bool, and I'm low in left over memory)
In [93]: %timeit np.dot(x.T, indi)
1 loops, best of 3: 1.33 s per loop
In [94]: %timeit np.dot(xf.T, indi)
1 loops, best of 3: 1.27 s per loop
In [95]: %timeit np.dot(xf.T, indif)
1 loops, best of 3: 3 s per loop
In [100]: %timeit np.dot(x.T, indif)
1 loops, best of 3: 3.05 s per loop
In [96]: x.flags.c_contiguous
Out[96]: True
In [97]: xf.flags.c_contiguous
Out[97]: False
In [98]: indi.flags.c_contiguous
Out[98]: True
In [99]: indif.flags.c_contiguous
Out[99]: False
In [101]: x.shape
Out[101]: (200000, 20)
In [102]: indi.shape
Out[102]: (200000, 500)
It's just the way it is, or does it depend on ....?
Josef
More information about the NumPy-Discussion
mailing list