Example usage for org.apache.commons.math.exception.util LocalizedFormats ARRAY_SIZES_SHOULD_HAVE_DIFFERENCE_1

List of usage examples for org.apache.commons.math.exception.util LocalizedFormats ARRAY_SIZES_SHOULD_HAVE_DIFFERENCE_1

Introduction

In this page you can find the example usage for org.apache.commons.math.exception.util LocalizedFormats ARRAY_SIZES_SHOULD_HAVE_DIFFERENCE_1.

Prototype

LocalizedFormats ARRAY_SIZES_SHOULD_HAVE_DIFFERENCE_1

To view the source code for org.apache.commons.math.exception.util LocalizedFormats ARRAY_SIZES_SHOULD_HAVE_DIFFERENCE_1.

Click Source Link

Usage

From source file:uk.ac.leeds.ccg.andyt.projects.fluvialglacial.PolynomialFunctionNewtonForm.java

/**
 * Verifies that the input arrays are valid. 
 * <p> //from  w  w  w .  j  a v  a2  s  .  c  o m
 * The centers must be distinct for interpolation purposes, but not 
 * for general use. Thus it is not verified here.</p> 
 * 
 * @param a the coefficients in Newton form formula 
 * @param c the centers 
 * @throws IllegalArgumentException if not valid 
 * @see org.apache.commons.math.analysis.interpolation.DividedDifferenceInterpolator#computeDividedDifference(double[], 
 * double[]) 
 */
protected static void verifyInputArray(double a[], double c[]) throws IllegalArgumentException {

    if (a.length < 1 || c.length < 1) {
        throw MathRuntimeException
                .createIllegalArgumentException(LocalizedFormats.EMPTY_POLYNOMIALS_COEFFICIENTS_ARRAY);
    }
    if (a.length != c.length + 1) {
        throw MathRuntimeException.createIllegalArgumentException(
                LocalizedFormats.ARRAY_SIZES_SHOULD_HAVE_DIFFERENCE_1, a.length, c.length);
    }
}