python - Performance of numpy with built in functions -


i try figure out why program slow , find following result.

in [11]: n = 1000000  in [12]: x = randn(n)  in [13]: %timeit norm(x) 100 loops, best of 3: 2.25 ms per loop  in [14]: %timeit (x.dot(x))**0.5 1000 loops, best of 3: 387 µs per loop 

i know norm function contain many if else detecting input , select right norm. still wondering big difference when calling in loops.

is normal in numpy?

another examples computing eigenvalue , eigenvector of 10000x10000 random generated matrix randn. firstly use matlab compute , result in several minutes. numpy took very long time compute , ctrl+c process. both use eig function respectively.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -