/** * */ @Test(expectedExceptions = IllegalArgumentException.class) public void wrongLengthx1Test() { double[] x0Values = new double[] {0., 1., 2., 3. }; double[] x1Values = new double[] {0., 1., 2., 3. }; double[][] yValues = new double[][] { {1., 2., 4. }, {-1., 2., -4. }, {2., 3., 4. }, {5., 2., 1. } }; BicubicSplineInterpolator interp = new BicubicSplineInterpolator(new CubicSplineInterpolator()); interp.interpolate(x0Values, x1Values, yValues); }
/** * */ @Test(expectedExceptions = IllegalArgumentException.class) public void shortx1Test() { double[] x0Values = new double[] {0., 1., 2., 3. }; double[] x1Values = new double[] {0. }; double[][] yValues = new double[][] { {1. }, {-1. }, {2. }, {5. } }; BicubicSplineInterpolator interp = new BicubicSplineInterpolator(new CubicSplineInterpolator()); interp.interpolate(x0Values, x1Values, yValues); }
/** * */ @Test(expectedExceptions = IllegalArgumentException.class) public void nanX1Test() { double[] x0Values = new double[] {0., 1., 2., 3. }; double[] x1Values = new double[] {0., 1., Double.NaN }; double[][] yValues = new double[][] { {1., 2., 4. }, {-1., 2., -4. }, {2., 3., 4. }, {5., 2., 1. } }; BicubicSplineInterpolator interp = new BicubicSplineInterpolator(new CubicSplineInterpolator()); interp.interpolate(x0Values, x1Values, yValues); }
/** * */ @Test(expectedExceptions = IllegalArgumentException.class) public void notTwoMethodsTest() { double[] x0Values = new double[] {0., 1., 2., 3. }; double[] x1Values = new double[] {0., 1., 2. }; double[][] yValues = new double[][] { {1., 2., 4. }, {-1., 2., -4. }, {2., 3., 4. }, {5., 2., 1. } }; BicubicSplineInterpolator interp = new BicubicSplineInterpolator(new PiecewisePolynomialInterpolator[] {new CubicSplineInterpolator() }); interp.interpolate(x0Values, x1Values, yValues); }
/** * */ @Test(expectedExceptions = IllegalArgumentException.class) public void notKnotRevoveredTests() { double[] x0Values = new double[] {0., 1., 2., 3. }; double[] x1Values = new double[] {0., 1., 2. }; double[][] yValues = new double[][] { {1.e-20, 3.e-120, 5.e120 }, {2.e-20, 3.e-120, 4.e-120 }, {1.e-20, 1.e-120, 1.e-20 }, {4.e-120, 3.e-20, 2.e-20 } }; BicubicSplineInterpolator intp = new BicubicSplineInterpolator(new CubicSplineInterpolator()); intp.interpolate(x0Values, x1Values, yValues); }
/** * */ @Test(expectedExceptions = IllegalArgumentException.class) public void DataShortClapmedTest() { final double[] xValues = new double[] {1. }; final double[] yValues = new double[] {0., 4., 3. }; CubicSplineInterpolator interp = new CubicSplineInterpolator(); interp.interpolate(xValues, yValues); }
/** * */ @Test(expectedExceptions = IllegalArgumentException.class) public void NaNOutputNakTest() { final double[] xValues = new double[] {1., 2., 3., 4. }; final double[] yValues = new double[] {1., 6.e307, -2.e306, 3. }; CubicSplineInterpolator interp = new CubicSplineInterpolator(); interp.interpolate(xValues, yValues); }
/** * */ @Test(expectedExceptions = IllegalArgumentException.class) public void LargeMultiKeyTest() { final double[] xValues = new double[] {1., 2., 3., 4. }; final double[] yValues = new double[] {8., 6., 7., 8. }; final double[] key = new double[] {1., 3., 3.e103 }; CubicSplineInterpolator interp = new CubicSplineInterpolator(); interp.interpolate(xValues, yValues, key); }
/** * */ @Test(expectedExceptions = IllegalArgumentException.class) public void wrongLengthx0Test() { double[] x0Values = new double[] {0., 1., 2. }; double[] x1Values = new double[] {0., 1., 2. }; double[][] yValues = new double[][] { {1., 2., 4. }, {-1., 2., -4. }, {2., 3., 4. }, {5., 2., 1. } }; BicubicSplineInterpolator interp = new BicubicSplineInterpolator(new CubicSplineInterpolator()); interp.interpolate(x0Values, x1Values, yValues); }
/** * */ @Test(expectedExceptions = IllegalArgumentException.class) public void infYTest() { double[] x0Values = new double[] {0., 1., 2., 3. }; double[] x1Values = new double[] {0., 1., 2. }; double[][] yValues = new double[][] { {1., 2., 4. }, {-1., 2., INF }, {2., 3., 4. }, {5., 2., 1. } }; BicubicSplineInterpolator interp = new BicubicSplineInterpolator(new CubicSplineInterpolator()); interp.interpolate(x0Values, x1Values, yValues); }
/** * */ @Test(expectedExceptions = IllegalArgumentException.class) public void DataShortNakMultiTest() { final double[] xValues = new double[] {1. }; final double[][] yValues = new double[][] { {4. }, {3. } }; CubicSplineInterpolator interp = new CubicSplineInterpolator(); interp.interpolate(xValues, yValues); }
/** * (yValues length) == (xValues length) + 2 or (yValues length) == (xValues length) should be satisfied */ @Test(expectedExceptions = IllegalArgumentException.class) public void WrongDataLengthTest() { final double[] xValues = new double[] {1, 2, 3 }; final double[] yValues = new double[] {2, 3, 4, 5 }; CubicSplineInterpolator interp = new CubicSplineInterpolator(); interp.interpolate(xValues, yValues); }
/** * Data are null */ @Test(expectedExceptions = IllegalArgumentException.class) public void NullTest() { final double[] xValues = null; final double[] yValues = null; CubicSplineInterpolator interp = new CubicSplineInterpolator(); interp.interpolate(xValues, yValues); }
/** * */ @Test(expectedExceptions = IllegalArgumentException.class) public void NullKeyMatrixTest() { double[] xValues = new double[] {1., 2., 3. }; double[] yValues = new double[] {1., 3., 4. }; double[][] xKey = new double[3][3]; xKey = null; CubicSplineInterpolator interp = new CubicSplineInterpolator(); interp.interpolate(xValues, yValues, xKey); }
/** * */ @Test(expectedExceptions = IllegalArgumentException.class) public void NullKeyMatrixMultiTest() { double[] xValues = new double[] {1., 2., 3. }; double[][] yValues = new double[][] { {1., 3., 4. }, {2., 3., 1. } }; double[][] xKey = new double[3][4]; xKey = null; CubicSplineInterpolator interp = new CubicSplineInterpolator(); interp.interpolate(xValues, yValues, xKey); }
/** * */ @Test(expectedExceptions = IllegalArgumentException.class) public void nullYdataMultiTest() { double[] xValues = new double[] {1., 2., 3., 4. }; double[][] yValues = new double[][] { {0., 0.1, 0.05, 0.2 }, {0., 0.1, 0.05, 0.2 } }; yValues = null; PiecewisePolynomialInterpolator interp = new CubicSplineInterpolator(); PiecewisePolynomialInterpolator interpPos = new NonnegativityPreservingCubicSplineInterpolator(interp); interpPos.interpolate(xValues, yValues); }
/** * */ @Test(expectedExceptions = IllegalArgumentException.class) public void infXdataTest() { double[] xValues = new double[] {1., 2., 3., INF }; double[] yValues = new double[] {0., 0.1, 0.05, 0.2 }; PiecewisePolynomialInterpolator interp = new CubicSplineInterpolator(); PiecewisePolynomialInterpolator interpPos = new NonnegativityPreservingCubicSplineInterpolator(interp); interpPos.interpolate(xValues, yValues); }
/** * */ @Test(expectedExceptions = IllegalArgumentException.class) public void coincideDataMultiTest() { final double[] xValues = new double[] {1., 2., 2. }; final double[][] yValues = new double[][] { {2., 0., 0.1, 0.05, 2. }, {1., 0., 0.1, 1.05, 2. } }; PiecewisePolynomialInterpolator interp = new CubicSplineInterpolator(); PiecewisePolynomialInterpolator interpPos = new MonotonicityPreservingCubicSplineInterpolator(interp); interpPos.interpolate(xValues, yValues); }
/** * */ @Test(expectedExceptions = IllegalArgumentException.class) public void infXdataTest() { double[] xValues = new double[] {1., 2., 3., INF }; double[] yValues = new double[] {0., 0.1, 0.05, 0.2 }; PiecewisePolynomialInterpolator interp = new CubicSplineInterpolator(); PiecewisePolynomialInterpolator interpPos = new MonotonicityPreservingCubicSplineInterpolator(interp); interpPos.interpolate(xValues, yValues); }
/** * */ @Test(expectedExceptions = IllegalArgumentException.class) public void infYdataMultiTest() { double[] xValues = new double[] {1., 2., 3., 4. }; double[][] yValues = new double[][] { {0., 0., 0.1, 0.05, 0.2, 1. }, {0., 0., 0.1, 0.05, 0.2, INF } }; PiecewisePolynomialInterpolator interp = new CubicSplineInterpolator(); PiecewisePolynomialInterpolator interpPos = new MonotonicityPreservingCubicSplineInterpolator(interp); interpPos.interpolate(xValues, yValues); }