本文整理匯總了Java中org.apache.commons.math3.util.FastMath.expm1方法的典型用法代碼示例。如果您正苦於以下問題:Java FastMath.expm1方法的具體用法?Java FastMath.expm1怎麽用?Java FastMath.expm1使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.commons.math3.util.FastMath
的用法示例。
在下文中一共展示了FastMath.expm1方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: cumulativeProbability
import org.apache.commons.math3.util.FastMath; //導入方法依賴的package包/類
/** {@inheritDoc} */
public double cumulativeProbability(int x) {
if (x < 0) {
return 0.0;
} else {
return -FastMath.expm1(log1mProbabilityOfSuccess * (x + 1));
}
}
示例2: helper2
import org.apache.commons.math3.util.FastMath; //導入方法依賴的package包/類
/**
* Helper function to calculate {@code (exp(x)-1)/x}.
* <p>
* A Taylor series expansion is used, if x is close to 0.
*
* @param x free parameter
* @return {@code (exp(x)-1)/x} if x is non-zero, or 1 if x=0
*/
static double helper2(final double x) {
if (FastMath.abs(x)>1e-8) {
return FastMath.expm1(x)/x;
}
else {
return 1.+x*(1./2.)*(1.+x*(1./3.)*(1.+x*(1./4.)));
}
}
示例3: expm1
import org.apache.commons.math3.util.FastMath; //導入方法依賴的package包/類
/** Compute exp(x) - 1 of a derivative structure.
* @param operand array holding the operand
* @param operandOffset offset of the operand in its array
* @param result array where result must be stored (for
* exponential the result array <em>cannot</em> be the input
* array)
* @param resultOffset offset of the result in its array
*/
public void expm1(final double[] operand, final int operandOffset,
final double[] result, final int resultOffset) {
// create the function value and derivatives
double[] function = new double[1 + order];
function[0] = FastMath.expm1(operand[operandOffset]);
Arrays.fill(function, 1, 1 + order, FastMath.exp(operand[operandOffset]));
// apply function composition
compose(operand, operandOffset, function, result, resultOffset);
}
示例4: value
import org.apache.commons.math3.util.FastMath; //導入方法依賴的package包/類
/** {@inheritDoc} */
public double value(double x) {
return FastMath.expm1(x);
}
示例5: expm1
import org.apache.commons.math3.util.FastMath; //導入方法依賴的package包/類
/** {@inheritDoc} */
public SparseGradient expm1() {
return new SparseGradient(FastMath.expm1(value), FastMath.exp(value), derivatives);
}
示例6: getNumericalVariance
import org.apache.commons.math3.util.FastMath; //導入方法依賴的package包/類
/**
* {@inheritDoc}
*
* For scale {@code m} and shape {@code s}, the variance is
* {@code (exp(s^2) - 1) * exp(2 * m + s^2)}.
*/
public double getNumericalVariance() {
final double s = shape;
final double ss = s * s;
return (FastMath.expm1(ss)) * FastMath.exp(2 * scale + ss);
}