title: Interpret two dimensional array in Func<double[]>
body: <p>I am using Accord math to solve nonlinear function with nonlinear constraints
  The problem is that <code>NonlinearObjectiveFunction</code> function take argument <code>function</code> that is <code>Func&lt;double[], double&gt; function</code> in my case it's something like </p>
  
  <pre><code>x =&gt;
  x[0] * (Matrix[0, 0] * x[0] + Matrix[1, 0] * x[1] + Matrix[2, 0] * x[2]) +
  x[1] * (Matrix[0, 1] * x[0] + Matrix[1, 1] * x[1] + Matrix[2, 1] * x[2]) +
  x[2] * (Matrix[0, 2] * x[0] + Matrix[1, 2] * x[1] + Matrix[2, 2] * x[2])
  </code></pre>
  
  <p>Is it possible somehow to build this <code>function</code> using a cycle? Because dimension of input matrix can change.</p>
  
  <pre><code>class Program
      {
          static void Main(string[] args)
          {
              double[,] Matrix = new double[3, 3];
  
              Matrix[0, 0] = 0.00234329;
              Matrix[0, 1] = 0.00118878;
              Matrix[0, 2] = 0.00152143;
              Matrix[1, 0] = 0.00118878;
              Matrix[1, 1] = 0.00206312;
              Matrix[1, 2] = 0.00124812;
              Matrix[2, 0] = 0.00152143;
              Matrix[2, 1] = 0.00124812;
              Matrix[2, 2] = 0.00194796;
  
              double x1 = 0.0107;
              double x2 = -0.00054;
              double x3 = -0.0034;
  
              var f = new NonlinearObjectiveFunction(3, x =&gt;
              x[0] * (Matrix[0, 0] * x[0] + Matrix[1, 0] * x[1] + Matrix[2, 0] * x[2]) +
              x[1] * (Matrix[0, 1] * x[0] + Matrix[1, 1] * x[1] + Matrix[2, 1] * x[2]) +
              x[2] * (Matrix[0, 2] * x[0] + Matrix[1, 2] * x[1] + Matrix[2, 2] * x[2])
              );
  
              var constraints = new[]
              {
                  new NonlinearConstraint(3, x =&gt; x1 * x[0] + x2 * x[1] + x3 * x[2] &gt;= 0.01),
                  new NonlinearConstraint(3, x=&gt; x[0] + x[1] + x[2]&gt;=1 ),
                  new NonlinearConstraint(3, x=&gt; x[0] + x[1] + x[2]&lt;=1 ),
                  new NonlinearConstraint(3, x=&gt; x[0]&gt;=0),
                  new NonlinearConstraint(3, x=&gt; x[1]&gt;=0),
                  new NonlinearConstraint(3, x=&gt; x[2]&gt;=0)
              };
  
              var cobyla = new Cobyla(f, constraints);
              bool success = cobyla.Minimize();
              double minimum = cobyla.Value;
              double[] solution = cobyla.Solution;
          }
      }
  </code></pre>