|
|
|||||||||||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.lmu.ifi.dbs.elki.math.Histogram<T>
T
- Histogram data type.public class Histogram<T>
Class to manage a simple Histogram.
Nested Class Summary | |
---|---|
static class |
Histogram.Constructor<T>
Interface to plug in constructors for type T. |
protected class |
Histogram.Iter
Iterator class to iterate over all bins. |
Field Summary | |
---|---|
protected double |
base
Array 'base', i.e. the point of 0.0. |
protected double |
binsize
Width of a bin. |
protected ArrayList<T> |
data
Data storage |
private Histogram.Constructor<T> |
maker
Constructor for new elements |
protected double |
max
To avoid introducing an extra bucket for the maximum value. |
protected int |
offset
Array shift to account for negative indices. |
protected int |
size
Size of array storage. |
Constructor Summary | |
---|---|
Histogram(int bins,
double min,
double max)
Histogram constructor without 'Constructor' to generate new elements. |
|
Histogram(int bins,
double min,
double max,
Histogram.Constructor<T> maker)
Histogram constructor |
Method Summary | |
---|---|
static Histogram<Pair<Double,Double>> |
DoubleDoubleHistogram(int bins,
double min,
double max)
Convenience constructor for Histograms with pairs of Doubles Uses a constructor to initialize bins with Pair(Double(0),Double(0)) |
static Histogram<Double> |
DoubleHistogram(int bins,
double min,
double max)
Convenience constructor for Double-based Histograms. |
T |
get(double coord)
Get the data at a given Coordinate. |
private int |
getBinNr(double coord)
Compute the bin number. |
double |
getBinsize()
Get the size (width) of a bin. |
double |
getCoverMaximum()
Get maximum (covered by bins, not data!) |
double |
getCoverMinimum()
Get minimum (covered by bins, not data!) |
ArrayList<T> |
getData()
Get the raw data. |
int |
getNumBins()
Get the number of bins actually in use. |
static Histogram<Integer> |
IntHistogram(int bins,
double min,
double max)
Convenience constructor for Integer-based Histograms. |
static Histogram<Pair<Integer,Integer>> |
IntIntHistogram(int bins,
double min,
double max)
Convenience constructor for Histograms with pairs of Integers Uses a constructor to initialize bins with Pair(Integer(0),Integer(0)) |
Iterator<Pair<Double,T>> |
iterator()
Get an iterator over all histogram bins. |
private T |
make()
Call the constructor to produce a new element, if possible. |
static Histogram<MeanVariance> |
MeanVarianceHistogram(int bins,
double min,
double max)
Convenience constructor for MeanVariance -based Histograms. |
void |
put(double coord,
T d)
Put data at a given coordinate. |
private void |
putBin(int bin,
T d)
Internal put function to handle the special cases of histogram resizing. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int offset
protected int size
protected double base
protected double max
protected double binsize
protected ArrayList<T> data
private Histogram.Constructor<T> maker
Constructor Detail |
---|
public Histogram(int bins, double min, double max, Histogram.Constructor<T> maker)
bins
- Number of bins to use.min
- Minimum Valuemax
- Maximum Valuemaker
- Constructor for new elements.public Histogram(int bins, double min, double max)
bins
- Number of binsmin
- Minimum valuemax
- Maximum value.Method Detail |
---|
private T make()
public T get(double coord)
coord
- Coordinate.
public void put(double coord, T d)
coord
- d
- private int getBinNr(double coord)
coord
- Coordinate
private void putBin(int bin, T d)
bin
- bin numberd
- data to putpublic ArrayList<T> getData()
public Iterator<Pair<Double,T>> iterator()
iterator
in interface Iterable<Pair<Double,T>>
public static final Histogram<Integer> IntHistogram(int bins, double min, double max)
bins
- Number of binsmin
- Minimum coordinatemax
- Maximum coordinate
public static final Histogram<Double> DoubleHistogram(int bins, double min, double max)
bins
- Number of binsmin
- Minimum coordinatemax
- Maximum coordinate
public static final Histogram<Pair<Integer,Integer>> IntIntHistogram(int bins, double min, double max)
bins
- Number of binsmin
- Minimum coordinatemax
- Maximum coordinate
public static final Histogram<Pair<Double,Double>> DoubleDoubleHistogram(int bins, double min, double max)
bins
- Number of binsmin
- Minimum coordinatemax
- Maximum coordinate
public static final Histogram<MeanVariance> MeanVarianceHistogram(int bins, double min, double max)
MeanVariance
-based Histograms.
Uses a constructor to initialize bins with new MeanVariance
objects
bins
- Number of binsmin
- Minimum coordinatemax
- Maximum coordinate
MeanVariance
.public int getNumBins()
public double getBinsize()
public double getCoverMinimum()
public double getCoverMaximum()
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |