@@ -44,18 +44,15 @@ For more information on the use of automatic differentiation, see the
44
44
documentation of the `AbstractADType` types.
45
45
"""
46
46
function instantiate_function (f, x, :: AbstractADType , p, num_cons = 0 )
47
- grad = f. grad === nothing ? nothing : (G, x) -> f. grad (G, x, p)
48
- hess = f. hess === nothing ? nothing : (H, x) -> f. hess (H, x, p)
49
- hv = f. hv === nothing ? nothing : (H, x, v) -> f. hv (H, x, v, p)
50
- cons = f. cons === nothing ? nothing : (res, x) -> f. cons (res, x, p)
51
- cons_j = f. cons_j === nothing ? nothing : (res, x) -> f. cons_j (res, x, p)
52
- cons_h = f. cons_h === nothing ? nothing : (res, x) -> f. cons_h (res, x, p)
53
- hess_prototype = f. hess_prototype === nothing ? nothing :
54
- convert .(eltype (x), f. hess_prototype)
55
- cons_jac_prototype = f. cons_jac_prototype === nothing ? nothing :
56
- convert .(eltype (x), f. cons_jac_prototype)
57
- cons_hess_prototype = f. cons_hess_prototype === nothing ? nothing :
58
- convert .(eltype (x), f. cons_hess_prototype)
47
+ grad = f. grad === nothing ? nothing : (G,x)-> f. grad (G,x,p)
48
+ hess = f. hess === nothing ? nothing : (H,x)-> f. hess (H,x,p)
49
+ hv = f. hv === nothing ? nothing : (H,x,v)-> f. hv (H,x,v,p)
50
+ cons = f. cons === nothing ? nothing : (res,x)-> f. cons (res,x,p)
51
+ cons_j = f. cons_j === nothing ? nothing : (res,x)-> f. cons_j (res,x,p)
52
+ cons_h = f. cons_h === nothing ? nothing : (res,x)-> f. cons_h (res,x,p)
53
+ hess_prototype = f. hess_prototype === nothing ? nothing : convert .(eltype (x), f. hess_prototype)
54
+ cons_jac_prototype = f. cons_jac_prototype === nothing ? nothing : convert .(eltype (x), f. cons_jac_prototype)
55
+ cons_hess_prototype = f. cons_hess_prototype === nothing ? nothing : [convert .(eltype (x), f. cons_hess_prototype[i]) for i in 1 : num_cons]
59
56
expr = symbolify (f. expr)
60
57
cons_expr = symbolify .(f. cons_expr)
61
58
0 commit comments