Package com.tdunning.math.stats

# Class AbstractTDigest

java.lang.Object
com.tdunning.math.stats.TDigest
com.tdunning.math.stats.AbstractTDigest

Direct Known Subclasses:
  `ArrayDigest`, `AVLTreeDigest`, `TreeDigest`

public abstract class AbstractTDigest extends TDigest

## Field Summary

Fields
Modifier and Type
Field
Description
`protected Random`
`gen`
`protected boolean`
`recordAllData`

## Constructor Summary

Constructors
Constructor
Description
`AbstractTDigest()`

## Method Summary

Modifier and Type
Method
Description
`void`
`add(double x)`
Adds a sample to a histogram.
`void`
`add(TDigest other)`
Add all of the centroids of another TDigest to this one.
`abstract void`
`compress(GroupTree other)`
`protected Centroid`
`createCentroid(double mean, int id)`
`static int`
`decode(ByteBuffer buf)`
`static void`
`encode(ByteBuffer buf, int n)`
`static double`
`interpolate(double x, double x0, double x1)`
`boolean`
`isRecording()`
`protected static TDigest`
`merge(Iterable<TDigest> subData, Random gen, TDigest r)`
`TDigest`
`recordAllData()`
Sets up so that all centroids will record all data assigned to them.

### Methods inherited from class com.tdunning.math.stats.TDigest

`add, asBytes, asSmallBytes, byteSize, cdf, centroidCount, centroids, checkValue, compress, compression, createArrayDigest, createArrayDigest, createTreeDigest, quantile, size, smallByteSize`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### gen

protected Random gen

### recordAllData

protected boolean recordAllData

## Constructor Details

### AbstractTDigest

public AbstractTDigest()

## Method Details

### interpolate

public static double interpolate(double x, double x0, double x1)

### encode

public static void encode(ByteBuffer buf, int n)

### decode

public static int decode(ByteBuffer buf)

### merge

protected static TDigest merge(Iterable<TDigest> subData, Random gen, TDigest r)

### compress

public abstract void compress(GroupTree other)

### recordAllData

public TDigest recordAllData()
Sets up so that all centroids will record all data assigned to them. For testing only, really.

Specified by:
  `recordAllData` in class `TDigest`
Returns:
  This TDigest so that configurations can be done in fluent style.

### isRecording

public boolean isRecording()

Specified by:
  `isRecording` in class `TDigest`

### add

public void add(double x)
Adds a sample to a histogram.

Specified by:
  `add` in class `TDigest`
Parameters:
  `x` - The value to add.

### add

public void add(TDigest other)
Description copied from class: `TDigest`
Add all of the centroids of another TDigest to this one.

Specified by:
  `add` in class `TDigest`
Parameters:
  `other` - The other TDigest

### createCentroid

protected Centroid createCentroid(double mean, int id)