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[]
cachec
Cache for data to be inserted.private int
cachefill
Cache fill sizeprivate double[]
cachev
Cache for data to be inserted.private int
destsize
Destination (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 double
downsample(double[] data, int start, int end, int size)
Perform downsampling on a number of bins.double
get(double coord)
Get the value at a particular position.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!)int
getNumBins()
Get the number of bins actually in use.void
increment(double coord, double value)
Put fresh data into the histogram (or into the cache)DoubleHistogram.Iter
iter()
Get an iterator over all histogram bins.(package private) void
materialize()
Materialize the histogram from the cache.private void
testResample(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:DoubleHistogram
Get the value at a particular position.- Overrides:
get
in 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:
increment
in 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:AbstractStaticHistogram
Get an iterator over all histogram bins.- Specified by:
iter
in interfaceHistogram
- Overrides:
iter
in classDoubleHistogram
- Returns:
- Iterator
-
getNumBins
public int getNumBins()
Description copied from class:AbstractStaticHistogram
Get the number of bins actually in use.- Specified by:
getNumBins
in interfaceHistogram
- Overrides:
getNumBins
in classAbstractStaticHistogram
- Returns:
- number of bins
-
getBinsize
public double getBinsize()
Description copied from class:AbstractStaticHistogram
Get the size (width) of a bin.- Specified by:
getBinsize
in interfaceHistogram
- Overrides:
getBinsize
in classAbstractStaticHistogram
- Returns:
- bin size
-
getCoverMinimum
public double getCoverMinimum()
Description copied from class:AbstractStaticHistogram
Get minimum (covered by bins, not data!)- Specified by:
getCoverMinimum
in interfaceHistogram
- Overrides:
getCoverMinimum
in classAbstractStaticHistogram
- Returns:
- minimum
-
getCoverMaximum
public double getCoverMaximum()
Description copied from class:AbstractStaticHistogram
Get maximum (covered by bins, not data!)- Specified by:
getCoverMaximum
in interfaceHistogram
- Overrides:
getCoverMaximum
in 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
-
-