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


Java LocalizedFormats.NOT_POSITIVE_NUMBER_OF_SAMPLES属性代码示例

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


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

示例1: sample

/**
 * Samples the specified univariate real function on the specified interval.
 * <p>
 * The interval is divided equally into {@code n} sections and sample points
 * are taken from {@code min} to {@code max - (max - min) / n}; therefore
 * {@code f} is not sampled at the upper bound {@code max}.</p>
 *
 * @param f Function to be sampled
 * @param min Lower bound of the interval (included).
 * @param max Upper bound of the interval (excluded).
 * @param n Number of sample points.
 * @return the array of samples.
 * @throws NumberIsTooLargeException if the lower bound {@code min} is
 * greater than, or equal to the upper bound {@code max}.
 * @throws NotStrictlyPositiveException if the number of sample points
 * {@code n} is negative.
 */
public static double[] sample(UnivariateFunction f, double min, double max, int n)
   throws NumberIsTooLargeException, NotStrictlyPositiveException {

    if (n <= 0) {
        throw new NotStrictlyPositiveException(
                LocalizedFormats.NOT_POSITIVE_NUMBER_OF_SAMPLES,
                Integer.valueOf(n));
    }
    if (min >= max) {
        throw new NumberIsTooLargeException(min, max, false);
    }

    final double[] s = new double[n];
    final double h = (max - min) / n;
    for (int i = 0; i < n; i++) {
        s[i] = f.value(min + i * h);
    }
    return s;
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:36,代码来源:FunctionUtils.java

示例2: KolmogorovSmirnovDistribution

/**
 * @param n Number of observations
 * @throws NotStrictlyPositiveException if {@code n <= 0}
 */
public KolmogorovSmirnovDistribution(int n)
    throws NotStrictlyPositiveException {
    if (n <= 0) {
        throw new NotStrictlyPositiveException(LocalizedFormats.NOT_POSITIVE_NUMBER_OF_SAMPLES, n);
    }

    this.n = n;
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:12,代码来源:KolmogorovSmirnovDistribution.java

示例3: sample

/**
 * <p>
 * Samples the specified univariate real function on the specified interval.
 * </p>
 * <p>
 * The interval is divided equally into {@code n} sections and sample points
 * are taken from {@code min} to {@code max - (max - min) / n}; therefore
 * {@code f} is not sampled at the upper bound {@code max}.
 * </p>
 *
 * @param f the function to be sampled
 * @param min the (inclusive) lower bound of the interval
 * @param max the (exclusive) upper bound of the interval
 * @param n the number of sample points
 * @return the array of samples
 * @throws NumberIsTooLargeException if the lower bound {@code min} is
 * greater than, or equal to the upper bound {@code max}
 * @throws NotStrictlyPositiveException if the number of sample points
 * {@code n} is negative
 */
public static double[] sample(UnivariateFunction f,
        double min, double max, int n) {

    if (n <= 0) {
        throw new NotStrictlyPositiveException(
                LocalizedFormats.NOT_POSITIVE_NUMBER_OF_SAMPLES,
                Integer.valueOf(n));
    }
    if (min >= max) {
        throw new NumberIsTooLargeException(min, max, false);
    }

    double[] s = new double[n];
    double h = (max - min) / n;
    for (int i = 0; i < n; i++) {
        s[i] = f.value(min + i * h);
    }
    return s;
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:39,代码来源:FunctionUtils.java


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