private static void Sum_Inner(UniformDistributionSampler sampler, int len) { // Alloc array and fill with uniform random noise. float[] x = new float[len]; sampler.Sample(x); // Sum the array elements. float expected = PointwiseSum(x); float actual = MathSpan.Sum(x); // Compare expected and actual sum. Assert.Equal(expected, actual, 4); }
private static void Sum_Inner(ISampler <int> sampler, int len) { // Alloc array and fill with uniform random noise. int[] x = new int[len]; sampler.Sample(x); // Sum the array elements. int expected = PointwiseSum(x); int actual = MathSpan.Sum(x); // Compare expected and actual sum. Assert.Equal(expected, actual); }