Esempio n. 1
0
        private void Run(int nBits)
        {
            var a = 0;
            var b = 0;


            var mlsBuilder = new MaxLenSequenceBuilder(nBits);

            _feedbacksDistribution = new List <List <int> >(mlsBuilder.Period);
            _allFeedbackList       = new List <KeyValuePair <int, int> >(mlsBuilder.GetMaxFeedbackCount());

            for (int j = 0; j < mlsBuilder.Period; j++)
            {
                _feedbacksDistribution.Add(new List <int>());
            }

            mlsBuilder.CreateNextMaxLenSequence();


            var si = 3;
            var i  = si;

            foreach (var val in mlsBuilder.Correlations.Skip(si - 1))
            {
                if (val < 0)
                {
                    a = i;
                    break;
                }
                ++i;
            }
            i = mlsBuilder.Period;
            foreach (var val in mlsBuilder.Correlations.Reverse())
            {
                if (val < 0)
                {
                    b = i;
                    break;
                }
                --i;
            }

            numMeasurementAreaStart.Value = a;
            numMeasurementAreaEnd.Value   = b;


            //chartSurface.Series[0].ChartType = SeriesChartType.Line;
            //  _myChart.SeriesPoints = mlsBuilder.Correlations;
            do
            {
                CreateDistribution(mlsBuilder, a - 1, b - a + 1);
            } while (mlsBuilder.CreateNextMaxLenSequence());
        }
Esempio n. 2
0
        public void CreateDistribution(MaxLenSequenceBuilder mlsBuilder, int start, int len)
        {
            var ind    = start;
            var maxVal = 0.0;
            var maxInd = 0;

            foreach (var val in mlsBuilder.Correlations.Skip(start).Take(len))
            {
                if (val > maxVal)
                {
                    maxVal = val;
                    maxInd = ind;
                }
                ++ind;
            }
            _feedbacksDistribution[maxInd].Add(mlsBuilder.Feedback);

            _allFeedbackList.Add(new KeyValuePair <int, int>(mlsBuilder.Feedback, maxInd));
        }