Skip to content

Commit 89e6f30

Browse files
Merge pull request #161 from avik-pal/ap/mi2
Use SciMLBase instead of DiffEqBase
2 parents 17ba06d + bbf586a commit 89e6f30

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

Project.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
88
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
99
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
1010
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
11-
DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e"
1211
FiniteDiff = "6a86dc24-6348-571c-b903-95158fe2bd41"
1312
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
1413
LightGraphs = "093fc24a-ae57-5d10-9952-331d41423f4d"
@@ -23,7 +22,6 @@ Adapt = "1, 2.0, 3.0"
2322
ArrayInterface = "2.8, 3.0"
2423
Compat = "2.2, 3"
2524
DataStructures = "0.17, 0.18"
26-
DiffEqBase = "6"
2725
FiniteDiff = "2.8.1"
2826
ForwardDiff = "0.10"
2927
LightGraphs = "1.3"

src/SparseDiffTools.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
module SparseDiffTools
22

33
using Compat
4-
using DiffEqBase
54
using FiniteDiff
65
using ForwardDiff
76
using LightGraphs

src/differentiation/vecjac_products.jl

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
function _numargs(f)
2+
typ = Tuple{Any, Val{:analytic}, Vararg}
3+
typ2 = Tuple{Any, Type{Val{:analytic}}, Vararg} # This one is required for overloaded types
4+
typ3 = Tuple{Any, Val{:jac}, Vararg}
5+
typ4 = Tuple{Any, Type{Val{:jac}}, Vararg} # This one is required for overloaded types
6+
typ5 = Tuple{Any, Val{:tgrad}, Vararg}
7+
typ6 = Tuple{Any, Type{Val{:tgrad}}, Vararg} # This one is required for overloaded types
8+
numparam = maximum([(m.sig<:typ || m.sig<:typ2 || m.sig<:typ3 || m.sig<:typ4 || m.sig<:typ5 || m.sig<:typ6) ? 0 : num_types_in_tuple(m.sig) for m in methods(f)])
9+
return (numparam-1) #-1 in v0.5 since it adds f as the first parameter
10+
end
111

212
function num_vecjac!(
313
du,
@@ -8,7 +18,7 @@ function num_vecjac!(
818
cache2 = similar(v);
919
compute_f0 = true,
1020
)
11-
if DiffEqBase.numargs(f) != 2
21+
if _numargs(f) != 2
1222
du .= num_jacvec(f, x, v)
1323
return du
1424
end

0 commit comments

Comments
 (0)