org.apache.commons.math3.special.Gamma.logGamma()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(124)

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

Gamma.logGamma介绍

[英]Returns the value of log Γ(x) for x > 0.

For x ≤ 8, the implementation is based on the double precision implementation in the NSWC Library of Mathematics Subroutines, DGAMLN. For x > 8, the implementation is based on

代码示例

代码示例来源:origin: org.apache.commons/commons-math3

/** Recompute the normalization factor. */
private void recomputeZ() {
  if (Double.isNaN(z)) {
    z = Gamma.logGamma(alpha) + Gamma.logGamma(beta) - Gamma.logGamma(alpha + beta);
  }
}

代码示例来源:origin: org.apache.commons/commons-math3

/**
 * Creates a t distribution.
 *
 * @param rng Random number generator.
 * @param degreesOfFreedom Degrees of freedom.
 * @param inverseCumAccuracy the maximum absolute error in inverse
 * cumulative probability estimates
 * (defaults to {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY}).
 * @throws NotStrictlyPositiveException if {@code degreesOfFreedom <= 0}
 * @since 3.1
 */
public TDistribution(RandomGenerator rng,
           double degreesOfFreedom,
           double inverseCumAccuracy)
  throws NotStrictlyPositiveException {
  super(rng);
  if (degreesOfFreedom <= 0) {
    throw new NotStrictlyPositiveException(LocalizedFormats.DEGREES_OF_FREEDOM,
                        degreesOfFreedom);
  }
  this.degreesOfFreedom = degreesOfFreedom;
  solverAbsoluteAccuracy = inverseCumAccuracy;
  final double n = degreesOfFreedom;
  final double nPlus1Over2 = (n + 1) / 2;
  factor = Gamma.logGamma(nPlus1Over2) -
       0.5 * (FastMath.log(FastMath.PI) + FastMath.log(n)) -
       Gamma.logGamma(n / 2);
}

代码示例来源:origin: org.apache.commons/commons-math3

/**
 * used by {@link #getNumericalMean()}
 *
 * @return the mean of this distribution
 */
protected double calculateNumericalMean() {
  final double sh = getShape();
  final double sc = getScale();
  return sc * FastMath.exp(Gamma.logGamma(1 + (1 / sh)));
}

代码示例来源:origin: deeplearning4j/nd4j

ret = EXACT_STIRLING_ERRORS[(int) z2];
} else {
  ret = Gamma.logGamma(z + 1.0) - (z + 0.5) * FastMath.log(z) + z - HALF_LOG_2_PI;

代码示例来源:origin: org.apache.commons/commons-math3

ret = EXACT_STIRLING_ERRORS[(int) z2];
} else {
  ret = Gamma.logGamma(z + 1.0) - (z + 0.5) * FastMath.log(z) +
     z - HALF_LOG_2_PI;

代码示例来源:origin: org.apache.commons/commons-math3

/**
 * used by {@link #getNumericalVariance()}
 *
 * @return the variance of this distribution
 */
protected double calculateNumericalVariance() {
  final double sh = getShape();
  final double sc = getScale();
  final double mn = getNumericalMean();
  return (sc * sc) * FastMath.exp(Gamma.logGamma(1 + (2 / sh))) -
      (mn * mn);
}

代码示例来源:origin: org.apache.commons/commons-math3

ret = FastMath.exp(-x + (a * FastMath.log(x)) - logGamma(a)) * ret;

代码示例来源:origin: org.apache.commons/commons-math3

ret = 1.0;
} else {
  ret = FastMath.exp(-x + (a * FastMath.log(x)) - logGamma(a)) * sum;

代码示例来源:origin: org.apache.commons/commons-math3

(Gamma.logGamma(ared) +
       logGammaMinusLogGammaSum(ared, b));
} else {
        (Gamma.logGamma(ared) +
        (Gamma.logGamma(bred) -
        logGammaSum(ared, bred)));
  } else {
    return FastMath.log(prod1) +
        Gamma.logGamma(ared) +
        logGammaMinusLogGammaSum(ared, b);
        (Gamma.logGamma(a) +
        (Gamma.logGamma(bred) -
         logGammaSum(a, bred)));
  } else {
    return Gamma.logGamma(a) +
        logGammaMinusLogGammaSum(a, b);
  return Gamma.logGamma(a) +
      Gamma.logGamma(b) -
      logGammaSum(a, b);
  return Gamma.logGamma(a) +
      logGammaMinusLogGammaSum(a, b);
} else {

代码示例来源:origin: lenskit/lenskit

pLL = (rating == 0) ? (-eThetaBeta) : Math.log(1 - Math.exp(-eThetaBeta));
} else {
  pLL = rating * Math.log(eThetaBeta) - eThetaBeta - Gamma.logGamma(rating + 1);

代码示例来源:origin: improbable-research/keanu

@Override
public DoubleTensor logGammaInPlace() {
  value = Gamma.logGamma(value);
  return this;
}

代码示例来源:origin: geogebra/geogebra

/** Recompute the normalization factor. */
private void recomputeZ() {
  if (Double.isNaN(z)) {
    z = Gamma.logGamma(alpha) + Gamma.logGamma(beta) - Gamma.logGamma(alpha + beta);
  }
}

代码示例来源:origin: org.apache.mahout/mahout-mrlegacy

@Override
public double logP(double betaIJ) {
 return Gamma.logGamma((df + 1.0) / 2.0)
   - Math.log(df * Math.PI)
   - Gamma.logGamma(df / 2.0)
   - (df + 1.0) / 2.0 * Math.log1p(betaIJ * betaIJ);
}

代码示例来源:origin: org.apache.mahout/mahout-mr

@Override
public double logP(double betaIJ) {
 return Gamma.logGamma((df + 1.0) / 2.0)
   - Math.log(df * Math.PI)
   - Gamma.logGamma(df / 2.0)
   - (df + 1.0) / 2.0 * Math.log1p(betaIJ * betaIJ);
}

代码示例来源:origin: OpenGamma/Strata

@Override
public double applyAsDouble(double x) {
 if (x > 0.0) {
  return Math.exp(Gamma.logGamma(x));
 }
 return Math.PI / Math.sin(Math.PI * x) / applyAsDouble(1 - x);
}

代码示例来源:origin: OpenGamma/Strata

@Override
public Double apply(Double x) {
 ArgChecker.isTrue(x > 0, "x must be greater than zero");
 return Gamma.logGamma(x);
}

代码示例来源:origin: lenskit/lenskit

pLL = (rating == 0) ? (-eThetaBeta) : Math.log(1 - Math.exp(-eThetaBeta));
} else {
  pLL = rating * Math.log(eThetaBeta) - eThetaBeta - Gamma.logGamma(rating + 1);

代码示例来源:origin: geogebra/geogebra

/**
 * used by {@link #getNumericalMean()}
 *
 * @return the mean of this distribution
 */
protected double calculateNumericalMean() {
  final double sh = getShape();
  final double sc = getScale();
  return sc * Math.exp(Gamma.logGamma(1 + (1 / sh)));
}

代码示例来源:origin: improbable-research/keanu

@Test
public void logGammaMatrixVertexValues() {
  operatesOn2x2MatrixVertexValues(
    new double[]{0.0, 0.1, 0.2, 0.3},
    new double[]{Gamma.logGamma(0.0), Gamma.logGamma(0.1), Gamma.logGamma(0.2), Gamma.logGamma(0.3)},
    DoubleVertex::logGamma
  );
}

代码示例来源:origin: geogebra/geogebra

/**
 * used by {@link #getNumericalVariance()}
 *
 * @return the variance of this distribution
 */
protected double calculateNumericalVariance() {
  final double sh = getShape();
  final double sc = getScale();
  final double mn = getNumericalMean();
  return (sc * sc) * Math.exp(Gamma.logGamma(1 + (2 / sh))) -
      (mn * mn);
}

相关文章