/** * */ @Test(expectedExceptions = IllegalArgumentException.class) public void infxIntMultiTest() { DoubleMatrix coefsMatrix = DoubleMatrix.copyOf( new double[][] { {1., -3., 3., -1 }, {1., 0., 0., 0. }, {1., 3., 3., 1. } }); double[] xKeys = new double[] {1.5, 7. / 3., 29. / 7., INF }; final int dim = 1; final int nCoefs = 4; PiecewisePolynomialResult pp = new PiecewisePolynomialResult(X_VALUES, coefsMatrix, nCoefs, dim); PiecewisePolynomialFunction1D function = new PiecewisePolynomialFunction1D(); function.integrate(pp, 1., xKeys); }
/** * */ @Test(expectedExceptions = IllegalArgumentException.class) public void NaNxIntTest() { DoubleMatrix coefsMatrix = DoubleMatrix.copyOf( new double[][] { {1., -3., 3., -1 }, {1., 0., 0., 0. }, {1., 3., 3., 1. } }); double[][] xKeys = new double[][] { {Double.NaN, 1, 2, 2.5 }, {1.5, 7. / 3., 29. / 7., 5. } }; final int dim = 1; final int nCoefs = 4; PiecewisePolynomialResult pp = new PiecewisePolynomialResult(X_VALUES, coefsMatrix, nCoefs, dim); PiecewisePolynomialFunction1D function = new PiecewisePolynomialFunction1D(); function.integrate(pp, 1., xKeys[0][0]); }
/** * */ @Test(expectedExceptions = IllegalArgumentException.class) public void nullDimIntMultiTest() { DoubleMatrix coefsMatrix = DoubleMatrix.copyOf( new double[][] { {1., -3., 3., -1 }, {0., 5., -20., 20 }, {1., 0., 0., 0. }, {0., 5., -10., 5 }, {1., 3., 3., 1. }, {0., 5., 0., 0. } }); double[] xKeys = new double[] {-2, 1, 2, 2.5 }; final int dim = 2; final int nCoefs = 4; PiecewisePolynomialResult pp = new PiecewisePolynomialResult(X_VALUES, coefsMatrix, nCoefs, dim); PiecewisePolynomialFunction1D function = new PiecewisePolynomialFunction1D(); function.integrate(pp, 1., xKeys); }
/** * */ @Test(expectedExceptions = IllegalArgumentException.class) public void infxIntTest() { DoubleMatrix coefsMatrix = DoubleMatrix.copyOf( new double[][] { {1., -3., 3., -1 }, {1., 0., 0., 0. }, {1., 3., 3., 1. } }); double[][] xKeys = new double[][] { {INF, 1, 2, 2.5 }, {1.5, 7. / 3., 29. / 7., 5. } }; final int dim = 1; final int nCoefs = 4; PiecewisePolynomialResult pp = new PiecewisePolynomialResult(X_VALUES, coefsMatrix, nCoefs, dim); PiecewisePolynomialFunction1D function = new PiecewisePolynomialFunction1D(); function.integrate(pp, 1., xKeys[0][0]); }
/** * */ @Test(expectedExceptions = IllegalArgumentException.class) public void NaNxIntMultiTest() { DoubleMatrix coefsMatrix = DoubleMatrix.copyOf( new double[][] { {1., -3., 3., -1 }, {1., 0., 0., 0. }, {1., 3., 3., 1. } }); double[] xKeys = new double[] {1.5, 7. / 3., 29. / 7., Double.NaN }; final int dim = 1; final int nCoefs = 4; PiecewisePolynomialResult pp = new PiecewisePolynomialResult(X_VALUES, coefsMatrix, nCoefs, dim); PiecewisePolynomialFunction1D function = new PiecewisePolynomialFunction1D(); function.integrate(pp, 1., xKeys); }
/** * */ @Test(expectedExceptions = IllegalArgumentException.class) public void nullpIntegrateTest() { final DoubleMatrix coefsMatrix = DoubleMatrix.copyOf( new double[][] { {1., -3., 3., -1 }, {1., 0., 0., 0. }, {1., 3., 3., 1. } }); final double[][] xKeys = new double[][] { {-2, 1, 2, 2.5 }, {1.5, 7. / 3., 29. / 7., 5. } }; final int dim = 1; final int nCoefs = 4; PiecewisePolynomialResult pp = new PiecewisePolynomialResult(X_VALUES, coefsMatrix, nCoefs, dim); pp = null; PiecewisePolynomialFunction1D function = new PiecewisePolynomialFunction1D(); function.integrate(pp, 1., xKeys[0][0]); }
/** * */ @Test(expectedExceptions = IllegalArgumentException.class) public void nullpIntegrateMultiTest() { final DoubleMatrix coefsMatrix = DoubleMatrix.copyOf( new double[][] { {1., -3., 3., -1 }, {1., 0., 0., 0. }, {1., 3., 3., 1. } }); final double[][] xKeys = new double[][] { {-2, 1, 2, 2.5 }, {1.5, 7. / 3., 29. / 7., 5. } }; final int dim = 1; final int nCoefs = 4; PiecewisePolynomialResult pp = new PiecewisePolynomialResult(X_VALUES, coefsMatrix, nCoefs, dim); pp = null; PiecewisePolynomialFunction1D function = new PiecewisePolynomialFunction1D(); function.integrate(pp, 1., xKeys[0]); }
/** * */ @Test(expectedExceptions = IllegalArgumentException.class) public void nullxIntTest() { DoubleMatrix coefsMatrix = DoubleMatrix.copyOf( new double[][] { {1., -3., 3., -1 }, {1., 0., 0., 0. }, {1., 3., 3., 1. } }); double[] xKeys = new double[] {-2, 1, 2, 2.5 }; final int dim = 1; final int nCoefs = 4; xKeys = null; PiecewisePolynomialResult pp = new PiecewisePolynomialResult(X_VALUES, coefsMatrix, nCoefs, dim); PiecewisePolynomialFunction1D function = new PiecewisePolynomialFunction1D(); function.integrate(pp, 1., xKeys); }
/** * */ @Test(expectedExceptions = IllegalArgumentException.class) public void nullDimIntTest() { DoubleMatrix coefsMatrix = DoubleMatrix.copyOf( new double[][] { {1., -3., 3., -1 }, {0., 5., -20., 20 }, {1., 0., 0., 0. }, {0., 5., -10., 5 }, {1., 3., 3., 1. }, {0., 5., 0., 0. } }); double[] xKeys = new double[] {-2, 1, 2, 2.5 }; final int dim = 2; final int nCoefs = 4; PiecewisePolynomialResult pp = new PiecewisePolynomialResult(X_VALUES, coefsMatrix, nCoefs, dim); PiecewisePolynomialFunction1D function = new PiecewisePolynomialFunction1D(); function.integrate(pp, 1., xKeys[0]); }
for (int i = 0; i < nInit; ++i) { for (int j = 0; j < nKeys; ++j) { integrate[i][j] = function.integrate(result, initials[i], xKeys).get(j); assertEquals(function.integrate(result, initials[0], xKeys[0]), integrateExp[0][0], ref * EPS); assertEquals(function.integrate(result, initials[0], xKeys[3]), integrateExp[0][3], ref * EPS); assertEquals(function.integrate(result, initials[3], xKeys[0]), integrateExp[3][0], ref * EPS); assertEquals(function.integrate(result, initials[1], xKeys[0]), integrateExp[1][0], ref * EPS);
for (int i = 0; i < nInit; ++i) { for (int j = 0; j < nKeys; ++j) { integrate[i][j] = function.integrate(result, initials[i], xKeys).get(j);
for (int i = 0; i < nInit; ++i) { for (int j = 0; j < nKeys; ++j) { integrate[i][j] = function.integrate(result, initials[i], xKeys).get(j);