Package com.tdunning.math.stats
Class AVLGroupTree
- All Implemented Interfaces:
Serializable
,Iterable<Centroid>
,Collection<Centroid>
A tree of t-digest centroids.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add the provided centroid to the tree.boolean
(package private) void
private void
checkAggregates
(int node) (package private) void
int
count
(int node) Return the count for the provided node.data
(int node) Return the data for the provided node.int
first()
Return the least node in the tree.int
floor
(double centroid) Return the last node whose centroid is less thancentroid
.int
floorSum
(long sum) Return the last node so that the sum of counts of nodes that are before it is less than or equal tosum
.long
headSum
(int node) Compute the number of elements and sum of counts for every entry that is strictly beforenode
.iterator()
iterator
(int startNode) double
mean
(int node) Return the mean for the provided node.int
next
(int node) Return the next node.int
prev
(int node) Return the previous node.int
size()
Return the number of centroids in the tree.int
sum()
Return the total count of points that have been added to the tree.void
Update values associated with a node, readjusting the tree if necessary.Methods inherited from class java.util.AbstractCollection
addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
equals, hashCode, parallelStream, removeIf, spliterator, stream, toArray
-
Field Details
-
centroid
private double centroid -
count
private int count -
data
-
centroids
private double[] centroids -
counts
private int[] counts -
datas
-
aggregatedCounts
private int[] aggregatedCounts -
tree
-
-
Constructor Details
-
AVLGroupTree
AVLGroupTree() -
AVLGroupTree
AVLGroupTree(boolean record)
-
-
Method Details
-
size
public int size()Return the number of centroids in the tree.- Specified by:
size
in interfaceCollection<Centroid>
- Specified by:
size
in classAbstractCollection<Centroid>
-
prev
public int prev(int node) Return the previous node. -
next
public int next(int node) Return the next node. -
mean
public double mean(int node) Return the mean for the provided node. -
count
public int count(int node) Return the count for the provided node. -
data
Return the data for the provided node. -
add
Add the provided centroid to the tree. -
add
- Specified by:
add
in interfaceCollection<Centroid>
- Overrides:
add
in classAbstractCollection<Centroid>
-
update
Update values associated with a node, readjusting the tree if necessary. -
floor
public int floor(double centroid) Return the last node whose centroid is less thancentroid
. -
floorSum
public int floorSum(long sum) Return the last node so that the sum of counts of nodes that are before it is less than or equal tosum
. -
first
public int first()Return the least node in the tree. -
headSum
public long headSum(int node) Compute the number of elements and sum of counts for every entry that is strictly beforenode
. -
iterator
- Specified by:
iterator
in interfaceCollection<Centroid>
- Specified by:
iterator
in interfaceIterable<Centroid>
- Specified by:
iterator
in classAbstractCollection<Centroid>
-
iterator
-
sum
public int sum()Return the total count of points that have been added to the tree. -
checkBalance
void checkBalance() -
checkAggregates
void checkAggregates() -
checkAggregates
private void checkAggregates(int node)
-