com.clearspring.analytics.stream.quantile.QDigest.leftChild()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(100)

本文整理了Java中com.clearspring.analytics.stream.quantile.QDigest.leftChild方法的一些代码示例,展示了QDigest.leftChild的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。QDigest.leftChild方法的具体详情如下:
包路径:com.clearspring.analytics.stream.quantile.QDigest
类名称:QDigest
方法名:leftChild

QDigest.leftChild介绍

暂无

代码示例

代码示例来源:origin: addthis/stream-lib

private long rangeLeft(long id) {
  while (!isLeaf(id)) {
    id = leftChild(id);
  }
  return leaf2value(id);
}

代码示例来源:origin: addthis/stream-lib

/**
 * Restore P2 at seedNode and guarantee that no new violations of P2 appeared.
 */
private void compressDownward(long seedNode) {
  double threshold = Math.floor(size / compressionFactor);
  // P2 check same as above but shorter and slower (and invoked rarely)
  LongArrayFIFOQueue q = new LongArrayFIFOQueue();
  q.enqueue(seedNode);
  while (!q.isEmpty()) {
    long node = q.dequeueLong();
    long atNode = get(node);
    long atSibling = get(sibling(node));
    if (atNode == 0 && atSibling == 0) {
      continue;
    }
    long atParent = get(parent(node));
    if (atParent + atNode + atSibling > threshold) {
      continue;
    }
    node2count.addTo(parent(node), atNode + atSibling);
    node2count.remove(node);
    node2count.remove(sibling(node));
    // Now P2 could have vanished at the node's and sibling's subtrees since they decreased.
    if (!isLeaf(node)) {
      q.enqueue(leftChild(node));
      q.enqueue(leftChild(sibling(node)));
    }
  }
}

代码示例来源:origin: com.addthis/stream-lib

private long rangeLeft(long id) {
  while (!isLeaf(id)) {
    id = leftChild(id);
  }
  return leaf2value(id);
}

代码示例来源:origin: com.addthis/stream-lib

/**
 * Restore P2 at seedNode and guarantee that no new violations of P2 appeared.
 */
private void compressDownward(long seedNode) {
  double threshold = Math.floor(size / compressionFactor);
  // P2 check same as above but shorter and slower (and invoked rarely)
  LongArrayFIFOQueue q = new LongArrayFIFOQueue();
  q.enqueue(seedNode);
  while (!q.isEmpty()) {
    long node = q.dequeueLong();
    long atNode = get(node);
    long atSibling = get(sibling(node));
    if (atNode == 0 && atSibling == 0) {
      continue;
    }
    long atParent = get(parent(node));
    if (atParent + atNode + atSibling > threshold) {
      continue;
    }
    node2count.addTo(parent(node), atNode + atSibling);
    node2count.remove(node);
    node2count.remove(sibling(node));
    // Now P2 could have vanished at the node's and sibling's subtrees since they decreased.
    if (!isLeaf(node)) {
      q.enqueue(leftChild(node));
      q.enqueue(leftChild(sibling(node)));
    }
  }
}

相关文章