warn("Only "trust-constr" method accept %s "
"options for "jac". Using "2-point" instead." % jac)
jac = None
elif notcallable(jac):
if bool(jac):
fun = MemoizeJac(fun)
jac = fun.derivative
After Change
// fun returns func and grad
fun = MemoizeJac(fun)
jac = fun.derivative
elif (jac in FD_METHODS and
meth in ["trust-constr", "bfgs", "cg", "l-bfgs-b", "tnc"]):
// finite differences
pass
elif meth in ["trust-constr"]:
// default jac calculation for this method
jac = "2-point"
elif jac is None or bool(jac) is False: