Java Code Examples for org.apache.commons.math3.util.FastMath#expm1()

The following examples show how to use org.apache.commons.math3.util.FastMath#expm1() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Math_10_DSCompiler_s.java    From coming with MIT License 5 votes vote down vote up
/** 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);

}
 
Example 2
Source File: Math_10_DSCompiler_t.java    From coming with MIT License 5 votes vote down vote up
/** 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);

}
 
Example 3
Source File: DSCompiler.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** 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);

}
 
Example 4
Source File: DSCompiler.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** 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);

}
 
Example 5
Source File: DSCompiler.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** 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);

}
 
Example 6
Source File: DSCompiler.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** 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);

}
 
Example 7
Source File: DSCompiler.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** 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);

}
 
Example 8
Source File: Expm1.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/** {@inheritDoc} */
public double value(double x) {
    return FastMath.expm1(x);
}
 
Example 9
Source File: Expm1.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/** {@inheritDoc} */
public double value(double x) {
    return FastMath.expm1(x);
}
 
Example 10
Source File: SparseGradient.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/** {@inheritDoc} */
public SparseGradient expm1() {
    return new SparseGradient(FastMath.expm1(value), FastMath.exp(value), derivatives);
}
 
Example 11
Source File: Expm1Function.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
public double value(double x) {
    return FastMath.expm1(x);
}
 
Example 12
Source File: Expm1.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/** {@inheritDoc} */
public double value(double x) {
    return FastMath.expm1(x);
}
 
Example 13
Source File: Expm1.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/** {@inheritDoc} */
public double value(double x) {
    return FastMath.expm1(x);
}
 
Example 14
Source File: Expm1Function.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
public double value(double x) {
    return FastMath.expm1(x);
}
 
Example 15
Source File: Expm1.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/** {@inheritDoc} */
public double value(double x) {
    return FastMath.expm1(x);
}
 
Example 16
Source File: Expm1.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/** {@inheritDoc} */
public double value(double x) {
    return FastMath.expm1(x);
}
 
Example 17
Source File: SparseGradient.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/** {@inheritDoc} */
public SparseGradient expm1() {
    return new SparseGradient(FastMath.expm1(value), FastMath.exp(value), derivatives);
}
 
Example 18
Source File: Expm1.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/** {@inheritDoc} */
public double value(double x) {
    return FastMath.expm1(x);
}
 
Example 19
Source File: LogNormalDistribution.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * {@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);
}
 
Example 20
Source File: LogNormalDistribution.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * {@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);
}