/** * Compares the passed in gradient function to a numerical calculation. Comparison is done using * an absolute value. * @return true for within tolerance and false otherwise */ public static boolean gradient( FunctionNtoS func , FunctionNtoN gradient , double param[] , double tol ) { return gradient(func, gradient, param, tol, Math.sqrt(UtilEjml.EPS)); }
/** * Compares the passed in gradient function to a numerical calculation. Comparison is done using * an absolute value. * @return true for within tolerance and false otherwise */ public static boolean gradientR( FunctionNtoS func , FunctionNtoN gradient , double param[] , double tol ) { return gradient(func, gradient, param, tol, Math.sqrt(UtilEjml.EPS)); }
/** * Compares the passed in gradient function to a numerical calculation. Comparison is done using * an absolute value. * @return true for within tolerance and false otherwise */ public static boolean gradientR( FunctionNtoS func , FunctionNtoN gradient , double param[] , double tol ) { return gradient(func, gradient, param, tol, Math.sqrt(UtilEjml.EPS)); }
/** * Compares the passed in gradient function to a numerical calculation. Comparison is done using * an absolute value. * @return true for within tolerance and false otherwise */ public static boolean gradient( FunctionNtoS func , FunctionNtoN gradient , double param[] , double tol ) { return gradient(func, gradient, param, tol, Math.sqrt(UtilEjml.EPS)); }
@Test public void gradient() { SimpleS f = new SimpleS(); SimpleGradient g = new SimpleGradient(); assertTrue(DerivativeChecker.gradient(f,g,new double[]{2,4.5},1e-5)); }