Skip to content

Commit

Permalink
Merge pull request #121 from ErikQQY/qqy/ext_oop
Browse files Browse the repository at this point in the history
Fix oop suport for extension
  • Loading branch information
ErikQQY authored Oct 26, 2024
2 parents eb87249 + ef7e98b commit 9801d8e
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions ext/FractionalDiffEqFdeSolverExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,24 @@ using FdeSolver
# const default_values = (2^-6, 1, nothing, 1e-6, 100)
function SciMLBase.__solve(prob::FODEProblem, alg::FdeSolverPECE; dt = 0.0, abstol = 1e-3, maxiters = 1000, kwargs...)
(; f, order, tspan, u0, p) = prob

iip = isinplace(prob)

tSpan = [first(tspan), last(tspan)]
# FdeSolver only supports out-of-place computing
newf = function (t, y, par)
du = similar(y)
f(du, y, par, t)
return du
newf = if iip
function (t, y, par)
du = similar(y)
f(du, y, par, t)
return du
end
else
function (t, y, par)
return f.(y, par, t)
end
end
t, y = FDEsolver(newf, tSpan, u0, order, p, JF = prob.f.jac, h = dt, tol = abstol)
par = p isa SciMLBase.NullParameters ? nothing : p
t, y = FDEsolver(newf, tSpan, u0, order, par, JF = prob.f.jac, h = dt, tol = abstol)
u = eachrow(y)

return DiffEqBase.build_solution(prob, alg, t, u)
Expand Down

3 comments on commit 9801d8e

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

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

Benchmark Results

Benchmark suite Current: 9801d8e Previous: eb87249 Ratio
FLMM/Trapezoid 17354218 ns 16573801.5 ns 1.05
FLMM/NewtonGregory 17163478.5 ns 16448950.5 ns 1.04
FLMM/BDF 16402366 ns 15710771 ns 1.04

This comment was automatically generated by workflow using github-action-benchmark.

@ErikQQY
Copy link
Member Author

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/118133

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.5.0 -m "<description of version>" 9801d8e44365448c5eea8005ac98d7fe55d54f99
git push origin v0.5.0

Please sign in to comment.