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


Java MathUtils.checkNotNull方法代码示例

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


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

示例1: load

import org.apache.commons.math.util.MathUtils; //导入方法依赖的package包/类
/**
 * Computes the empirical distribution from the input file.
 *
 * @param file the input file
 * @throws IOException if an IO error occurs
 * @throws NullArgumentException if file is null
 */
public void load(File file) throws IOException, NullArgumentException {
    MathUtils.checkNotNull(file);
    BufferedReader in = new BufferedReader(new FileReader(file));
    try {
        DataAdapter da = new StreamDataAdapter(in);
        da.computeStats();
        in = new BufferedReader(new FileReader(file));
        fillBinStats(in);
        loaded = true;
    } finally {
        try {
            in.close();
        } catch (IOException ex) {
            // ignore
        }
    }
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:25,代码来源:EmpiricalDistributionImpl.java

示例2: copy

import org.apache.commons.math.util.MathUtils; //导入方法依赖的package包/类
/**
 * Copies source to dest.
 * <p>Neither source nor dest can be null.</p>
 *
 * @param source DescriptiveStatistics to copy
 * @param dest DescriptiveStatistics to copy to
 * @throws NullArgumentException if either source or dest is null
 */
public static void copy(DescriptiveStatistics source, DescriptiveStatistics dest)
    throws NullArgumentException {
    MathUtils.checkNotNull(source);
    MathUtils.checkNotNull(dest);
    // Copy data and window size
    dest.eDA = source.eDA.copy();
    dest.windowSize = source.windowSize;

    // Copy implementations
    dest.maxImpl = source.maxImpl.copy();
    dest.meanImpl = source.meanImpl.copy();
    dest.minImpl = source.minImpl.copy();
    dest.sumImpl = source.sumImpl.copy();
    dest.varianceImpl = source.varianceImpl.copy();
    dest.sumsqImpl = source.sumsqImpl.copy();
    dest.geometricMeanImpl = source.geometricMeanImpl.copy();
    dest.kurtosisImpl = source.kurtosisImpl;
    dest.skewnessImpl = source.skewnessImpl;
    dest.percentileImpl = source.percentileImpl;
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:29,代码来源:DescriptiveStatistics.java

示例3: setup

import org.apache.commons.math.util.MathUtils; //导入方法依赖的package包/类
/**
 * Prepare for computation.
 * Subclasses must call this method if they override any of the
 * {@code solve} methods.
 *
 * @param f Function to solve.
 * @param min Lower bound for the interval.
 * @param max Upper bound for the interval.
 * @param startValue Start value to use.
 * @param maxEval Maximum number of evaluations.
 */
protected void setup(int maxEval,
                     FUNC f,
                     double min, double max,
                     double startValue) {
    // Checks.
    MathUtils.checkNotNull(f);

    // Reset.
    searchMin = min;
    searchMax = max;
    searchStart = startValue;
    function = f;
    evaluations.setMaximalCount(maxEval);
    evaluations.resetCount();
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:27,代码来源:BaseAbstractUnivariateRealSolver.java

示例4: differentiate

import org.apache.commons.math.util.MathUtils; //导入方法依赖的package包/类
/**
 * Returns the coefficients of the derivative of the polynomial with the given coefficients.
 *
 * @param coefficients Coefficients of the polynomial to differentiate.
 * @return the coefficients of the derivative or {@code null} if coefficients has length 1.
 * @throws NoDataException if {@code coefficients} is empty.
 * @throws NullArgumentException if {@code coefficients} is {@code null}.
 */
protected static double[] differentiate(double[] coefficients)
    throws NullArgumentException, NoDataException {
    MathUtils.checkNotNull(coefficients);
    int n = coefficients.length;
    if (n == 0) {
        throw new NoDataException(LocalizedFormats.EMPTY_POLYNOMIALS_COEFFICIENTS_ARRAY);
    }
    if (n == 1) {
        return new double[]{0};
    }
    double[] result = new double[n - 1];
    for (int i = n - 1; i > 0; i--) {
        result[i - 1] = i * coefficients[i];
    }
    return result;
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:25,代码来源:PolynomialFunction.java

示例5: checkRectangular

import org.apache.commons.math.util.MathUtils; //导入方法依赖的package包/类
/**
 * Throws MathIllegalArgumentException if the input array is not rectangular.
 *
 * @param in array to be tested
 * @throws NullArgumentException if input array is null
 * @throws MathIllegalArgumentException if input array is not rectangular
 */
private void checkRectangular(long[][] in)
    throws NullArgumentException {
    MathUtils.checkNotNull(in);
    for (int i = 1; i < in.length; i++) {
        if (in[i].length != in[0].length) {
            throw new DimensionMismatchException(LocalizedFormats.DIFFERENT_ROWS_LENGTHS,
                                                 in[i].length, in[0].length);
        }
    }
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:18,代码来源:ChiSquareTestImpl.java

示例6: copy

import org.apache.commons.math.util.MathUtils; //导入方法依赖的package包/类
/**
 * Copies source to dest.
 * <p>Neither source nor dest can be null.</p>
 *
 * @param source Variance to copy
 * @param dest Variance to copy to
 * @throws NullArgumentException if either source or dest is null
 */
public static void copy(Variance source, Variance dest)
    throws NullArgumentException {
    MathUtils.checkNotNull(source);
    MathUtils.checkNotNull(dest);
    dest.setData(source.getDataRef());
    dest.moment = source.moment.copy();
    dest.isBiasCorrected = source.isBiasCorrected;
    dest.incMoment = source.incMoment;
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:18,代码来源:Variance.java

示例7: copy

import org.apache.commons.math.util.MathUtils; //导入方法依赖的package包/类
/**
 * Copies source to dest.
 * <p>Neither source nor dest can be null.</p>
 *
 * @param source ThirdMoment to copy
 * @param dest ThirdMoment to copy to
 * @throws NullArgumentException if either source or dest is null
 */
public static void copy(ThirdMoment source, ThirdMoment dest)
    throws NullArgumentException {
    MathUtils.checkNotNull(source);
    MathUtils.checkNotNull(dest);
    SecondMoment.copy(source, dest);
    dest.m3 = source.m3;
    dest.nDevSq = source.nDevSq;
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:17,代码来源:ThirdMoment.java

示例8: copy

import org.apache.commons.math.util.MathUtils; //导入方法依赖的package包/类
/**
 * Copies source to dest.
 * <p>Neither source nor dest can be null.</p>
 *
 * @param source Mean to copy
 * @param dest Mean to copy to
 * @throws NullArgumentException if either source or dest is null
 */
public static void copy(Mean source, Mean dest)
    throws NullArgumentException {
    MathUtils.checkNotNull(source);
    MathUtils.checkNotNull(dest);
    dest.setData(source.getDataRef());
    dest.incMoment = source.incMoment;
    dest.moment = source.moment.copy();
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:17,代码来源:Mean.java

示例9: copy

import org.apache.commons.math.util.MathUtils; //导入方法依赖的package包/类
/**
 * Copies source to dest.
 * <p>Neither source nor dest can be null.</p>
 *
 * @param source Kurtosis to copy
 * @param dest Kurtosis to copy to
 * @throws NullArgumentException if either source or dest is null
 */
public static void copy(Kurtosis source, Kurtosis dest)
    throws NullArgumentException {
    MathUtils.checkNotNull(source);
    MathUtils.checkNotNull(dest);
    dest.setData(source.getDataRef());
    dest.moment = source.moment.copy();
    dest.incMoment = source.incMoment;
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:17,代码来源:Kurtosis.java

示例10: copy

import org.apache.commons.math.util.MathUtils; //导入方法依赖的package包/类
/**
 * Copies source to dest.
 * <p>Neither source nor dest can be null.</p>
 *
 * @param source Skewness to copy
 * @param dest Skewness to copy to
 * @throws NullArgumentException if either source or dest is null
 */
public static void copy(Skewness source, Skewness dest)
    throws NullArgumentException {
    MathUtils.checkNotNull(source);
    MathUtils.checkNotNull(dest);
    dest.setData(source.getDataRef());
    dest.moment = new ThirdMoment(source.moment.copy());
    dest.incMoment = source.incMoment;
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:17,代码来源:Skewness.java

示例11: copy

import org.apache.commons.math.util.MathUtils; //导入方法依赖的package包/类
/**
 * Copies source to dest.
 * <p>Neither source nor dest can be null.</p>
 *
 * @param source FirstMoment to copy
 * @param dest FirstMoment to copy to
 * @throws NullArgumentException if either source or dest is null
 */
public static void copy(FirstMoment source, FirstMoment dest)
    throws NullArgumentException {
    MathUtils.checkNotNull(source);
    MathUtils.checkNotNull(dest);
    dest.setData(source.getDataRef());
    dest.n = source.n;
    dest.m1 = source.m1;
    dest.dev = source.dev;
    dest.nDev = source.nDev;
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:19,代码来源:FirstMoment.java

示例12: copy

import org.apache.commons.math.util.MathUtils; //导入方法依赖的package包/类
/**
 * Copies source to dest.
 * <p>Neither source nor dest can be null.</p>
 * <p>Acquires synchronization lock on source, then dest before copying.</p>
 *
 * @param source SynchronizedSummaryStatistics to copy
 * @param dest SynchronizedSummaryStatistics to copy to
 * @throws NullArgumentException if either source or dest is null
 */
public static void copy(SynchronizedSummaryStatistics source,
                        SynchronizedSummaryStatistics dest)
    throws NullArgumentException {
    MathUtils.checkNotNull(source);
    MathUtils.checkNotNull(dest);
    synchronized (source) {
        synchronized (dest) {
            SummaryStatistics.copy(source, dest);
        }
    }
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:21,代码来源:SynchronizedSummaryStatistics.java

示例13: copy

import org.apache.commons.math.util.MathUtils; //导入方法依赖的package包/类
/**
 * Copies source to dest.
 * <p>Neither source nor dest can be null.</p>
 * <p>Acquires synchronization lock on source, then dest before copying.</p>
 *
 * @param source SynchronizedDescriptiveStatistics to copy
 * @param dest SynchronizedDescriptiveStatistics to copy to
 * @throws NullArgumentException if either source or dest is null
 */
public static void copy(SynchronizedDescriptiveStatistics source,
                        SynchronizedDescriptiveStatistics dest)
    throws NullArgumentException {
    MathUtils.checkNotNull(source);
    MathUtils.checkNotNull(dest);
    synchronized (source) {
        synchronized (dest) {
            DescriptiveStatistics.copy(source, dest);
        }
    }
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:21,代码来源:SynchronizedDescriptiveStatistics.java

示例14: correct

import org.apache.commons.math.util.MathUtils; //导入方法依赖的package包/类
/**
 * Correct the current state estimate with an actual measurement.
 *
 * @param z
 *            the measurement vector
 * @throws DimensionMismatchException
 *             if the dimension of the measurement vector does not fit
 * @throws org.apache.commons.math.linear.SingularMatrixException
 *             if the covariance matrix could not be inverted
 */
public void correct(final RealVector z) {
    // sanity checks
    MathUtils.checkNotNull(z);
    if (z.getDimension() != measurementMatrix.getRowDimension()) {
        throw new DimensionMismatchException(z.getDimension(),
                                             measurementMatrix.getRowDimension());
    }

    // S = H * P(k) - * H' + R
    RealMatrix s = measurementMatrix.multiply(errorCovariance)
        .multiply(measurementMatrixT)
        .add(measurementModel.getMeasurementNoise());

    // invert S
    // as the error covariance matrix is a symmetric positive
    // semi-definite matrix, we can use the cholesky decomposition
    DecompositionSolver solver = new CholeskyDecompositionImpl(s).getSolver();
    RealMatrix invertedS = solver.getInverse();

    // Inn = z(k) - H * xHat(k)-
    RealVector innovation = z.subtract(measurementMatrix.operate(stateEstimation));

    // calculate gain matrix
    // K(k) = P(k)- * H' * (H * P(k)- * H' + R)^-1
    // K(k) = P(k)- * H' * S^-1
    RealMatrix kalmanGain = errorCovariance.multiply(measurementMatrixT).multiply(invertedS);

    // update estimate with measurement z(k)
    // xHat(k) = xHat(k)- + K * Inn
    stateEstimation = stateEstimation.add(kalmanGain.operate(innovation));

    // update covariance of prediction error
    // P(k) = (I - K * H) * P(k)-
    RealMatrix identity = MatrixUtils.createRealIdentityMatrix(kalmanGain.getRowDimension());
    errorCovariance = identity.subtract(kalmanGain.multiply(measurementMatrix)).multiply(errorCovariance);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:47,代码来源:KalmanFilter.java

示例15: copy

import org.apache.commons.math.util.MathUtils; //导入方法依赖的package包/类
/**
 * Copies source to dest.
 * <p>Neither source nor dest can be null.</p>
 *
 * @param source SumOfLogs to copy
 * @param dest SumOfLogs to copy to
 * @throws NullArgumentException if either source or dest is null
 */
public static void copy(SumOfLogs source, SumOfLogs dest)
    throws NullArgumentException {
    MathUtils.checkNotNull(source);
    MathUtils.checkNotNull(dest);
    dest.setData(source.getDataRef());
    dest.n = source.n;
    dest.value = source.value;
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:17,代码来源:SumOfLogs.java


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