Performance of row vs column operations in NumPy

后端 未结 3 1018
刺人心
刺人心 2021-01-01 19:56

There are a few articles that show that MATLAB prefers column operations than row operations, and that depending on you lay out your data the performance can vary significan

3条回答
  •  独厮守ぢ
    2021-01-01 20:51

    In [38]: data = numpy.random.rand(10000,10000)
    
    In [39]: %timeit data.sum(axis=0)
    10 loops, best of 3: 86.1 ms per loop
    
    In [40]: %timeit data.sum(axis=1)
    10 loops, best of 3: 101 ms per loop
    

提交回复
热议问题