/** * Construct a Lagrange polynomial with the given abscissas and function * values. The order of interpolating points are not important. * <p> * The constructor makes copy of the input arrays and assigns them.</p> * * @param x interpolating points * @param y function values at interpolating points * @throws DimensionMismatchException if the array lengths are different. * @throws NumberIsTooSmallException if the number of points is less than 2. * @throws NonMonotonicSequenceException * if two abscissae have the same value. */ public PolynomialFunctionLagrangeForm(double x[], double y[]) throws DimensionMismatchException, NumberIsTooSmallException, NonMonotonicSequenceException { this.x = new double[x.length]; this.y = new double[y.length]; System.arraycopy(x, 0, this.x, 0, x.length); System.arraycopy(y, 0, this.y, 0, y.length); coefficientsComputed = false; if (!verifyInterpolationArray(x, y, false)) { MathArrays.sortInPlace(this.x, this.y); // Second check in case some abscissa is duplicated. verifyInterpolationArray(this.x, this.y, true); } }
NumberIsTooSmallException, NonMonotonicSequenceException { PolynomialFunctionLagrangeForm.verifyInterpolationArray(x, y, true);
if (verifyInterpolationArray(x, y, false)) { return evaluateInternal(x, y, z); verifyInterpolationArray(xNew, yNew, true); return evaluateInternal(xNew, yNew, z);
PolynomialFunctionLagrangeForm.verifyInterpolationArray(x, y, true);
/** * Construct a Lagrange polynomial with the given abscissas and function * values. The order of interpolating points are not important. * <p> * The constructor makes copy of the input arrays and assigns them.</p> * * @param x interpolating points * @param y function values at interpolating points * @throws DimensionMismatchException if the array lengths are different. * @throws NumberIsTooSmallException if the number of points is less than 2. * @throws NonMonotonicSequenceException * if two abscissae have the same value. */ public PolynomialFunctionLagrangeForm(double x[], double y[]) throws DimensionMismatchException, NumberIsTooSmallException, NonMonotonicSequenceException { this.x = new double[x.length]; this.y = new double[y.length]; System.arraycopy(x, 0, this.x, 0, x.length); System.arraycopy(y, 0, this.y, 0, y.length); coefficientsComputed = false; if (!verifyInterpolationArray(x, y, false)) { MathArrays.sortInPlace(this.x, this.y); // Second check in case some abscissa is duplicated. verifyInterpolationArray(this.x, this.y, true); } }
/** * Construct a Lagrange polynomial with the given abscissas and function * values. The order of interpolating points are not important. * <p> * The constructor makes copy of the input arrays and assigns them.</p> * * @param x interpolating points * @param y function values at interpolating points * @throws DimensionMismatchException if the array lengths are different. * @throws NumberIsTooSmallException if the number of points is less than 2. * @throws NonMonotonicSequenceException * if two abscissae have the same value. */ public PolynomialFunctionLagrangeForm(double x[], double y[]) throws DimensionMismatchException, NumberIsTooSmallException, NonMonotonicSequenceException { this.x = new double[x.length]; this.y = new double[y.length]; System.arraycopy(x, 0, this.x, 0, x.length); System.arraycopy(y, 0, this.y, 0, y.length); coefficientsComputed = false; if (!verifyInterpolationArray(x, y, false)) { MathArrays.sortInPlace(this.x, this.y); // Second check in case some abscissa is duplicated. verifyInterpolationArray(this.x, this.y, true); } }
NumberIsTooSmallException, NonMonotonicSequenceException { PolynomialFunctionLagrangeForm.verifyInterpolationArray(x, y, true);
NumberIsTooSmallException, NonMonotonicSequenceException { PolynomialFunctionLagrangeForm.verifyInterpolationArray(x, y, true);
if (verifyInterpolationArray(x, y, false)) { return evaluateInternal(x, y, z); verifyInterpolationArray(xNew, yNew, true); return evaluateInternal(xNew, yNew, z);
if (verifyInterpolationArray(x, y, false)) { return evaluateInternal(x, y, z); verifyInterpolationArray(xNew, yNew, true); return evaluateInternal(xNew, yNew, z);
PolynomialFunctionLagrangeForm.verifyInterpolationArray(x, y, true);
PolynomialFunctionLagrangeForm.verifyInterpolationArray(x, y, true);