CSharp examples for System:Array Element
Evaluates the specified function on double array.
using System;//from w w w . j a v a2 s.com public class Main{ /// <summary> /// Evaluates the specified function. /// </summary> /// <param name="f">The function.</param> /// <param name="x">The x values.</param> /// <param name="y">The y values.</param> /// <returns>Array of evaluations. The value of f(x_i,y_j) will be placed at index [i, j].</returns> public static double[,] Evaluate(Func<double, double, double> f, double[] x, double[] y) { int m = x.Length; int n = y.Length; var result = new double[m, n]; for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { result[i, j] = f(x[i], y[j]); } } return result; } }