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


Java FastMath.ulp方法代码示例

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


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

示例1: sanityChecks

import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
/** Check the integration span.
 * @param eqn set of differential equations
 * @param t target time for the integration
 * @exception NumberIsTooSmallException if integration span is too small
 * @exception DimensionMismatchException if adaptive step size integrators
 * tolerance arrays dimensions are not compatible with equations settings
 */
protected void sanityChecks(final FieldODEState<T> eqn, final T t)
    throws NumberIsTooSmallException, DimensionMismatchException {

    final double threshold = 1000 * FastMath.ulp(FastMath.max(FastMath.abs(eqn.getTime().getReal()),
                                                              FastMath.abs(t.getReal())));
    final double dt = eqn.getTime().subtract(t).abs().getReal();
    if (dt <= threshold) {
        throw new NumberIsTooSmallException(LocalizedFormats.TOO_SMALL_INTEGRATION_INTERVAL,
                                            dt, threshold, false);
    }

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

示例2: sanityChecks

import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
/** Check the integration span.
 * @param equations set of differential equations
 * @param t target time for the integration
 * @exception NumberIsTooSmallException if integration span is too small
 * @exception DimensionMismatchException if adaptive step size integrators
 * tolerance arrays dimensions are not compatible with equations settings
 */
protected void sanityChecks(final ExpandableStatefulODE equations, final double t)
    throws NumberIsTooSmallException, DimensionMismatchException {

    final double threshold = 1000 * FastMath.ulp(FastMath.max(FastMath.abs(equations.getTime()),
                                                              FastMath.abs(t)));
    final double dt = FastMath.abs(equations.getTime() - t);
    if (dt <= threshold) {
        throw new NumberIsTooSmallException(LocalizedFormats.TOO_SMALL_INTEGRATION_INTERVAL,
                                            dt, threshold, false);
    }

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

示例3: value

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

示例4: FiniteDifferencesDifferentiator

import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
/**
 * Build a differentiator with number of points and step size when independent variable is bounded.
 * <p>
 * When the independent variable is bounded (tLower &lt; t &lt; tUpper), the sampling
 * points used for differentiation will be adapted to ensure the constraint holds
 * even near the boundaries. This means the sample will not be centered anymore in
 * these cases. At an extreme case, computing derivatives exactly at the lower bound
 * will lead the sample to be entirely on the right side of the derivation point.
 * </p>
 * <p>
 * Note that the boundaries are considered to be excluded for function evaluation.
 * </p>
 * <p>
 * Beware that wrong settings for the finite differences differentiator
 * can lead to highly unstable and inaccurate results, especially for
 * high derivation orders. Using very small step sizes is often a
 * <em>bad</em> idea.
 * </p>
 * @param nbPoints number of points to use
 * @param stepSize step size (gap between each point)
 * @param tLower lower bound for independent variable (may be {@code Double.NEGATIVE_INFINITY}
 * if there are no lower bounds)
 * @param tUpper upper bound for independent variable (may be {@code Double.POSITIVE_INFINITY}
 * if there are no upper bounds)
 * @exception NotPositiveException if {@code stepsize <= 0} (note that
 * {@link NotPositiveException} extends {@link NumberIsTooSmallException})
 * @exception NumberIsTooSmallException {@code nbPoint <= 1}
 * @exception NumberIsTooLargeException {@code stepSize * (nbPoints - 1) >= tUpper - tLower}
 */
public FiniteDifferencesDifferentiator(final int nbPoints, final double stepSize,
                                       final double tLower, final double tUpper)
        throws NotPositiveException, NumberIsTooSmallException, NumberIsTooLargeException {

    if (nbPoints <= 1) {
        throw new NumberIsTooSmallException(stepSize, 1, false);
    }
    this.nbPoints = nbPoints;

    if (stepSize <= 0) {
        throw new NotPositiveException(stepSize);
    }
    this.stepSize = stepSize;

    halfSampleSpan = 0.5 * stepSize * (nbPoints - 1);
    if (2 * halfSampleSpan >= tUpper - tLower) {
        throw new NumberIsTooLargeException(2 * halfSampleSpan, tUpper - tLower, false);
    }
    final double safety = FastMath.ulp(halfSampleSpan);
    this.tMin = tLower + halfSampleSpan + safety;
    this.tMax = tUpper - halfSampleSpan - safety;

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


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