title: Eigendecompositions are 5 times slower in Julia than in Mathematica?
body: <p>I am new to Julia and primarily work in Mathematica, so I probably have a few elementary mistakes floating around. I attempted to time how long Julia took to compute the eigensystem of a random matrix, and found it was 5-6 times slower than in Mathematica. </p>
  
  <p>In Julia:</p>
  
  <pre><code>D=1000*(rand(1000,1000)-0.5);
  @time (E,F)=eig(D);
  
  Out: elapsed time: 7.47950706 seconds (79638920 bytes allocated*)
  </code></pre>
  
  <p>In Mathematica:</p>
  
  <pre><code>First@Timing@Eigensystem[RandomReal[{-500, 500}, {1000, 1000}]]
  
  Out: 1.310408
  </code></pre>
  
  <p>For 2000 x 2000 arrays it's similar, although the Julia result slowed down slightly less than the equivalent Mathematica call, but it's still slower; Julia takes 22 seconds, whereas Mathematica computes it in 8 seconds.</p>
  
  <p>As far as I read in the <a href="http://docs.julialang.org/en/latest/stdlib/linalg/#Base.eigfact" rel="nofollow noreferrer">Julia standard library for linear algebra</a>, decompositions are implemented by calling LAPACK, which I thought was supposed to be very good, so I'm confused as to why the Julia code is running so much slower. Does anyone know why this is the case? Is it doing some kind of balancing or array-symmetry-detection that Mathematica doesn't do? Or is it actually slower?</p>
  
  <p>Also, this is a syntax question and probably a silly error, but how do you change the balancing in Julia? I tried</p>
  
  <pre><code>@time (E,F)=eig(D[, balance=:nobalance]);
  </code></pre>
  
  <p>exactly as copied and pasted from the Julia manual, but it just gave a syntax error, so something's wrong.</p>
  
  <p>I am using Windows 7 64-bit, with Julia version 0.2.0 64-bit, installed using the <a href="https://github.com/stevengj/julia-mit/" rel="nofollow noreferrer">instructions at Steven Johnson's site</a>, with Anaconda installed first to take care of prerequisites. I am using Mathematica student edition version 9.0.1.</p>
  
  <p>EDIT 1:</p>
  
  <p>Executing <code>versioninfo()</code> yielded</p>
  
  <pre><code>Julia Version 0.2.0
  Commit 05c6461 (2013-11-16 23:44 UTC)
  Platform Info:
  System: Windows (x86_64-w64-mingw32)
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY)
  LAPACK: libopenblas
  LIBM: libopenlibm
  </code></pre>
  
  <p>So it looks like I'm using the openBLAS for LAPACK and BLAS. Once I get the Mathematica implementation info I will add that as well.</p>
  
  <p>EDIT 2:</p>
  
  <p>It appears that Windows Mathematica <a href="https://mathematica.stackexchange.com/questions/41949/how-to-determine-blas-lapack-implementation-used-internally-for-numerical-matrix"><em>probably</em> uses Intel MKL BLAS</a>.</p>