title: MATLAB twice as fast as Numpy
body: <p>I am an engineering grad student currently making the transition from MATLAB to Python for the purposes of numerical simulation. I was under the impression that for basic array manipulation, Numpy would be as fast as MATLAB. However, it appears for two different programs I write that MATLAB is a little under twice as fast as Numpy. The test code I am using for Numpy (Python 3.3) is:</p>
  
  <pre><code>import numpy as np
  import time
  
  a = np.random.rand(5000,5000,3)
  
  tic = time.time()
  a[:,:,0] = a[:,:,1]
  a[:,:,2] = a[:,:,0]
  a[:,:,1] = a[:,:,2]
  toc = time.time() - tic
  print(toc)
  </code></pre>
  
  <p>Whereas for MATLAB 2012a I am using:</p>
  
  <pre><code>a = rand(5000,5000,3);
  
  tic;
  a(:,:,1) = a(:,:,2);
  a(:,:,3) = a(:,:,1);
  a(:,:,2) = a(:,:,3);
  toc
  </code></pre>
  
  <p>The algorithm I am using is the one used on a NASA <a href="https://modelingguru.nasa.gov/docs/DOC-1762" rel="noreferrer">website</a> comparing Numpy and MATLAB. The website shows that Numpy surpasses MATLAB in terms of speed for this algorithm. Yet my results show a 0.49 s simulation time for Numpy and a 0.29 s simulation time for MATLAB. I also have run a Gauss-Seidel solver on both Numpy and Matlab and I get similar results (16.5 s vs. 9.5 s)</p>
  
  <p>I am brand new to Python and am not extremely literate in terms of programming. I am using the WinPython 64 bit Python distribution but have also tried Pythonxy to no avail.</p>
  
  <p>One thing I have read which should improve performance is building Numpy using MKL. Unfortunately I have no idea how to do this on Windows. Do I even need to do this?</p>
  
  <p>Any suggestions?</p>