Exemple #1
0
 public C16Benchmark()
 {
     _regular  = new FlawedFrequencyTransmission();
     _simd     = new FlawedFrequencyTransmissionSimd();
     _vertical = new FlawedFrequencyTransmissionVertical();
     _sm       = new FftStateMachine();
 }
        public void BasicItersTest()
        {
            var ftt = new FlawedFrequencyTransmissionSimd();
            var res = ftt.ExecutePhases("12345678", "0,1,0,-1", 4)
                      .Aggregate(0, (acc, curr) => acc * 10 + curr);

            Assert.Equal(01029498, res);
        }
        //[InlineData("03036732577212944063491565474664", 84462026, 100)]
        //[InlineData("02935109699940807407585447034323", 78725270, 100)]
        //[InlineData("03081770884921959731165446850517", 53553731, 100)]
        public void FirstEightDigitsTest_After100Iterations(string input, int expected, int phases)
        {
            var ftt = new FlawedFrequencyTransmissionSimd();

            var inputBytes = Enumerable.Repeat(input, 10_000)
                             .SelectMany(s => s.Select(c => (sbyte)(c - 48)))
                             .ToArray();
            var res = ftt.ExecutePhases(inputBytes, "0,1,0,-1", phases, d =>
            {
                var offset = d.Take(7).Aggregate(0, (acc, curr) => acc * 10 + curr);
                var res    = Enumerable.Range(offset, 8).Select(x => d[x]).Aggregate(0, (acc, curr) => acc * 10 + curr);
                return(res);
            });

            Assert.Equal(expected, res.Take(8).Aggregate(0, (acc, curr) => acc * 10 + curr));
        }