title: Converting jagged array to 2D array C#
body: <p>I'm trying to convert this function from Jagged Array to 2D array, and I'm not able to convert everything
  Original Function:</p>
  
  <pre><code>public static double[][] InvertMatrix(double[][] A)
  {
      int n = A.Length;
      //e will represent each column in the identity matrix
      double[] e;
      //x will hold the inverse matrix to be returned
      double[][] x = new double[n][];
      for (int i = 0; i &lt; n; i++)
      {
          x[i] = new double[A[i].Length];
      }
      /*
      * solve will contain the vector solution for the LUP decomposition as we solve
      * for each vector of x.  We will combine the solutions into the double[][] array x.
      * */
      double[] solve;
  
      //Get the LU matrix and P matrix (as an array)
      Tuple&lt;double[][], int[]&gt; results = LUPDecomposition(A);
  
      double[][] LU = results.Item1;
      int[] P = results.Item2;
  
      /*
      * Solve AX = e for each column ei of the identity matrix using LUP decomposition
      * */
      for (int i = 0; i &lt; n; i++)
      {
          e = new double[A[i].Length];
          e[i] = 1;
          solve = LUPSolve(LU, P, e);
          for (int j = 0; j &lt; solve.Length; j++)
          {
              x[j][i] = solve[j];
          }
      }
      return x;
  }
  </code></pre>
  
  <p>What I have converted until now:</p>
  
  <pre><code>public static double[,] InvertMatrix(double[,] A)
  {
      int n = A.Length;
      //e will represent each column in the identity matrix
      double[] e;
      //x will hold the inverse matrix to be returned
      double[,] x = new double[n][];
      for (int i = 0; i &lt; n; i++)
      {
          //how to convert this line?
          x[i] = new double[A[i].Length];
      }
      /*
      * solve will contain the vector solution for the LUP decomposition as we solve
      * for each vector of x.  We will combine the solutions into the double[][] array x.
      * */
      double[] solve;
  
      //Get the LU matrix and P matrix (as an array)
      Tuple&lt;double[,], int[]&gt; results = LUPDecomposition(A);
  
      double[,] LU = results.Item1;
      int[] P = results.Item2;
  
      /*
      * Solve AX = e for each column ei of the identity matrix using LUP decomposition
      * */
      for (int i = 0; i &lt; n; i++)
      {
          //This one too?!
          e = new double[A[i].Length];
          e[i] = 1;
          solve = LUPSolve(LU, P, e);
          for (int j = 0; j &lt; solve.Length; j++)
          {
              x[j,i] = solve[i,j];
          }
      }
      return x;
  }
  </code></pre>
  
  <p>How to convert x[i] = new double[A[i].Length] to 2D array?</p>