File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -13,9 +13,9 @@ instantiate(x) = 1
13
13
instantiate (x:: Num ) = instantiate (value (x))
14
14
function instantiate (x:: Symbolic )
15
15
vx = value (x)
16
- if vx isa Sym || operation (vx) isa Sym
17
- elseif operation (vx) isa Differential
16
+ if vx isa Sym || operation (vx) isa Sym || (operation (vx) isa Term && operation (vx). f == getindex) || vx isa Symbolics. ArrayOp
18
17
return oneunit (1 * vartype (vx))
18
+ elseif operation (vx) isa Differential || operation (vx) isa Difference
19
19
return instantiate (arguments (vx)[1 ]) / instantiate (arguments (arguments (vx)[1 ])[1 ])
20
20
elseif vx isa Pow
21
21
pargs = arguments (vx)
@@ -27,6 +27,12 @@ function instantiate(x::Symbolic)
27
27
firstunit = unit (terms[1 ])
28
28
@assert all (map (x -> ustrip (firstunit, x) == 1 , terms[2 : end ]))
29
29
return 1 * firstunit
30
+ elseif operation (vx) == Symbolics. _mapreduce
31
+ if vx. arguments[2 ] == +
32
+ instantiate (vx. arguments[3 ])
33
+ else
34
+ throw (ArgumentError (" Unknown array operation $vx " ))
35
+ end
30
36
else
31
37
return oneunit (operation (vx)(instantiate .(arguments (vx))... ))
32
38
end
You can’t perform that action at this time.
0 commit comments