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

The following examples show how to use org.apache.commons.math3.util.FastMath#log10() . 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_t.java    From coming with MIT License 6 votes vote down vote up
/** Computes base 10 logarithm 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
 * base 10 logarithm the result array <em>cannot</em> be the input array)
 * @param resultOffset offset of the result in its array
 */
public void log10(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.log10(operand[operandOffset]);
    if (order > 0) {
        double inv = 1.0 / operand[operandOffset];
        double xk  = inv / FastMath.log(10.0);
        for (int i = 1; i <= order; ++i) {
            function[i] = xk;
            xk *= -i * inv;
        }
    }

    // apply function composition
    compose(operand, operandOffset, function, result, resultOffset);

}
 
Example 2
Source File: DSCompiler.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Computes base 10 logarithm 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
 * base 10 logarithm the result array <em>cannot</em> be the input array)
 * @param resultOffset offset of the result in its array
 */
public void log10(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.log10(operand[operandOffset]);
    if (order > 0) {
        double inv = 1.0 / operand[operandOffset];
        double xk  = inv / FastMath.log(10.0);
        for (int i = 1; i <= order; ++i) {
            function[i] = xk;
            xk *= -i * inv;
        }
    }

    // apply function composition
    compose(operand, operandOffset, function, result, resultOffset);

}
 
Example 3
Source File: DSCompiler.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Computes base 10 logarithm 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
 * base 10 logarithm the result array <em>cannot</em> be the input array)
 * @param resultOffset offset of the result in its array
 */
public void log10(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.log10(operand[operandOffset]);
    if (order > 0) {
        double inv = 1.0 / operand[operandOffset];
        double xk  = inv / FastMath.log(10.0);
        for (int i = 1; i <= order; ++i) {
            function[i] = xk;
            xk *= -i * inv;
        }
    }

    // apply function composition
    compose(operand, operandOffset, function, result, resultOffset);

}
 
Example 4
Source File: DSCompiler.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Computes base 10 logarithm 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
 * base 10 logarithm the result array <em>cannot</em> be the input array)
 * @param resultOffset offset of the result in its array
 */
public void log10(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.log10(operand[operandOffset]);
    if (order > 0) {
        double inv = 1.0 / operand[operandOffset];
        double xk  = inv / FastMath.log(10.0);
        for (int i = 1; i <= order; ++i) {
            function[i] = xk;
            xk *= -i * inv;
        }
    }

    // apply function composition
    compose(operand, operandOffset, function, result, resultOffset);

}
 
Example 5
Source File: DSCompiler.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Computes base 10 logarithm 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
 * base 10 logarithm the result array <em>cannot</em> be the input array)
 * @param resultOffset offset of the result in its array
 */
public void log10(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.log10(operand[operandOffset]);
    if (order > 0) {
        double inv = 1.0 / operand[operandOffset];
        double xk  = inv / FastMath.log(10.0);
        for (int i = 1; i <= order; ++i) {
            function[i] = xk;
            xk *= -i * inv;
        }
    }

    // apply function composition
    compose(operand, operandOffset, function, result, resultOffset);

}
 
Example 6
Source File: DSCompiler.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Computes base 10 logarithm 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
 * base 10 logarithm the result array <em>cannot</em> be the input
 * array)
 */
public void log10(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.log10(operand[operandOffset]);
    if (order > 0) {
        double inv = 1.0 / operand[operandOffset];
        double xk  = inv / FastMath.log(10.0);
        for (int i = 1; i <= order; ++i) {
            function[i] = xk;
            xk *= -i * inv;
        }
    }

    // apply function composition
    compose(operand, operandOffset, function, result, resultOffset);

}
 
Example 7
Source File: DSCompiler.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** Computes base 10 logarithm 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
 * base 10 logarithm the result array <em>cannot</em> be the input array)
 * @param resultOffset offset of the result in its array
 */
public void log10(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.log10(operand[operandOffset]);
    if (order > 0) {
        double inv = 1.0 / operand[operandOffset];
        double xk  = inv / FastMath.log(10.0);
        for (int i = 1; i <= order; ++i) {
            function[i] = xk;
            xk *= -i * inv;
        }
    }

    // apply function composition
    compose(operand, operandOffset, function, result, resultOffset);

}
 
Example 8
Source File: Math_10_DSCompiler_s.java    From coming with MIT License 6 votes vote down vote up
/** Computes base 10 logarithm 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
 * base 10 logarithm the result array <em>cannot</em> be the input array)
 * @param resultOffset offset of the result in its array
 */
public void log10(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.log10(operand[operandOffset]);
    if (order > 0) {
        double inv = 1.0 / operand[operandOffset];
        double xk  = inv / FastMath.log(10.0);
        for (int i = 1; i <= order; ++i) {
            function[i] = xk;
            xk *= -i * inv;
        }
    }

    // apply function composition
    compose(operand, operandOffset, function, result, resultOffset);

}
 
Example 9
Source File: Log10.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/** {@inheritDoc} */
public double value(double x) {
    return FastMath.log10(x);
}
 
Example 10
Source File: Log10.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/** {@inheritDoc} */
public double value(double x) {
    return FastMath.log10(x);
}
 
Example 11
Source File: Log10.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/** {@inheritDoc} */
public double value(double x) {
    return FastMath.log10(x);
}
 
Example 12
Source File: SparseGradient.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/** Base 10 logarithm.
 * @return base 10 logarithm of the instance
 */
public SparseGradient log10() {
    return new SparseGradient(FastMath.log10(value), 1.0 / (FastMath.log(10.0) * value), derivatives);
}
 
Example 13
Source File: Log10.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/** {@inheritDoc} */
public double value(double x) {
    return FastMath.log10(x);
}
 
Example 14
Source File: Log10.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/** {@inheritDoc} */
public double value(double x) {
    return FastMath.log10(x);
}
 
Example 15
Source File: Log10.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/** {@inheritDoc} */
public double value(double x) {
    return FastMath.log10(x);
}
 
Example 16
Source File: Log10.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/** {@inheritDoc} */
public double value(double x) {
    return FastMath.log10(x);
}
 
Example 17
Source File: Log10.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/** {@inheritDoc} */
public double value(double x) {
    return FastMath.log10(x);
}
 
Example 18
Source File: SparseGradient.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/** Base 10 logarithm.
 * @return base 10 logarithm of the instance
 */
public SparseGradient log10() {
    return new SparseGradient(FastMath.log10(value), 1.0 / (FastMath.log(10.0) * value), derivatives);
}
 
Example 19
Source File: AxisTypeConverter.java    From microMathematics with GNU General Public License v3.0 4 votes vote down vote up
public static double toSpecialType(final double value, Type type)
{
    return (type == Type.LINEAR) ? value : FastMath.log10(value);
}