コード例 #1
0
        //[/GenericScanSumDoubles]

        //[GenericScanGenericSumDoubles]
        public static void SumDoublesGeneric()
        {
            foreach (var n in Nums)
            {
                var values = Gen(Rng.NextDouble, n);
                // Inclusive scan
                var dri = ScanApi.Scan((x, y) => x + y, values, true);
                var hri = cpuScan((x, y) => x + y, values, true);
                Compare(hri, dri, 1e-11);
                // Exclusive scan
                var dre = ScanApi.Scan((x, y) => x + y, values, false);
                var hre = cpuScan((x, y) => x + y, values, false);
                Compare(hre, dre, 1e-11);
            }
        }
コード例 #2
0
 //[GenericScanSumInts]
 public static void SumInts()
 {
     foreach (var n in Nums)
     {
         var values = Gen(Rng.Next, n);
         // Inclusive scan
         var dri = ScanApi.Sum(values, true);
         var hri = cpuScan((x, y) => x + y, values, true);
         Compare(hri, dri);
         // Exclusive scan
         var dre = ScanApi.Sum(values, false);
         var hre = cpuScan((x, y) => x + y, values, false);
         Compare(hre, dre);
     }
 }