コード例 #1
0
        public void Test_ParallelAlgorithms_Map_ParallelAlgorithms_Reduce_ArrayMaxOrMinValue_MR()
        {
            //MR 求数组中最值
            var listmaxValueV3 = new List <int> {
                1, 2, 3, 4, 5, 6, 76, 87, 9, 10, 0, 98, 23, 5, 12, 3453, 34, 56, 6, 23, 1, 34, 89
            };
            var inputMaxList3 = ParallelAlgorithms.Map(listmaxValueV3, e => new List <int> {
                e
            });
            var maxValue3 = ParallelAlgorithms.Reduce(0, inputMaxList3.Length, new ParallelOptions {
                MaxDegreeOfParallelism = Environment.ProcessorCount
            }, /*参数e 为集合索引*/ e => listmaxValueV3[e], 0, (e, e1) => { return(Math.Max(e1, e)); });

            Assert.AreEqual(3453, maxValue3);
        }