Package org.apache.commons.math3.exception

Examples of org.apache.commons.math3.exception.NoDataException


        throws NoDataException, OutOfRangeException,
        DimensionMismatchException, NullArgumentException {
        MathUtils.checkNotNull(subMatrix);
        final int nRows = subMatrix.length;
        if (nRows == 0) {
            throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
        }

        final int nCols = subMatrix[0].length;
        if (nCols == 0) {
            throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
        }

        for (int r = 1; r < nRows; ++r) {
            if (subMatrix[r].length != nCols) {
                throw new DimensionMismatchException(nCols, subMatrix[r].length);
View Full Code Here


     * @throws ModelSpecificationException if the model is not correctly specified
     */
    public RegressionResults regress() throws ModelSpecificationException{
        if( hasIntercept ){
          if( n < 3 ){
              throw new NoDataException( LocalizedFormats.NOT_ENOUGH_DATA_REGRESSION );
          }
          if( FastMath.abs( sumXX ) > Precision.SAFE_MIN ){
              final double[] params = new double[]{ getIntercept(), getSlope() };
              final double mse = getMeanSquareError();
              final double _syy = sumYY + sumY * sumY / n;
              final double[] vcv = new double[]{
                mse * (xbar *xbar /sumXX + 1.0 / n),
                -xbar*mse/sumXX,
                mse/sumXX };
              return new RegressionResults(
                      params, new double[][]{vcv}, true, n, 2,
                      sumY, _syy, getSumSquaredErrors(),true,false);
          }else{
              final double[] params = new double[]{ sumY / n, Double.NaN };
              //final double mse = getMeanSquareError();
              final double[] vcv = new double[]{
                ybar / (n - 1.0),
                Double.NaN,
                Double.NaN };
              return new RegressionResults(
                      params, new double[][]{vcv}, true, n, 1,
                      sumY, sumYY, getSumSquaredErrors(),true,false);
          }
        }else{
          if( n < 2 ){
              throw new NoDataException( LocalizedFormats.NOT_ENOUGH_DATA_REGRESSION );
          }
          if( !Double.isNaN(sumXX) ){
          final double[] vcv = new double[]{ getMeanSquareError() / sumXX };
          final double[] params = new double[]{ sumXY/sumXX };
          return new RegressionResults(
View Full Code Here

    @Override
    public BicubicSplineInterpolatingFunction interpolate(final double[] xval,
                                                          final double[] yval,
                                                          final double[][] fval) {
        if (xval.length == 0 || yval.length == 0 || fval.length == 0) {
            throw new NoDataException();
        }
        if (xval.length != fval.length) {
            throw new DimensionMismatchException(xval.length, fval.length);
        }
View Full Code Here

            if (coefficients == null) {
                throw new NullArgumentException();
            }
            int n = coefficients.length - 1;
            if (n == 0) {
                throw new NoDataException(LocalizedFormats.POLYNOMIAL);
            }
            // Coefficients for deflated polynomial.
            Complex c[] = new Complex[n + 1];
            for (int i = 0; i <= n; i++) {
                c[i] = coefficients[i];
View Full Code Here

                throw new NullArgumentException();
            }

            int n = coefficients.length - 1;
            if (n == 0) {
                throw new NoDataException(LocalizedFormats.POLYNOMIAL);
            }

            final double absoluteAccuracy = getAbsoluteAccuracy();
            final double relativeAccuracy = getRelativeAccuracy();
            final double functionValueAccuracy = getFunctionValueAccuracy();
View Full Code Here

        final int xLen = x.length;
        final int yLen = y.length;
        final int zLen = z.length;

        if (xLen == 0 || yLen == 0 || z.length == 0 || f.length == 0 || f[0].length == 0) {
            throw new NoDataException();
        }
        if (xLen != f.length) {
            throw new DimensionMismatchException(xLen, f.length);
        }
        if (xLen != dFdX.length) {
View Full Code Here

     * double[])
     */
    protected static void verifyInputArray(double a[], double c[]) {
        if (a.length == 0 ||
            c.length == 0) {
            throw new NoDataException(LocalizedFormats.EMPTY_POLYNOMIALS_COEFFICIENTS_ARRAY);
        }
        if (a.length != c.length + 1) {
            throw new DimensionMismatchException(LocalizedFormats.ARRAY_SIZES_SHOULD_HAVE_DIFFERENCE_1,
                                                 a.length, c.length);
        }
View Full Code Here

        throws DimensionMismatchException {
        final int xLen = x.length;
        final int yLen = y.length;

        if (xLen == 0 || yLen == 0 || f.length == 0 || f[0].length == 0) {
            throw new NoDataException();
        }
        if (xLen != f.length) {
            throw new DimensionMismatchException(xLen, f.length);
        }
        if (xLen != dFdX.length) {
View Full Code Here

        throws NullArgumentException, NoDataException {
        super();
        MathUtils.checkNotNull(c);
        int n = c.length;
        if (n == 0) {
            throw new NoDataException(LocalizedFormats.EMPTY_POLYNOMIALS_COEFFICIENTS_ARRAY);
        }
        while ((n > 1) && (c[n - 1] == 0)) {
            --n;
        }
        this.coefficients = new double[n];
View Full Code Here

    protected static double evaluate(double[] coefficients, double argument)
        throws NullArgumentException, NoDataException {
        MathUtils.checkNotNull(coefficients);
        int n = coefficients.length;
        if (n == 0) {
            throw new NoDataException(LocalizedFormats.EMPTY_POLYNOMIALS_COEFFICIENTS_ARRAY);
        }
        double result = coefficients[n - 1];
        for (int j = n - 2; j >= 0; j--) {
            result = argument * result + coefficients[j];
        }
View Full Code Here

TOP

Related Classes of org.apache.commons.math3.exception.NoDataException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.