def test_class_interface(): def f(x, g, *args): g[:] = 4 * x return x ** 4 + 1 opt = LBFGS() opt.max_iterations = 3 assert_array_equal(opt.minimize(f, 1e6), [0]) opt.max_iterations = 1 assert_raises(LBFGSError, opt.minimize, f, 1e7)
def test_class_interface(): def f(x, g, *args): g[:] = 4 * x return x**4 + 1 opt = LBFGS() opt.max_iterations = 3 assert_array_equal(opt.minimize(f, 1e6), [1]) opt.max_iterations = 1 assert_raises(LBFGSError, opt.minimize, f, 1e7)