[Numpy-discussion] Numpy performance vs Matlab.

Matthieu Brucher matthieu.brucher@gmail....
Wed Jan 7 09:53:36 CST 2009


> for i in range(dim):
>    for j in range(dim):
>        a[i,j,0] = a[i,j,1]
>        a[i,j,2] = a[i,j,0]
>        a[i,j,1] = a[i,j,2]

> for i = 1:dim
>    for j = 1:dim
>        a(i,j,1) = a(i,j,2);
>        a(i,j,2) = a(i,j,1);
>        a(i,j,3) = a(i,j,3);
>    end
> end

Hi,

The two loops are not the same.
As David stated, with JIT, the loops may be vectorized by Matlab on the fly.

-- 
Information System Engineer, Ph.D.
Website: http://matthieu-brucher.developpez.com/
Blogs: http://matt.eifelle.com and http://blog.developpez.com/?blog=92
LinkedIn: http://www.linkedin.com/in/matthieubrucher


More information about the Numpy-discussion mailing list