de.lmu.ifi.dbs.elki.math
Class AggregatingHistogram<T,D>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.math.ReplacingHistogram<T>
      extended by de.lmu.ifi.dbs.elki.math.AggregatingHistogram<T,D>
Type Parameters:
T - Type of data in histogram
D - Type of input data
All Implemented Interfaces:
Iterable<Pair<Double,T>>
Direct Known Subclasses:
FlexiHistogram

public class AggregatingHistogram<T,D>
extends ReplacingHistogram<T>

Class for the typical case of an aggregating (e.g. counting, averaging) Histogram.


Nested Class Summary
static class AggregatingHistogram.Adapter<T,D>
          Adapter class for an AggregatingHistogram
 
Nested classes/interfaces inherited from class de.lmu.ifi.dbs.elki.math.ReplacingHistogram
ReplacingHistogram.Iter, ReplacingHistogram.RIter
 
Field Summary
private  AggregatingHistogram.Adapter<T,D> putter
          The class we are using for putting data.
 
Fields inherited from class de.lmu.ifi.dbs.elki.math.ReplacingHistogram
base, binsize, data, max, offset, size
 
Constructor Summary
AggregatingHistogram(int bins, double min, double max, AggregatingHistogram.Adapter<T,D> adapter)
          Constructor with Adapter.
 
Method Summary
 void aggregate(double coord, D value)
          Add a value to the histogram using the aggregation adapter.
static AggregatingHistogram<Pair<Double,Double>,Pair<Double,Double>> DoubleSumDoubleSumHistogram(int bins, double min, double max)
          Histograms that work like two DoubleSumHistogram(int, double, double), component wise.
static AggregatingHistogram<Double,Double> DoubleSumHistogram(int bins, double min, double max)
          Convenience constructor for Double-based Histograms.
static AggregatingHistogram<Integer,Integer> IntSumHistogram(int bins, double min, double max)
          Convenience constructor for Integer-based Histograms.
static AggregatingHistogram<Pair<Integer,Integer>,Pair<Integer,Integer>> IntSumIntSumHistogram(int bins, double min, double max)
          Histograms that work like two IntSumHistogram(int, double, double), component wise.
static AggregatingHistogram<Long,Long> LongSumHistogram(int bins, double min, double max)
          Convenience constructor for Long-based Histograms.
static AggregatingHistogram<Pair<Long,Long>,Pair<Long,Long>> LongSumLongSumHistogram(int bins, double min, double max)
          Histograms that work like two LongSumHistogram(int, double, double), component wise.
static AggregatingHistogram<MeanVariance,Double> MeanVarianceHistogram(int bins, double min, double max)
          Convenience constructor for MeanVariance-based Histograms.
 
Methods inherited from class de.lmu.ifi.dbs.elki.math.ReplacingHistogram
DoubleDoubleHistogram, DoubleHistogram, get, getBinNr, getBinsize, getCoverMaximum, getCoverMinimum, getData, getNumBins, IntHistogram, IntIntHistogram, iterator, make, replace, reverseIterator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

putter

private AggregatingHistogram.Adapter<T,D> putter
The class we are using for putting data.

Constructor Detail

AggregatingHistogram

public AggregatingHistogram(int bins,
                            double min,
                            double max,
                            AggregatingHistogram.Adapter<T,D> adapter)
Constructor with Adapter.

Parameters:
bins - Number of bins
min - Minimum value
max - Maximum value
adapter - Adapter
Method Detail

aggregate

public void aggregate(double coord,
                      D value)
Add a value to the histogram using the aggregation adapter.

Parameters:
coord - Coordinate
value - New value

MeanVarianceHistogram

public static AggregatingHistogram<MeanVariance,Double> MeanVarianceHistogram(int bins,
                                                                              double min,
                                                                              double max)
Convenience constructor for MeanVariance-based Histograms. Uses a constructor to initialize bins with new MeanVariance objects

Parameters:
bins - Number of bins
min - Minimum coordinate
max - Maximum coordinate
Returns:
New histogram for MeanVariance.

IntSumHistogram

public static AggregatingHistogram<Integer,Integer> IntSumHistogram(int bins,
                                                                    double min,
                                                                    double max)
Convenience constructor for Integer-based Histograms. Uses a constructor to initialize bins with Integer(0). Aggregation is done by adding the values

Parameters:
bins - Number of bins
min - Minimum coordinate
max - Maximum coordinate
Returns:
New histogram for Integers.

LongSumHistogram

public static AggregatingHistogram<Long,Long> LongSumHistogram(int bins,
                                                               double min,
                                                               double max)
Convenience constructor for Long-based Histograms. Uses a constructor to initialize bins with Long(0L). Aggregation is done by adding the values

Parameters:
bins - Number of bins
min - Minimum coordinate
max - Maximum coordinate
Returns:
New histogram for Integers.

DoubleSumHistogram

public static AggregatingHistogram<Double,Double> DoubleSumHistogram(int bins,
                                                                     double min,
                                                                     double max)
Convenience constructor for Double-based Histograms. Uses a constructor to initialize bins with Double(0.0). Aggregation is done by adding the values

Parameters:
bins - Number of bins
min - Minimum coordinate
max - Maximum coordinate
Returns:
New histogram for Double.

IntSumIntSumHistogram

public static AggregatingHistogram<Pair<Integer,Integer>,Pair<Integer,Integer>> IntSumIntSumHistogram(int bins,
                                                                                                      double min,
                                                                                                      double max)
Histograms that work like two IntSumHistogram(int, double, double), component wise.

Parameters:
bins - Number of bins.
min - Minimum value
max - Maximum value
Returns:
Histogram object

LongSumLongSumHistogram

public static AggregatingHistogram<Pair<Long,Long>,Pair<Long,Long>> LongSumLongSumHistogram(int bins,
                                                                                            double min,
                                                                                            double max)
Histograms that work like two LongSumHistogram(int, double, double), component wise.

Parameters:
bins - Number of bins.
min - Minimum value
max - Maximum value
Returns:
Histogram object

DoubleSumDoubleSumHistogram

public static AggregatingHistogram<Pair<Double,Double>,Pair<Double,Double>> DoubleSumDoubleSumHistogram(int bins,
                                                                                                        double min,
                                                                                                        double max)
Histograms that work like two DoubleSumHistogram(int, double, double), component wise.

Parameters:
bins - Number of bins.
min - Minimum value
max - Maximum value
Returns:
Histogram object

Release 0.4.0 (2011-09-20_1324)