JacobianEstimateInitializationFunction implements NewtonRootFinderMatrixInitializationFunction { @Override public DoubleMatrix2D getInitializedMatrix(final Function1D<DoubleMatrix1D, DoubleMatrix2D> jacobianFunction, final DoubleMatrix1D x) { ArgumentChecker.notNull(jacobianFunction, "Jacobian Function"); ArgumentChecker.notNull(x, "x"); return jacobianFunction.evaluate(x); }  @Override DoubleMatrix2D getInitializedMatrix(final Function1D<DoubleMatrix1D, DoubleMatrix2D> jacobianFunction, final DoubleMatrix1D x);  }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullFunction() { ESTIMATE.getInitializedMatrix(null, X); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullVector() { ESTIMATE.getInitializedMatrix(J, null); }
@Test public void test() { DoubleMatrix2D m1 = ESTIMATE.getInitializedMatrix(J, X); DoubleMatrix2D m2 = J.evaluate(X); for (int i = 0; i < 2; i++) { for (int j = 0; j < 2; j++) { assertEquals(m1.getEntry(i, j), m2.getEntry(i, j), 1e-9); } } }