Skip to content

Commit

Permalink
Fix deprecated use of diffrules
Browse files Browse the repository at this point in the history
The deprecation was introduced in DiffRules v1.4.0 and PR:
JuliaDiff/DiffRules.jl#69
  • Loading branch information
odow committed Jul 6, 2022
1 parent 539c0d2 commit 2e8ba99
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ TreeViews = "a2a6695c-b41b-5b7d-aed9-dbfdeacea5d7"
ArrayInterfaceCore = "0.1.1"
ConstructionBase = "1.1, 1.2"
DataStructures = "0.18"
DiffRules = "0.1, 1.0"
DiffRules = "1.4"
Distributions = "0.23, 0.24, 0.25"
DocStringExtensions = "0.7, 0.8, 0.9"
DomainSets = "0.5"
Expand Down
10 changes: 5 additions & 5 deletions src/diff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,12 @@ end
$(SIGNATURES)
TODO
# Examples
```jldoctest
julia> @variables x y z k;
julia> @variables x y z k;
julia> f=k*(abs(x-y)/y-z)^2
k*((abs(x - y) / y - z)^2)
Expand All @@ -152,7 +152,7 @@ julia> Dx=Differential(x) # Differentiate wrt x
julia> dfx=expand_derivatives(Dx(f))
(k*((2abs(x - y)) / y - 2z)*IfElse.ifelse(signbit(x - y), -1, 1)) / y
```
```
"""
function expand_derivatives(O::Symbolic, simplify=false; occurances=nothing)
if istree(O) && isa(operation(O), Differential)
Expand Down Expand Up @@ -326,7 +326,7 @@ derivative(f, args, v) = NoDeriv()

# Pre-defined derivatives
import DiffRules
for (modu, fun, arity) DiffRules.diffrules()
for (modu, fun, arity) DiffRules.diffrules(; filter_modules=(:Base, :SpecialFunctions, :NaNMath))
fun in [:*, :+, :abs, :mod, :rem, :max, :min] && continue # special
for i 1:arity

Expand Down

0 comments on commit 2e8ba99

Please sign in to comment.