Skip to content

Use SciMLBase instead of DiffEqBase #161

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e"
FiniteDiff = "6a86dc24-6348-571c-b903-95158fe2bd41"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
LightGraphs = "093fc24a-ae57-5d10-9952-331d41423f4d"
Expand All @@ -23,7 +22,6 @@ Adapt = "1, 2.0, 3.0"
ArrayInterface = "2.8, 3.0"
Compat = "2.2, 3"
DataStructures = "0.17, 0.18"
DiffEqBase = "6"
FiniteDiff = "2.8.1"
ForwardDiff = "0.10"
LightGraphs = "1.3"
Expand Down
1 change: 0 additions & 1 deletion src/SparseDiffTools.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module SparseDiffTools

using Compat
using DiffEqBase
using FiniteDiff
using ForwardDiff
using LightGraphs
Expand Down
12 changes: 11 additions & 1 deletion src/differentiation/vecjac_products.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
function _numargs(f)
typ = Tuple{Any, Val{:analytic}, Vararg}
typ2 = Tuple{Any, Type{Val{:analytic}}, Vararg} # This one is required for overloaded types
typ3 = Tuple{Any, Val{:jac}, Vararg}
typ4 = Tuple{Any, Type{Val{:jac}}, Vararg} # This one is required for overloaded types
typ5 = Tuple{Any, Val{:tgrad}, Vararg}
typ6 = Tuple{Any, Type{Val{:tgrad}}, Vararg} # This one is required for overloaded types
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)])
return (numparam-1) #-1 in v0.5 since it adds f as the first parameter
end

function num_vecjac!(
du,
Expand All @@ -8,7 +18,7 @@ function num_vecjac!(
cache2 = similar(v);
compute_f0 = true,
)
if DiffEqBase.numargs(f) != 2
if _numargs(f) != 2
du .= num_jacvec(f, x, v)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would think this one would be num_jacvec(f, du, x, v) and then there would be one on the other dispatch which allocates? We can discuss this later though, I'll just merge and tag for now since you're using it.

return du
end
Expand Down