@@ -99,6 +99,7 @@ derivative(O::Operation, idx) = derivative(O.op, (O.args...,), Val(idx))
99
99
# Pre-defined derivatives
100
100
import DiffRules, SpecialFunctions, NaNMath
101
101
for (modu, fun, arity) ∈ DiffRules. diffrules ()
102
+ fun in [:* , :+ ] && continue # special
102
103
for i ∈ 1 : arity
103
104
@eval function derivative (:: typeof ($ modu.$ fun), args:: NTuple{$arity,Any} , :: Val{$i} )
104
105
M, f = $ (modu, fun)
@@ -109,8 +110,8 @@ for (modu, fun, arity) ∈ DiffRules.diffrules()
109
110
end
110
111
end
111
112
112
- derivative (:: typeof (+ ), args:: NTuple{N,Operation } , :: Val ) where {N} = 1
113
- derivative (:: typeof (* ), args:: NTuple{N,Operation } , :: Val{i} ) where {N,i} = Operation (* , deleteat! (collect (args), i))
113
+ derivative (:: typeof (+ ), args:: NTuple{N,Any } , :: Val ) where {N} = 1
114
+ derivative (:: typeof (* ), args:: NTuple{N,Any } , :: Val{i} ) where {N,i} = Operation (* , deleteat! (collect (args), i))
114
115
115
116
function count_order (x)
116
117
@assert ! (x isa Symbol) " The variable $x must have an order of differentiation that is greater or equal to 1!"
0 commit comments