Пример #1
0
    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();
    }
Пример #2
0
    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();
    }
Пример #3
0
    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();
    }
Пример #4
0
 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);
     }
 }
Пример #5
0
 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);
     }
 }
Пример #6
0
 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);
     }
 }
Пример #7
0
 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);
     }
 }
Пример #8
0
 public static double Average <TSource>(this IEnumerable <TSource> source, Func <TSource, double> selector) =>
 LinqEnumerable.Average(source, selector);
Пример #9
0
 public static float?Average <TSource>(this IEnumerable <TSource> source, Func <TSource, float?> selector) =>
 LinqEnumerable.Average(source, selector);
Пример #10
0
 public static decimal Average(this IEnumerable <decimal> source)
 => Enumerable.Average(source);
Пример #11
0
 public static float Average(this IEnumerable <float> source)
 => Enumerable.Average(source);
Пример #12
0
 public static double?Average(this IEnumerable <long?> source)
 => Enumerable.Average(source);
Пример #13
0
 public static decimal?Average(this IEnumerable <decimal?> source) =>
 LinqEnumerable.Average(source);
Пример #14
0
 public static double?Average <TSource>(this IEnumerable <TSource> source, Func <TSource, long?> selector)
 => Enumerable.Average(source, selector);
Пример #15
0
 public static float?Average(this IEnumerable <float?> source) =>
 LinqEnumerable.Average(source);
Пример #16
0
 public static double?Average(this IEnumerable <double?> source) =>
 LinqEnumerable.Average(source);
Пример #17
0
 public static decimal?Average <TSource>(this IEnumerable <TSource> source, Func <TSource, decimal?> selector)
 => Enumerable.Average(source, selector);
Пример #18
0
 public static double Average(this IEnumerable <int> source) =>
 LinqEnumerable.Average(source);
Пример #19
0
 public static double Average(this IEnumerable <double> source)
 => Enumerable.Average(source);