T
- Data typepublic abstract class AbstractObjDynamicHistogram<T> extends ObjHistogram<T>
ObjHistogram.BucketFactory<T>, ObjHistogram.Iter
Modifier and Type | Field and Description |
---|---|
private int |
cachefill
Cache fill size
|
private double[] |
cacheposs
Cache for positions to be inserted.
|
private java.lang.Object[] |
cachevals
Cache for data to be inserted.
|
private int |
destsize
Destination (minimum) size of the structure.
|
data, special, supplier
base, binsize, max, offset, size
CACHE_SHIFT
Constructor and Description |
---|
AbstractObjDynamicHistogram(int bins)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected abstract T |
aggregate(T first,
T second)
Rule to combine two bins or entries into one.
|
protected void |
aggregateSpecial(T value,
int bin)
Aggregate for a special value.
|
protected abstract T |
cloneForCache(T data)
Clone a data passed to the algorithm for computing the initial size.
|
protected abstract T |
downsample(java.lang.Object[] data,
int start,
int end,
int size)
Perform downsampling on a number of bins.
|
T |
get(double coord)
Access the value of a bin with new data.
|
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.
|
ObjHistogram.Iter |
iter()
Get an iterator over all histogram bins.
|
protected abstract T |
makeObject()
Make a new empty bucket for the data store.
|
(package private) void |
materialize()
Materialize the histogram from the cache.
|
void |
putData(double coord,
T value)
Put fresh data into the histogram (or into the cache).
|
private void |
testResample(double coord)
Test (and perform) downsampling when needed.
|
getSpecial
getBinNr, growSize
private double[] cacheposs
private java.lang.Object[] cachevals
private int cachefill
private int destsize
public AbstractObjDynamicHistogram(int bins)
bins
- Design number of bins - may become twice as large!void materialize()
public T get(double coord)
ObjHistogram
get
in class ObjHistogram<T>
coord
- Coordinatepublic void putData(double coord, T value)
coord
- Coordinatevalue
- Valueprotected void aggregateSpecial(T value, int bin)
value
- Parameter valuebin
- Special bin index.private void testResample(double coord)
coord
- coordinate to accommodate.public ObjHistogram.Iter iter()
AbstractStaticHistogram
iter
in interface Histogram
iter
in class ObjHistogram<T>
public int getNumBins()
AbstractStaticHistogram
getNumBins
in interface Histogram
getNumBins
in class AbstractStaticHistogram
public double getBinsize()
AbstractStaticHistogram
getBinsize
in interface Histogram
getBinsize
in class AbstractStaticHistogram
public double getCoverMinimum()
AbstractStaticHistogram
getCoverMinimum
in interface Histogram
getCoverMinimum
in class AbstractStaticHistogram
public double getCoverMaximum()
AbstractStaticHistogram
getCoverMaximum
in interface Histogram
getCoverMaximum
in class AbstractStaticHistogram
protected abstract T downsample(java.lang.Object[] data, int start, int end, int size)
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 twoprotected abstract T aggregate(T first, T second)
Note: first and second MAY be modified and returned, they will not be used afterwards.
first
- First bin valuesecond
- Second bin valueprotected abstract T cloneForCache(T data)
data
- Data to be clonedprotected abstract T makeObject()
Copyright © 2019 ELKI Development Team. License information.