/** * */ @Test(expectedExceptions = IllegalArgumentException.class) public void linearFuncDiffTwiceTest() { DoubleMatrix coefsMatrix = DoubleMatrix.copyOf( new double[][] { {1., -3. }, {0., 5. }, {1., 0. }, {0., 5. }, {1., 3. }, {0., 5. } }); double[] xKeys = new double[] {-2, 1, 2, 2.5 }; final int dim = 2; final int nCoefs = 2; PiecewisePolynomialResult pp = new PiecewisePolynomialResult(X_VALUES, coefsMatrix, nCoefs, dim); PiecewisePolynomialFunction1D function = new PiecewisePolynomialFunction1D(); function.differentiateTwice(pp, xKeys[0]); }
/** * */ @Test(expectedExceptions = IllegalArgumentException.class) public void linearFuncDiffTwiceMultiTest() { DoubleMatrix coefsMatrix = DoubleMatrix.copyOf( new double[][] { {1., -3. }, {0., 5. }, {1., 0. }, {0., 5. }, {1., 3. }, {0., 5. } }); double[] xKeys = new double[] {-2, 1, 2, 2.5 }; final int dim = 2; final int nCoefs = 2; PiecewisePolynomialResult pp = new PiecewisePolynomialResult(X_VALUES, coefsMatrix, nCoefs, dim); PiecewisePolynomialFunction1D function = new PiecewisePolynomialFunction1D(); function.differentiateTwice(pp, xKeys); }
final DoubleArray differentiateTwice = function.differentiateTwice(result, xKeys).row(0); final double[][] integrate = new double[nInit][nKeys]; for (int i = 0; i < nInit; ++i) { assertEquals(function.differentiateTwice(result, xKeys[0]).get(0), differentiateTwiceExp[0], ref * EPS); assertEquals(function.differentiateTwice(result, xKeys[3]).get(0), differentiateTwiceExp[3], ref * EPS);
final DoubleArray differentiateTwice = function.differentiateTwice(result, xKeys).row(0); final double[][] integrate = new double[nInit][nKeys]; for (int i = 0; i < nInit; ++i) {