Java Code Examples for org.apache.commons.math3.exception.util.LocalizedFormats#WRONG_NUMBER_OF_POINTS

The following examples show how to use org.apache.commons.math3.exception.util.LocalizedFormats#WRONG_NUMBER_OF_POINTS . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PolynomialFunctionLagrangeForm.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Check that the interpolation arrays are valid.
 * The arrays features checked by this method are that both arrays have the
 * same length and this length is at least 2.
 *
 * @param x Interpolating points array.
 * @param y Interpolating values array.
 * @param abort Whether to throw an exception if {@code x} is not sorted.
 * @throws DimensionMismatchException if the array lengths are different.
 * @throws NumberIsTooSmallException if the number of points is less than 2.
 * @throws org.apache.commons.math3.exception.NonMonotonicSequenceException
 * if {@code x} is not sorted in strictly increasing order and {@code abort}
 * is {@code true}.
 * @return {@code false} if the {@code x} is not sorted in increasing order,
 * {@code true} otherwise.
 * @see #evaluate(double[], double[], double)
 * @see #computeCoefficients()
 */
public static boolean verifyInterpolationArray(double x[], double y[], boolean abort)
    throws DimensionMismatchException, NumberIsTooSmallException, NonMonotonicSequenceException {
    if (x.length != y.length) {
        throw new DimensionMismatchException(x.length, y.length);
    }
    if (x.length < 2) {
        throw new NumberIsTooSmallException(LocalizedFormats.WRONG_NUMBER_OF_POINTS, 2, x.length, true);
    }

    return MathArrays.checkOrder(x, MathArrays.OrderDirection.INCREASING, true, abort);
}
 
Example 2
Source File: PolynomialFunctionLagrangeForm.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Check that the interpolation arrays are valid.
 * The arrays features checked by this method are that both arrays have the
 * same length and this length is at least 2.
 *
 * @param x Interpolating points array.
 * @param y Interpolating values array.
 * @param abort Whether to throw an exception if {@code x} is not sorted.
 * @throws DimensionMismatchException if the array lengths are different.
 * @throws NumberIsTooSmallException if the number of points is less than 2.
 * @throws org.apache.commons.math3.exception.NonMonotonicSequenceException
 * if {@code x} is not sorted in strictly increasing order and {@code abort}
 * is {@code true}.
 * @return {@code false} if the {@code x} is not sorted in increasing order,
 * {@code true} otherwise.
 * @see #evaluate(double[], double[], double)
 * @see #computeCoefficients()
 */
public static boolean verifyInterpolationArray(double x[], double y[], boolean abort) {
    if (x.length != y.length) {
        throw new DimensionMismatchException(x.length, y.length);
    }
    if (x.length < 2) {
        throw new NumberIsTooSmallException(LocalizedFormats.WRONG_NUMBER_OF_POINTS, 2, x.length, true);
    }

    return MathArrays.checkOrder(x, MathArrays.OrderDirection.INCREASING, true, abort);
}
 
Example 3
Source File: PolynomialFunctionLagrangeForm.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Check that the interpolation arrays are valid.
 * The arrays features checked by this method are that both arrays have the
 * same length and this length is at least 2.
 *
 * @param x Interpolating points array.
 * @param y Interpolating values array.
 * @param abort Whether to throw an exception if {@code x} is not sorted.
 * @throws DimensionMismatchException if the array lengths are different.
 * @throws NumberIsTooSmallException if the number of points is less than 2.
 * @throws org.apache.commons.math3.exception.NonMonotonicSequenceException
 * if {@code x} is not sorted in strictly increasing order and {@code abort}
 * is {@code true}.
 * @return {@code false} if the {@code x} is not sorted in increasing order,
 * {@code true} otherwise.
 * @see #evaluate(double[], double[], double)
 * @see #computeCoefficients()
 */
public static boolean verifyInterpolationArray(double x[], double y[], boolean abort) {
    if (x.length != y.length) {
        throw new DimensionMismatchException(x.length, y.length);
    }
    if (x.length < 2) {
        throw new NumberIsTooSmallException(LocalizedFormats.WRONG_NUMBER_OF_POINTS, 2, x.length, true);
    }

    return MathArrays.checkOrder(x, MathArrays.OrderDirection.INCREASING, true, abort);
}
 
Example 4
Source File: PolynomialFunctionLagrangeForm.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Check that the interpolation arrays are valid.
 * The arrays features checked by this method are that both arrays have the
 * same length and this length is at least 2.
 *
 * @param x Interpolating points array.
 * @param y Interpolating values array.
 * @param abort Whether to throw an exception if {@code x} is not sorted.
 * @throws DimensionMismatchException if the array lengths are different.
 * @throws NumberIsTooSmallException if the number of points is less than 2.
 * @throws org.apache.commons.math3.exception.NonMonotonicSequenceException
 * if {@code x} is not sorted in strictly increasing order and {@code abort}
 * is {@code true}.
 * @return {@code false} if the {@code x} is not sorted in increasing order,
 * {@code true} otherwise.
 * @see #evaluate(double[], double[], double)
 * @see #computeCoefficients()
 */
public static boolean verifyInterpolationArray(double x[], double y[], boolean abort)
    throws DimensionMismatchException, NumberIsTooSmallException, NonMonotonicSequenceException {
    if (x.length != y.length) {
        throw new DimensionMismatchException(x.length, y.length);
    }
    if (x.length < 2) {
        throw new NumberIsTooSmallException(LocalizedFormats.WRONG_NUMBER_OF_POINTS, 2, x.length, true);
    }

    return MathArrays.checkOrder(x, MathArrays.OrderDirection.INCREASING, true, abort);
}
 
Example 5
Source File: PolynomialFunctionLagrangeForm.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Check that the interpolation arrays are valid.
 * The arrays features checked by this method are that both arrays have the
 * same length and this length is at least 2.
 *
 * @param x Interpolating points array.
 * @param y Interpolating values array.
 * @param abort Whether to throw an exception if {@code x} is not sorted.
 * @throws DimensionMismatchException if the array lengths are different.
 * @throws NumberIsTooSmallException if the number of points is less than 2.
 * @throws org.apache.commons.math3.exception.NonMonotonicSequenceException
 * if {@code x} is not sorted in strictly increasing order and {@code abort}
 * is {@code true}.
 * @return {@code false} if the {@code x} is not sorted in increasing order,
 * {@code true} otherwise.
 * @see #evaluate(double[], double[], double)
 * @see #computeCoefficients()
 */
public static boolean verifyInterpolationArray(double x[], double y[], boolean abort) {
    if (x.length != y.length) {
        throw new DimensionMismatchException(x.length, y.length);
    }
    if (x.length < 2) {
        throw new NumberIsTooSmallException(LocalizedFormats.WRONG_NUMBER_OF_POINTS, 2, x.length, true);
    }

    return MathArrays.checkOrder(x, MathArrays.OrderDirection.INCREASING, true, abort);
}
 
Example 6
Source File: PolynomialFunctionLagrangeForm.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Check that the interpolation arrays are valid.
 * The arrays features checked by this method are that both arrays have the
 * same length and this length is at least 2.
 *
 * @param x Interpolating points array.
 * @param y Interpolating values array.
 * @param abort Whether to throw an exception if {@code x} is not sorted.
 * @throws DimensionMismatchException if the array lengths are different.
 * @throws NumberIsTooSmallException if the number of points is less than 2.
 * @throws org.apache.commons.math3.exception.NonMonotonicSequenceException
 * if {@code x} is not sorted in strictly increasing order and {@code abort}
 * is {@code true}.
 * @return {@code false} if the {@code x} is not sorted in increasing order,
 * {@code true} otherwise.
 * @see #evaluate(double[], double[], double)
 * @see #computeCoefficients()
 */
public static boolean verifyInterpolationArray(double x[], double y[], boolean abort)
    throws DimensionMismatchException, NumberIsTooSmallException, NonMonotonicSequenceException {
    if (x.length != y.length) {
        throw new DimensionMismatchException(x.length, y.length);
    }
    if (x.length < 2) {
        throw new NumberIsTooSmallException(LocalizedFormats.WRONG_NUMBER_OF_POINTS, 2, x.length, true);
    }

    return MathArrays.checkOrder(x, MathArrays.OrderDirection.INCREASING, true, abort);
}
 
Example 7
Source File: PolynomialFunctionLagrangeForm.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Check that the interpolation arrays are valid.
 * The arrays features checked by this method are that both arrays have the
 * same length and this length is at least 2.
 *
 * @param x Interpolating points array.
 * @param y Interpolating values array.
 * @param abort Whether to throw an exception if {@code x} is not sorted.
 * @throws DimensionMismatchException if the array lengths are different.
 * @throws NumberIsTooSmallException if the number of points is less than 2.
 * @throws org.apache.commons.math3.exception.NonMonotonicSequenceException
 * if {@code x} is not sorted in strictly increasing order and {@code abort}
 * is {@code true}.
 * @return {@code false} if the {@code x} is not sorted in increasing order,
 * {@code true} otherwise.
 * @see #evaluate(double[], double[], double)
 * @see #computeCoefficients()
 */
public static boolean verifyInterpolationArray(double x[], double y[], boolean abort)
    throws DimensionMismatchException, NumberIsTooSmallException, NonMonotonicSequenceException {
    if (x.length != y.length) {
        throw new DimensionMismatchException(x.length, y.length);
    }
    if (x.length < 2) {
        throw new NumberIsTooSmallException(LocalizedFormats.WRONG_NUMBER_OF_POINTS, 2, x.length, true);
    }

    return MathArrays.checkOrder(x, MathArrays.OrderDirection.INCREASING, true, abort);
}
 
Example 8
Source File: PolynomialFunctionLagrangeForm.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Check that the interpolation arrays are valid.
 * The arrays features checked by this method are that both arrays have the
 * same length and this length is at least 2.
 *
 * @param x Interpolating points array.
 * @param y Interpolating values array.
 * @param abort Whether to throw an exception if {@code x} is not sorted.
 * @throws DimensionMismatchException if the array lengths are different.
 * @throws NumberIsTooSmallException if the number of points is less than 2.
 * @throws org.apache.commons.math3.exception.NonMonotonicSequenceException
 * if {@code x} is not sorted in strictly increasing order and {@code abort}
 * is {@code true}.
 * @return {@code false} if the {@code x} is not sorted in increasing order,
 * {@code true} otherwise.
 * @see #evaluate(double[], double[], double)
 * @see #computeCoefficients()
 */
public static boolean verifyInterpolationArray(double x[], double y[], boolean abort)
    throws DimensionMismatchException, NumberIsTooSmallException, NonMonotonicSequenceException {
    if (x.length != y.length) {
        throw new DimensionMismatchException(x.length, y.length);
    }
    if (x.length < 2) {
        throw new NumberIsTooSmallException(LocalizedFormats.WRONG_NUMBER_OF_POINTS, 2, x.length, true);
    }

    return MathArrays.checkOrder(x, MathArrays.OrderDirection.INCREASING, true, abort);
}