Class DoubleDynamicHistogram
- java.lang.Object
-
- elki.utilities.datastructures.histogram.AbstractStaticHistogram
-
- elki.utilities.datastructures.histogram.DoubleHistogram
-
- elki.utilities.datastructures.histogram.DoubleDynamicHistogram
-
- All Implemented Interfaces:
Histogram
public class DoubleDynamicHistogram extends DoubleHistogram
A flexible histogram storing double, that can dynamically adapt the number of bins to the data fed into the histogram.- Since:
- 0.5.5
- Author:
- Erich Schubert
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class elki.utilities.datastructures.histogram.DoubleHistogram
DoubleHistogram.Iter
-
-
Field Summary
Fields Modifier and Type Field Description private double[]cachecCache for data to be inserted.private intcachefillCache fill sizeprivate double[]cachevCache for data to be inserted.private intdestsizeDestination (minimum) size of the structure.-
Fields inherited from class elki.utilities.datastructures.histogram.DoubleHistogram
data
-
Fields inherited from class elki.utilities.datastructures.histogram.AbstractStaticHistogram
base, binsize, max, offset, size
-
Fields inherited from interface elki.utilities.datastructures.histogram.Histogram
CACHE_SHIFT
-
-
Constructor Summary
Constructors Constructor Description DoubleDynamicHistogram(int bins)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected doubledownsample(double[] data, int start, int end, int size)Perform downsampling on a number of bins.doubleget(double coord)Get the value at a particular position.doublegetBinsize()Get the size (width) of a bin.doublegetCoverMaximum()Get maximum (covered by bins, not data!)doublegetCoverMinimum()Get minimum (covered by bins, not data!)intgetNumBins()Get the number of bins actually in use.voidincrement(double coord, double value)Put fresh data into the histogram (or into the cache)DoubleHistogram.Iteriter()Get an iterator over all histogram bins.(package private) voidmaterialize()Materialize the histogram from the cache.private voidtestResample(double coord)Test (and perform) downsampling when neede.-
Methods inherited from class elki.utilities.datastructures.histogram.AbstractStaticHistogram
getBinNr, growSize
-
-
-
-
Method Detail
-
materialize
void materialize()
Materialize the histogram from the cache.
-
get
public double get(double coord)
Description copied from class:DoubleHistogramGet the value at a particular position.- Overrides:
getin classDoubleHistogram- Parameters:
coord- Coordinate- Returns:
- Value
-
increment
public void increment(double coord, double value)Put fresh data into the histogram (or into the cache)- Overrides:
incrementin classDoubleHistogram- Parameters:
coord- Coordinatevalue- Value
-
testResample
private void testResample(double coord)
Test (and perform) downsampling when neede.- Parameters:
coord- coordinate to accomodate.
-
iter
public DoubleHistogram.Iter iter()
Description copied from class:AbstractStaticHistogramGet an iterator over all histogram bins.- Specified by:
iterin interfaceHistogram- Overrides:
iterin classDoubleHistogram- Returns:
- Iterator
-
getNumBins
public int getNumBins()
Description copied from class:AbstractStaticHistogramGet the number of bins actually in use.- Specified by:
getNumBinsin interfaceHistogram- Overrides:
getNumBinsin classAbstractStaticHistogram- Returns:
- number of bins
-
getBinsize
public double getBinsize()
Description copied from class:AbstractStaticHistogramGet the size (width) of a bin.- Specified by:
getBinsizein interfaceHistogram- Overrides:
getBinsizein classAbstractStaticHistogram- Returns:
- bin size
-
getCoverMinimum
public double getCoverMinimum()
Description copied from class:AbstractStaticHistogramGet minimum (covered by bins, not data!)- Specified by:
getCoverMinimumin interfaceHistogram- Overrides:
getCoverMinimumin classAbstractStaticHistogram- Returns:
- minimum
-
getCoverMaximum
public double getCoverMaximum()
Description copied from class:AbstractStaticHistogramGet maximum (covered by bins, not data!)- Specified by:
getCoverMaximumin interfaceHistogram- Overrides:
getCoverMaximumin classAbstractStaticHistogram- Returns:
- maximum
-
downsample
protected double downsample(double[] data, int start, int end, int size)Perform downsampling on a number of bins.- Parameters:
data- Data array (needs cast!)start- Interval startend- Interval end (exclusive)size- Intended size - extra bins are assumed to be empty, should be a power of two- Returns:
- New bin value
-
-