当前位置: 首页>>代码示例>>Java>>正文


Java FastMath.rint方法代码示例

本文整理汇总了Java中org.apache.commons.math3.util.FastMath.rint方法的典型用法代码示例。如果您正苦于以下问题:Java FastMath.rint方法的具体用法?Java FastMath.rint怎么用?Java FastMath.rint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.math3.util.FastMath的用法示例。


在下文中一共展示了FastMath.rint方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: remainder

import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
/** Perform remainder of two derivative structures.
 * @param lhs array holding left hand side of remainder
 * @param lhsOffset offset of the left hand side in its array
 * @param rhs array right hand side of remainder
 * @param rhsOffset offset of the right hand side in its array
 * @param result array where result must be stored (it may be
 * one of the input arrays)
 * @param resultOffset offset of the result in its array
 */
public void remainder(final double[] lhs, final int lhsOffset,
                      final double[] rhs, final int rhsOffset,
                      final double[] result, final int resultOffset) {

    // compute k such that lhs % rhs = lhs - k rhs
    final double rem = FastMath.IEEEremainder(lhs[lhsOffset], rhs[rhsOffset]);
    final double k   = FastMath.rint((lhs[lhsOffset] - rem) / rhs[rhsOffset]);

    // set up value
    result[resultOffset] = rem;

    // set up partial derivatives
    for (int i = 1; i < getSize(); ++i) {
        result[resultOffset + i] = lhs[lhsOffset + i] - k * rhs[rhsOffset + i];
    }

}
 
开发者ID:biocompibens,项目名称:SME,代码行数:27,代码来源:DSCompiler.java

示例2: index

import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
@Override
protected double index(final double p, final int length) {
    final double minLimit = 1d/2 / length;
    return Double.compare(p, minLimit) <= 0 ?
            0 : FastMath.rint(length * p);
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:7,代码来源:Percentile.java

示例3: value

import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
/** {@inheritDoc} */
public double value(double x) {
    return FastMath.rint(x);
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:5,代码来源:Rint.java

示例4: rint

import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
/** {@inheritDoc}
 * @since 3.2
 */
public DerivativeStructure rint() {
    return new DerivativeStructure(compiler.getFreeParameters(),
                                   compiler.getOrder(),
                                   FastMath.rint(data[0]));
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:9,代码来源:DerivativeStructure.java

示例5: exponentialDecay

import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
/**
 * Creates an exponential decay {@link NeighbourhoodSizeFunction function}.
 * It will compute <code>a e<sup>-x / b</sup></code>,
 * where {@code x} is the (integer) independent variable and
 * <ul>
 *  <li><code>a = initValue</code>
 *  <li><code>b = -numCall / ln(valueAtNumCall / initValue)</code>
 * </ul>
 *
 * @param initValue Initial value, i.e.
 * {@link NeighbourhoodSizeFunction#value(long) value(0)}.
 * @param valueAtNumCall Value of the function at {@code numCall}.
 * @param numCall Argument for which the function returns
 * {@code valueAtNumCall}.
 * @return the neighbourhood size function.
 * @throws org.apache.commons.math3.exception.NotStrictlyPositiveException
 * if {@code initValue <= 0}.
 * @throws org.apache.commons.math3.exception.NotStrictlyPositiveException
 * if {@code valueAtNumCall <= 0}.
 * @throws org.apache.commons.math3.exception.NumberIsTooLargeException
 * if {@code valueAtNumCall >= initValue}.
 * @throws org.apache.commons.math3.exception.NotStrictlyPositiveException
 * if {@code numCall <= 0}.
 */
public static NeighbourhoodSizeFunction exponentialDecay(final double initValue,
                                                         final double valueAtNumCall,
                                                         final long numCall) {
    return new NeighbourhoodSizeFunction() {
        /** DecayFunction. */
        private final ExponentialDecayFunction decay
            = new ExponentialDecayFunction(initValue, valueAtNumCall, numCall);

        /** {@inheritDoc} */
        public int value(long n) {
            return (int) FastMath.rint(decay.value(n));
        }
    };
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:39,代码来源:NeighbourhoodSizeFunctionFactory.java

示例6: quasiSigmoidDecay

import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
/**
 * Creates an sigmoid-like {@code NeighbourhoodSizeFunction function}.
 * The function {@code f} will have the following properties:
 * <ul>
 *  <li>{@code f(0) = initValue}</li>
 *  <li>{@code numCall} is the inflexion point</li>
 *  <li>{@code slope = f'(numCall)}</li>
 * </ul>
 *
 * @param initValue Initial value, i.e.
 * {@link NeighbourhoodSizeFunction#value(long) value(0)}.
 * @param slope Value of the function derivative at {@code numCall}.
 * @param numCall Inflexion point.
 * @return the neighbourhood size function.
 * @throws org.apache.commons.math3.exception.NotStrictlyPositiveException
 * if {@code initValue <= 0}.
 * @throws org.apache.commons.math3.exception.NumberIsTooLargeException
 * if {@code slope >= 0}.
 * @throws org.apache.commons.math3.exception.NotStrictlyPositiveException
 * if {@code numCall <= 0}.
 */
public static NeighbourhoodSizeFunction quasiSigmoidDecay(final double initValue,
                                                          final double slope,
                                                          final long numCall) {
    return new NeighbourhoodSizeFunction() {
        /** DecayFunction. */
        private final QuasiSigmoidDecayFunction decay
            = new QuasiSigmoidDecayFunction(initValue, slope, numCall);

        /** {@inheritDoc} */
        public int value(long n) {
            return (int) FastMath.rint(decay.value(n));
        }
    };
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:36,代码来源:NeighbourhoodSizeFunctionFactory.java

示例7: remainder

import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
/** {@inheritDoc} */
public SparseGradient remainder(final SparseGradient a) {

    // compute k such that lhs % rhs = lhs - k rhs
    final double rem = FastMath.IEEEremainder(value, a.value);
    final double k   = FastMath.rint((value - rem) / a.value);

    return subtract(a.multiply(k));

}
 
开发者ID:biocompibens,项目名称:SME,代码行数:11,代码来源:SparseGradient.java


注:本文中的org.apache.commons.math3.util.FastMath.rint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。