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


Java FastMath.exp方法代碼示例

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


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

示例1: logDensity

import org.apache.commons.math3.util.FastMath; //導入方法依賴的package包/類
/** {@inheritDoc} */
@Override
public double logDensity(double x) {
    if (x < 0) {
        return Double.NEGATIVE_INFINITY;
    }

    final double xscale = x / scale;
    final double logxscalepow = FastMath.log(xscale) * (shape - 1);

    /*
     * FastMath.pow(x / scale, shape) =
     * FastMath.pow(xscale, shape) =
     * FastMath.pow(xscale, shape - 1) * xscale
     */
    final double xscalepowshape = FastMath.exp(logxscalepow) * xscale;

    return FastMath.log(shape / scale) + logxscalepow - xscalepowshape;
}
 
開發者ID:biocompibens,項目名稱:SME,代碼行數:20,代碼來源:WeibullDistribution.java

示例2: gradient

import org.apache.commons.math3.util.FastMath; //導入方法依賴的package包/類
/**
 * Computes the value of the gradient at {@code x}.
 * The components of the gradient vector are the partial
 * derivatives of the function with respect to each of the
 * <em>parameters</em>.
 *
 * @param x Value at which the gradient must be computed.
 * @param param Values for {@code k}, {@code m}, {@code b}, {@code q},
 * {@code a} and  {@code n}.
 * @return the gradient vector at {@code x}.
 * @throws NullArgumentException if {@code param} is {@code null}.
 * @throws DimensionMismatchException if the size of {@code param} is
 * not 6.
 */
public double[] gradient(double x, double ... param) {
    validateParameters(param);

    final double b = param[2];
    final double q = param[3];

    final double mMinusX = param[1] - x;
    final double oneOverN = 1 / param[5];
    final double exp = FastMath.exp(b * mMinusX);
    final double qExp = q * exp;
    final double qExp1 = qExp + 1;
    final double factor1 = (param[0] - param[4]) * oneOverN / FastMath.pow(qExp1, oneOverN);
    final double factor2 = -factor1 / qExp1;

    // Components of the gradient.
    final double gk = Logistic.value(mMinusX, 1, b, q, 0, oneOverN);
    final double gm = factor2 * b * qExp;
    final double gb = factor2 * mMinusX * qExp;
    final double gq = factor2 * exp;
    final double ga = Logistic.value(mMinusX, 0, b, q, 1, oneOverN);
    final double gn = factor1 * Math.log(qExp1) * oneOverN;

    return new double[] { gk, gm, gb, gq, ga, gn };
}
 
開發者ID:jiaminghan,項目名稱:droidplanner-master,代碼行數:39,代碼來源:Logistic.java

示例3: value

import org.apache.commons.math3.util.FastMath; //導入方法依賴的package包/類
private Double value() {
    if (n > 0) {
        return FastMath.exp(value / n);
    } else {
        return null;
    }
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:8,代碼來源:GeometricMeanAggregation.java

示例4: getResult

import org.apache.commons.math3.util.FastMath; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public double getResult() {
    if (sumOfLogs.getN() > 0) {
        return FastMath.exp(sumOfLogs.getResult() / sumOfLogs.getN());
    } else {
        return Double.NaN;
    }
}
 
開發者ID:biocompibens,項目名稱:SME,代碼行數:12,代碼來源:GeometricMean.java

示例5: cumulativeProbability

import org.apache.commons.math3.util.FastMath; //導入方法依賴的package包/類
/** {@inheritDoc} */
public double cumulativeProbability(double x) {
    double ret;
    if (x <= 0.0) {
        ret = 0.0;
    } else {
        ret = 1.0 - FastMath.exp(-FastMath.pow(x / scale, shape));
    }
    return ret;
}
 
開發者ID:biocompibens,項目名稱:SME,代碼行數:11,代碼來源:WeibullDistribution.java

示例6: gradient

import org.apache.commons.math3.util.FastMath; //導入方法依賴的package包/類
/**
 * Computes the value of the gradient at {@code x}.
 * The components of the gradient vector are the partial
 * derivatives of the function with respect to each of the
 * <em>parameters</em>.
 *
 * @param x Value at which the gradient must be computed.
 * @param param Values for {@code k}, {@code m}, {@code b}, {@code q},
 * {@code a} and  {@code n}.
 * @return the gradient vector at {@code x}.
 * @throws NullArgumentException if {@code param} is {@code null}.
 * @throws DimensionMismatchException if the size of {@code param} is
 * not 6.
 * @throws NotStrictlyPositiveException if {@code param[5] <= 0}.
 */
public double[] gradient(double x, double ... param)
    throws NullArgumentException,
           DimensionMismatchException,
           NotStrictlyPositiveException {
    validateParameters(param);

    final double b = param[2];
    final double q = param[3];

    final double mMinusX = param[1] - x;
    final double oneOverN = 1 / param[5];
    final double exp = FastMath.exp(b * mMinusX);
    final double qExp = q * exp;
    final double qExp1 = qExp + 1;
    final double factor1 = (param[0] - param[4]) * oneOverN / FastMath.pow(qExp1, oneOverN);
    final double factor2 = -factor1 / qExp1;

    // Components of the gradient.
    final double gk = Logistic.value(mMinusX, 1, b, q, 0, oneOverN);
    final double gm = factor2 * b * qExp;
    final double gb = factor2 * mMinusX * qExp;
    final double gq = factor2 * exp;
    final double ga = Logistic.value(mMinusX, 0, b, q, 1, oneOverN);
    final double gn = factor1 * FastMath.log(qExp1) * oneOverN;

    return new double[] { gk, gm, gb, gq, ga, gn };
}
 
開發者ID:biocompibens,項目名稱:SME,代碼行數:43,代碼來源:Logistic.java

示例7: hIntegralInverse

import org.apache.commons.math3.util.FastMath; //導入方法依賴的package包/類
/**
 * The inverse function of H(x).
 *
 * @param x free parameter
 * @return y for which {@code H(y) = x}
 */
private double hIntegralInverse(final double x) {
    double t = x*(1d-exponent);
    if (t < -1d) {
        // Limit value to the range [-1, +inf).
        // t could be smaller than -1 in some rare cases due to numerical errors.
        t = -1;
    }
    return FastMath.exp(helper1(t)*x);
}
 
開發者ID:biocompibens,項目名稱:SME,代碼行數:16,代碼來源:ZipfDistribution.java

示例8: probability

import org.apache.commons.math3.util.FastMath; //導入方法依賴的package包/類
/** {@inheritDoc} */
public double probability(int x) {
    final double logProbability = logProbability(x);
    return logProbability == Double.NEGATIVE_INFINITY ? 0 : FastMath.exp(logProbability);
}
 
開發者ID:biocompibens,項目名稱:SME,代碼行數:6,代碼來源:HypergeometricDistribution.java

示例9: unboundedToBounded

import org.apache.commons.math3.util.FastMath; //導入方法依賴的package包/類
/** {@inheritDoc} */
public double unboundedToBounded(final double y) {
    return upper - FastMath.exp(-y);
}
 
開發者ID:biocompibens,項目名稱:SME,代碼行數:5,代碼來源:MultivariateFunctionMappingAdapter.java

示例10: density

import org.apache.commons.math3.util.FastMath; //導入方法依賴的package包/類
/** {@inheritDoc} */
public double density(double x) {
    return FastMath.exp(-FastMath.abs(x - mu) / beta) / (2.0 * beta);
}
 
開發者ID:biocompibens,項目名稱:SME,代碼行數:5,代碼來源:LaplaceDistribution.java

示例11: exp

import org.apache.commons.math3.util.FastMath; //導入方法依賴的package包/類
/** {@inheritDoc} */
public SparseGradient exp() {
    final double e = FastMath.exp(value);
    return new SparseGradient(e, e, derivatives);
}
 
開發者ID:biocompibens,項目名稱:SME,代碼行數:6,代碼來源:SparseGradient.java

示例12: cumulativeProbability

import org.apache.commons.math3.util.FastMath; //導入方法依賴的package包/類
/** {@inheritDoc} */
public double cumulativeProbability(double x) {
    final double z = (x - mu) / beta;
    return FastMath.exp(-FastMath.exp(-z));
}
 
開發者ID:biocompibens,項目名稱:SME,代碼行數:6,代碼來源:GumbelDistribution.java

示例13: density

import org.apache.commons.math3.util.FastMath; //導入方法依賴的package包/類
/** {@inheritDoc} */
public double density(double x) {
    return FastMath.exp(logDensity(x));
}
 
開發者ID:biocompibens,項目名稱:SME,代碼行數:5,代碼來源:TDistribution.java

示例14: expm1

import org.apache.commons.math3.util.FastMath; //導入方法依賴的package包/類
/** {@inheritDoc} */
public SparseGradient expm1() {
    return new SparseGradient(FastMath.expm1(value), FastMath.exp(value), derivatives);
}
 
開發者ID:biocompibens,項目名稱:SME,代碼行數:5,代碼來源:SparseGradient.java

示例15: evaluate

import org.apache.commons.math3.util.FastMath; //導入方法依賴的package包/類
/**
 * Returns the geometric mean of the entries in the specified portion
 * of the input array.
 * <p>
 * See {@link GeometricMean} for details on the computing algorithm.</p>
 * <p>
 * Throws <code>IllegalArgumentException</code> if the array is null.</p>
 *
 * @param values input array containing the values
 * @param begin first array element to include
 * @param length the number of elements to include
 * @return the geometric mean or Double.NaN if length = 0 or
 * any of the values are &lt;= 0.
 * @throws MathIllegalArgumentException if the input array is null or the array
 * index parameters are not valid
 */
@Override
public double evaluate(
    final double[] values, final int begin, final int length)
throws MathIllegalArgumentException {
    return FastMath.exp(
        sumOfLogs.evaluate(values, begin, length) / length);
}
 
開發者ID:biocompibens,項目名稱:SME,代碼行數:24,代碼來源:GeometricMean.java


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