本文整理了Java中com.clearspring.analytics.stream.quantile.QDigest.isRoot
方法的一些代码示例,展示了QDigest.isRoot
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。QDigest.isRoot
方法的具体详情如下:
包路径:com.clearspring.analytics.stream.quantile.QDigest
类名称:QDigest
方法名:isRoot
暂无
代码示例来源:origin: addthis/stream-lib
private void compressFully() {
// Restore property 2 at each node.
Long[] allNodes = node2count.keySet().toArray(new Long[node2count.size()]);
for (long node : allNodes) {
// The root node is not compressible: it has no parent and no sibling
if (!isRoot(node)) {
compressDownward(node);
}
}
}
代码示例来源:origin: addthis/stream-lib
/**
* Restore P2 at node and upward the spine. Note that P2 can vanish
* at some nodes sideways as a result of this. We'll fix that later
* in compressFully when needed.
*/
private void compressUpward(long node) {
double threshold = Math.floor(size / compressionFactor);
long atNode = get(node);
while (!isRoot(node)) {
if (atNode > threshold) {
break;
}
long atSibling = get(sibling(node));
if (atNode + atSibling > threshold) {
break;
}
long atParent = get(parent(node));
if (atNode + atSibling + atParent > threshold) {
break;
}
node2count.addTo(parent(node), atNode + atSibling);
node2count.remove(node);
if (atSibling > 0) {
node2count.remove(sibling(node));
}
node = parent(node);
atNode = atParent + atNode + atSibling;
}
}
代码示例来源:origin: com.addthis/stream-lib
private void compressFully() {
// Restore property 2 at each node.
Long[] allNodes = node2count.keySet().toArray(new Long[node2count.size()]);
for (long node : allNodes) {
// The root node is not compressible: it has no parent and no sibling
if (!isRoot(node)) {
compressDownward(node);
}
}
}
代码示例来源:origin: com.addthis/stream-lib
/**
* Restore P2 at node and upward the spine. Note that P2 can vanish
* at some nodes sideways as a result of this. We'll fix that later
* in compressFully when needed.
*/
private void compressUpward(long node) {
double threshold = Math.floor(size / compressionFactor);
long atNode = get(node);
while (!isRoot(node)) {
if (atNode > threshold) {
break;
}
long atSibling = get(sibling(node));
if (atNode + atSibling > threshold) {
break;
}
long atParent = get(parent(node));
if (atNode + atSibling + atParent > threshold) {
break;
}
node2count.addTo(parent(node), atNode + atSibling);
node2count.remove(node);
if (atSibling > 0) {
node2count.remove(sibling(node));
}
node = parent(node);
atNode = atParent + atNode + atSibling;
}
}
内容来源于网络,如有侵权,请联系作者删除!