@@ -8,7 +8,7 @@ A helper function for computing the derivative of an expression with respect to
8
8
"""
9
9
function derivative (O, v; simplify = true )
10
10
if O isa AbstractArray
11
- Num[expand_derivatives (Differential (v)(value (o)), simplify) for o in O]
11
+ Num[Num ( expand_derivatives (Differential (v)(value (o)), simplify) ) for o in O]
12
12
else
13
13
Num (expand_derivatives (Differential (v)(value (O)), simplify))
14
14
end
@@ -23,7 +23,7 @@ A helper function for computing the gradient of an expression with respect to
23
23
an array of variable expressions.
24
24
"""
25
25
function gradient (O, vars:: AbstractVector ; simplify = true )
26
- Num[expand_derivatives (Differential (v)(value (O)),simplify) for v in vars]
26
+ Num[Num ( expand_derivatives (Differential (v)(value (O)),simplify) ) for v in vars]
27
27
end
28
28
29
29
"""
@@ -35,7 +35,7 @@ A helper function for computing the Jacobian of an array of expressions with res
35
35
an array of variable expressions.
36
36
"""
37
37
function jacobian (ops:: AbstractVector , vars:: AbstractVector ; simplify = true )
38
- Num[expand_derivatives (Differential (value (v))(value (O)),simplify) for O in ops, v in vars]
38
+ Num[Num ( expand_derivatives (Differential (value (v))(value (O)),simplify) ) for O in ops, v in vars]
39
39
end
40
40
41
41
"""
@@ -57,7 +57,7 @@ function sparsejacobian(ops::AbstractVector, vars::AbstractVector; simplify = tr
57
57
exprs = Num[]
58
58
59
59
for (i,j) in zip (I, J)
60
- push! (exprs, expand_derivatives (Differential (vars[j])(ops[i]), simplify))
60
+ push! (exprs, Num ( expand_derivatives (Differential (vars[j])(ops[i]), simplify) ))
61
61
end
62
62
sparse (I,J, exprs, length (ops), length (vars))
63
63
end
0 commit comments