title: Inverse of a matrix using eigen
body: <p>I have learnt how to find inverse of a matrix using <a href="http://eigen.tuxfamily.org/dox/group__TutorialLinearAlgebra.html" rel="noreferrer">Eigen</a>. But when I'm finding inverse of an array that is a output of function I got an error </p>
  
  <blockquote>
    <p>request for member ‘inverse’ in ‘x’, which is of non-class type
    ‘double**’</p>
  </blockquote>
  
  <p>Please help me out, in using c++ library to find inverse of a matrix.  </p>
  
  <p>The code I have written is:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;armadillo&gt;
  #include &lt;cmath&gt;
  #include &lt;Eigen/Dense&gt;
  
  using namespace std;
  using namespace arma;
  using namespace Eigen;
  
  int main()
  {
      vec a;
      double ** x;
  
      double ** inv_x;
      a &lt;&lt;0 &lt;&lt; 1 &lt;&lt; 2 &lt;&lt; 3 &lt;&lt; 4; //input vector to function
      double ** f (vec a); //function declaration
  
      x= f(a);   // function call
  
      //inv_x=inv(x);
  
      cout &lt;&lt; "The inverse of x is:\n" &lt;&lt; x.inverse() &lt;&lt; endl; // eigen command to find inverse
      return 0;
  }
  
  // function definition 
  double ** f(vec a)
  {
      double ** b = 0;
      int h=5;
  
      for(int i1=0;i1&lt;h;i1++)
      {
           b[i1] = new double[h];
           {
              b[i1][0]=1;
              b[i1][1]=a[i1];
              b[i1][2]=a[i1]*a[i1]+1/12;
              b[i1][3]=pow(a[i1],3)+a[i1]/4;
              b[i1][4]=1/80+pow(a[i1],2)/2+pow(a[i1],4);
          }
  
      }
      return b;
  }
  </code></pre>
  
  <p>Here user defined function <code>f</code> return an array <code>x</code>. I'm trying to find inverse of <code>x</code> using eigen library. </p>