[Numpy-discussion] summation along a non-fast axis

Keith Goodman kwgoodman at gmail.com
Fri Jan 11 15:32:47 EST 2019


I remember back when a.sum(axis=0) was much slower than a.sum(axis=1) for
something like a=np.ones((1000, 1000)). But now it runs in about the same
time. How does numpy do it?

Does numpy do something like

for i in range(a.shape[0]):
    for j in range(x.shape[1]):
        result[j] += a[i, j]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20190111/a6db5d4e/attachment.html>


More information about the NumPy-Discussion mailing list