title: Use Eigen + Intel MKL + Pardiso
body: <p>I am trying to use Eigen's support of MKL and Pardiso (see example below). I have used the <a href="https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor" rel="nofollow noreferrer">Intel link line advisor</a> to come up with the compiler options but everything I'm trying is unsuccessful. In particular, compiling with:</p>
  
  <pre><code>$ icpc -I${HOME}/src/eigen -DEIGEN_USE_MKL_ALL -DMKL_ILP64 -I${MKLROOT}/include main.cpp -L${MKLROOT}/lib/intel64 -lmkl_intel_ilp64 -lmkl_sequential -lmkl_core -lpthread -lm -ldl
  </code></pre>
  
  <p>Results in the following type error:</p>
  
  <blockquote>
    <p>~/src/eigen/Eigen/src/PardisoSupport/PardisoSupport.h(50): error: argument of type "int *" is incompatible with parameter of type "const long long *"
            ::pardiso(pt, &amp;maxfct, &amp;mnum, &amp;type, &amp;phase, &amp;n, a, ia, ja, perm, &amp;nrhs, iparm, &amp;msglvl, b, x, &amp;error);</p>
  </blockquote>
  
  <p>While compiling without the 64-bit support, using:</p>
  
  <pre><code>$ icpc -I${HOME}/src/eigen -DEIGEN_USE_MKL_ALL -I${MKLROOT}/include main.cpp -L${MKLROOT}/lib/intel64 -lmkl_sequential -lmkl_core -lpthread -lm -ldl
  </code></pre>
  
  <p>Results in:</p>
  
  <blockquote>
    <p>main.cpp:(.text+0x759): undefined reference to `pardiso'</p>
  </blockquote>
  
  <p>I have also tried, equally unsuccessfully, to compile with OpenMP.</p>
  
  <p>How should I compile?</p>
  
  <p>(I am on Intel 2016.3.210 and the latest Eigen, 3.3.3)</p>
  
  <h2>Example (main.cpp)</h2>
  
  <p>This example solves Poisson's equation, with two Dirichlet boundary conditions (u_{0} = u_{N+1} = 0)</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;iomanip&gt;
  #include &lt;math.h&gt;
  #include &lt;Eigen/Dense&gt;
  #include &lt;Eigen/PardisoSupport&gt;
  
  int main()
  {
    typedef Eigen::SparseMatrix&lt;double&gt; SpMat;
    typedef Eigen::Triplet     &lt;double&gt; Trip;
    typedef Eigen::PardisoLU   &lt;SpMat &gt; Solver;
  
    size_t N = 11;
  
    SpMat A(N,N);
    Eigen::VectorXd f(N);
  
    f         *= 0.0;
    f((N-1)/2) = 1.0;
  
    std::vector&lt;Trip&gt; Atr;
  
    Atr.push_back(Trip(0,0,+2.0));
    Atr.push_back(Trip(0,1,-1.0));
  
    for ( size_t i=1; i&lt;N-1; ++i ) {
      Atr.push_back(Trip(i,i-1,-1.0));
      Atr.push_back(Trip(i,i  ,+2.0));
      Atr.push_back(Trip(i,i+1,-1.0));
    }
  
    Atr.push_back(Trip(N-1,N-2,-1.0));
    Atr.push_back(Trip(N-1,N-1,+2.0));
  
    A.setFromTriplets(Atr.begin(),Atr.end());
  
    Solver solver;
    solver.analyzePattern(A);
    solver.factorize(A);
  
    Eigen::VectorXd u = solver.solve(f);
  
    return 0;
  }
  </code></pre>