public void LinqSelect_double( [ValueSource(typeof(SelectValues), nameof(SelectValues.Values))] int[] sourceArr ) { var src = new NativeArray <int>(sourceArr, Allocator.Persistent); MakeMeasurement("Linq_double", () => Linq.Average(src, IntTo_double.Invoke)).Run(); src.Dispose(); }
public void Linq_int( [ValueSource(typeof(Values_int), nameof(Values_int.Values))] int[] sourceArr ) { var src = new NativeArray <int>(sourceArr, Allocator.Persistent); MakeMeasurement("Linq_int", () => Linq.Average(src)).Run(); src.Dispose(); }
public void Linq_double( [ValueSource(typeof(Values_double), nameof(Values_double.Values))] double[] sourceArr ) { var src = new NativeArray <double>(sourceArr, Allocator.Persistent); MakeMeasurement("Linq_double", () => Linq.Average(src)).Run(); src.Dispose(); }
public void BlinqShouldEqualLinqNativeArrayAverageSelector_int( [ValueSource(typeof(Values_int), nameof(Values_int.Values))] int[] sourceArr ) { using (var srcNativeArray = new NativeArray <int>(sourceArr, Allocator.Persistent)) { var expected = ExceptionAndValue(() => Linq.Average(srcNativeArray, SelectSelf <int>().Invoke)); var actual = ExceptionAndValue(() => Blinq.Average(srcNativeArray, SelectSelf <int>())); AssertAreEqual(expected, actual); } }
public void BlinqShouldEqualLinqNativeArrayAverage_double( [ValueSource(typeof(Values_double), nameof(Values_double.Values))] double[] sourceArr ) { using (var srcNativeArray = new NativeArray <double>(sourceArr, Allocator.Persistent)) { var expected = ExceptionAndValue(() => Linq.Average(srcNativeArray)); var actual = ExceptionAndValue(() => Blinq.Average(srcNativeArray)); AssertAreEqual(expected, actual); } }
public void BlinqShouldEqualLinqNativeArrayRunAverageSelector_double( [ValueSource(typeof(Values_double), nameof(Values_double.Values))] double[] sourceArr ) { using (var srcNativeArray = new NativeArray <double>(sourceArr, Allocator.Persistent)) { var expected = ExceptionAndValue(() => Linq.Average(srcNativeArray, SelectSelf <double>().Invoke)); if (expected.Item1 != null) { return; // Exceptions are not supported in Burst } var actual = ExceptionAndValue(() => Blinq.RunAverage(srcNativeArray, SelectSelf <double>())); AssertAreEqual(expected, actual); } }
public void BlinqShouldEqualLinqNativeArrayScheduleAverage_int( [ValueSource(typeof(Values_int), nameof(Values_int.Values))] int[] sourceArr ) { using (var srcNativeArray = new NativeArray <int>(sourceArr, Allocator.Persistent)) { var expected = ExceptionAndValue(() => Linq.Average(srcNativeArray)); if (expected.Item1 != null) { return; // Exceptions are not supported in Burst } var actual = ExceptionAndValue(() => Blinq.ScheduleAverage(srcNativeArray).Complete()); AssertAreEqual(expected, actual); } }
public static double Average <TSource>(this IEnumerable <TSource> source, Func <TSource, double> selector) => LinqEnumerable.Average(source, selector);
public static float?Average <TSource>(this IEnumerable <TSource> source, Func <TSource, float?> selector) => LinqEnumerable.Average(source, selector);
public static decimal Average(this IEnumerable <decimal> source) => Enumerable.Average(source);
public static float Average(this IEnumerable <float> source) => Enumerable.Average(source);
public static double?Average(this IEnumerable <long?> source) => Enumerable.Average(source);
public static decimal?Average(this IEnumerable <decimal?> source) => LinqEnumerable.Average(source);
public static double?Average <TSource>(this IEnumerable <TSource> source, Func <TSource, long?> selector) => Enumerable.Average(source, selector);
public static float?Average(this IEnumerable <float?> source) => LinqEnumerable.Average(source);
public static double?Average(this IEnumerable <double?> source) => LinqEnumerable.Average(source);
public static decimal?Average <TSource>(this IEnumerable <TSource> source, Func <TSource, decimal?> selector) => Enumerable.Average(source, selector);
public static double Average(this IEnumerable <int> source) => LinqEnumerable.Average(source);
public static double Average(this IEnumerable <double> source) => Enumerable.Average(source);