Beispiel #1
0
        public void Fill(double[] values)
        {
            Clear();
            this.FullestBinIndex = -1;
            Array.Sort <double>(values);
            int          currentBinIndex = -1;
            HistogramBin currentBin      = m_BelowMinBin;

            for (int i = 0; i < values.Length; i++)
            {
                double value = values[i];
                while (value > currentBin.Max)
                {
                    currentBinIndex++;
                    currentBin = this[currentBinIndex];
                }

                currentBin.Count++;

                if (currentBin.Count > this[this.FullestBinIndex].Count)
                {
                    this.FullestBinIndex = currentBinIndex;
                }
            }
        }
		public Histogram(double min, double max, int binCount)
		{
			this.Min = min;
			this.Max = max;
			this.BinWidth = (max - min) / binCount;
			m_Bins = new HistogramBin[binCount];

			double binMin = min;
			double binMax;

			for (int i = 0; i < binCount; i++)
			{
				binMax = min + (i + 1) * this.BinWidth;
				m_Bins[i] = new HistogramBin(binMin, binMax);
				binMin = binMax;
			}

			m_BelowMinBin = new HistogramBin(Double.MinValue, min);
			m_AboveMaxBin = new HistogramBin(max, Double.MaxValue);
		}
Beispiel #3
0
        public Histogram(double min, double max, int binCount)
        {
            this.Min      = min;
            this.Max      = max;
            this.BinWidth = (max - min) / binCount;
            m_Bins        = new HistogramBin[binCount];

            double binMin = min;
            double binMax;

            for (int i = 0; i < binCount; i++)
            {
                binMax    = min + (i + 1) * this.BinWidth;
                m_Bins[i] = new HistogramBin(binMin, binMax);
                binMin    = binMax;
            }

            m_BelowMinBin = new HistogramBin(Double.MinValue, min);
            m_AboveMaxBin = new HistogramBin(max, Double.MaxValue);
        }