title: Efficient calculation of the eigenvector for a 4x4 non-Hermitian matrix
body: <p>I'm looking for an efficient algorithm (preferred for Julia) to calculate the eigenvectors of a 4x4 non-Hermitian matrix having a structure of</p>
  <pre><code>a b 0 c
  0 0 -1 0
  d e 0 f
  g h 0 i
  </code></pre>
  <p>I know that I can in principle use the build-in function of Julia or python. However, although Julia is mentioned as fast being quite fast, the calculations are a factor 2 slower than if I would use the C++ eigen library (with <code>fastmath</code> option). So I’m wondering, which algorithm the <code>eigen</code> library is using in this case and if one can be transferred to Julia or Python.</p>
  <p>Thanks for any hints and comments</p>
  <p><strong>Update</strong></p>
  <p>Thanks for the comments and not being accurate enough. Here is an example, which works in Julia</p>
  <pre><code>using BenchmarkTools
  using LinearAlgebra
  using StaticArrays
  
  function foo(A)
      eigen(A)
      return
  end 
  
  function foo2(A)
      @fastmath eigen(A)
      return
  end
  
  function foo3(A)
      LinearAlgebra.LAPACK.geevx!('B', 'N', 'V', 'N', copy(A))
      return
  end
  
  A = rand(4,4) + im*rand(4,4);
  A[:,3] .= 0;
  A[2,:] .= 0;
  A[2,3] = 1;
  
  AStatic = SMatrix{4,4, ComplexF64}(A)
  
  
  @benchmark eigen($A)
  @benchmark eigen($AStatic)
  
  @benchmark foo($AStatic)
  @benchmark foo2($AStatic)
  @benchmark foo3($A)
  </code></pre>
  <p><em>@AboAmmar</em> Actually I need the eigenvalues and the eigenvectors. The julia version I used, uses <em>OpenBlas</em>. However, even using MKL (<code>MKL.jl</code>) the performance gain is very small</p>
  <p>Also the usage of the fastmath option does not change anything. Maybe, the functions which I'm calling are already compiled so that this option does not work here.</p>
  <p>Also the use <code>StaticArrays</code> might be useful in some cases. But for non-hermitian matrices the function calls the build-in function of Julia. The QR and LU decomposition can be used, but they will not provide me the eigenvalues. Even <code>eigenvals()</code> is not applicable for non-Hermitian matrices</p>
  <p><em>@Jérôme</em> Richard thanks for the link to the post. I'm afraid that a manual determinnation, e.g., by using Ferraris method requieres a lot computation and the speed will be the same.</p>