當前位置: 首頁>>代碼示例>>Java>>正文


Java Doubles.min方法代碼示例

本文整理匯總了Java中com.google.common.primitives.Doubles.min方法的典型用法代碼示例。如果您正苦於以下問題:Java Doubles.min方法的具體用法?Java Doubles.min怎麽用?Java Doubles.min使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.common.primitives.Doubles的用法示例。


在下文中一共展示了Doubles.min方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getValue

import com.google.common.primitives.Doubles; //導入方法依賴的package包/類
@Override
protected double getValue(ContextVector source, ContextVector target, Explanation expl) {
	double infSum = 0;
	double supSum = 0;
	Set<Term> terms = Sets.newHashSet();
	terms.addAll(source.terms());
	terms.addAll(target.terms());
	double sourceValue;
	double targetValue;
	double partialInf;
	double partialSup;
	for (Term term : terms) {
		sourceValue = source.getAssocRate(term);
		targetValue = target.getAssocRate(term);
		partialInf = Doubles.min(sourceValue, targetValue);
		partialSup = Doubles.max(sourceValue, targetValue);
		infSum += partialInf;
		supSum += partialSup;
		if(partialInf > 0)
			expl.addExplanation(term, partialInf);
	}
	return supSum == 0 ? 0 : infSum / supSum;
}
 
開發者ID:termsuite,項目名稱:termsuite-core,代碼行數:24,代碼來源:Jaccard.java

示例2: checkBroadcastConditions

import com.google.common.primitives.Doubles; //導入方法依賴的package包/類
protected boolean checkBroadcastConditions(RelOptPlanner planner, JoinRel join, RelNode left, RelNode right) {
  final RelMetadataQuery mq = join.getCluster().getMetadataQuery();
  // right node is the one that is being considered to be broadcasted
  final double rightRowCount = mq.getRowCount(right);
  if (rightRowCount < PrelUtil.getSettings(join.getCluster()).getBroadcastThreshold()
      && ! left.getTraitSet().getTrait(DistributionTraitDef.INSTANCE).equals(DistributionTrait.SINGLETON)
      && (join.getJoinType() == JoinRelType.INNER || join.getJoinType() == JoinRelType.LEFT)) {
    // DX-3862:  For broadcast joins, the cost should not just consider the traits and join type.  If the broadcast table is small enough,
    // we shouldn't need to worry too much and allow broadcast join and see what the planner picks.
    final PlannerSettings plannerSettings = PrelUtil.getSettings(join.getCluster());
    if (rightRowCount <= plannerSettings.getOptions().getOption(PlannerSettings.BROADCAST_MIN_THRESHOLD)) {
      logger.debug("Enable broadcast plan? true (rightRowCount %d smaller than minimum broadcast threshold)", rightRowCount);
      return true;
    }

    // In this case, the broadcast table is big-ish.  So, we should check to see if it is reasonable to do broadcast.
    // The broadcasted table will be sent at most (numEndPoints * maxWidthPerNode) times, (rightRowCount) rows.  We add a
    // penalty to broadcast (broadcastFactor).
    final double broadcastFactor = plannerSettings.getBroadcastFactor();
    final double leftRowCount = mq.getRowCount(left);

    final int numEndPoints = plannerSettings.numEndPoints();
    final long maxWidthPerNode = plannerSettings.getNumCoresPerExecutor();
    final long maxWidthPerQuery = plannerSettings.getOptions().getOption(ExecConstants.MAX_WIDTH_GLOBAL);
    final long sliceTarget = plannerSettings.getSliceTarget();
    final double minFactor = Doubles.min(leftRowCount * 1.0 / sliceTarget, numEndPoints * maxWidthPerNode, maxWidthPerQuery);
    final boolean enableBroadCast = (minFactor * broadcastFactor < leftRowCount);
    logger.debug("Enable broadcast plan? %s minFactor %d (numEndPoints %d, maxWidthPerNode %d, rightRowCount %d, broadcastFactor %d, leftRowCount %d, sliceTarget %d, maxWidthPerQuery %d)",
        enableBroadCast, minFactor, numEndPoints, maxWidthPerNode, rightRowCount, broadcastFactor, leftRowCount, sliceTarget, maxWidthPerQuery);
    return enableBroadCast;
  }
  return false;
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:34,代碼來源:JoinPruleBase.java


注:本文中的com.google.common.primitives.Doubles.min方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。