ProGAL.statistics
Class Histogram

java.lang.Object
  extended by ProGAL.statistics.Histogram

public class Histogram
extends java.lang.Object

A class representing a one-dimensional histogram with irregular width bins. A min and max value can be specified as well as the individual bin widths. If a value higher than the max is added then it is added to the rightmost bin (vice versa for values below the min. value).

Author:
R.Fonseca

Constructor Summary
Histogram(double[] binWidths)
           
Histogram(double minValue, double[] binWidths)
           
Histogram(double minValue, double maxValue, int bins)
           
 
Method Summary
 void addValue(double v)
           
 void addValues(java.util.List<java.lang.Double> vals)
           
 double[] binCenters()
           
 double[] binMinima()
           
 double[] binWidths()
           
static Histogram createBalancedHistogram(java.util.List<java.lang.Double> values, int bins)
          Construct an IrregularHistogram with min-value and bin-widths such that each bin contains roughly the same number of values if the values are added.
 int getBin(double value)
           
 int[] histogramArray()
           
 double[] histogramNormalizedArray()
           
 java.lang.String toGnuplotString()
           
 java.lang.String toGnuplotString(int dec)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Histogram

public Histogram(double minValue,
                 double maxValue,
                 int bins)

Histogram

public Histogram(double minValue,
                 double[] binWidths)

Histogram

public Histogram(double[] binWidths)
Method Detail

addValue

public void addValue(double v)

addValues

public void addValues(java.util.List<java.lang.Double> vals)

getBin

public int getBin(double value)

histogramArray

public int[] histogramArray()

histogramNormalizedArray

public double[] histogramNormalizedArray()

binCenters

public double[] binCenters()

binMinima

public double[] binMinima()

binWidths

public double[] binWidths()

toGnuplotString

public java.lang.String toGnuplotString(int dec)

toGnuplotString

public java.lang.String toGnuplotString()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

createBalancedHistogram

public static Histogram createBalancedHistogram(java.util.List<java.lang.Double> values,
                                                int bins)
Construct an IrregularHistogram with min-value and bin-widths such that each bin contains roughly the same number of values if the values are added. If all values are different then the occupancy of one bin will, at most, be one different from the occupancy of any other bin. Note that the returned histogram is empty.