Skip to content
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: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ MATLAB = "10e44e05-a98a-55b3-a45b-ba969058deb6"
ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"

[compat]
DiffEqBase = "6.122, 7"
Expand All @@ -17,6 +18,7 @@ ParameterizedFunctions = "5"
PrecompileTools = "1.1"
Reexport = "0.2, 1.0"
SafeTestsets = "0.1, 1"
SciMLBase = "3.27"
SciMLTesting = "1"
Test = "<0.0.1, 1"
julia = "1.10"
Expand Down
17 changes: 9 additions & 8 deletions src/MATLABDiffEq.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ using Reexport
@reexport using DiffEqBase
using MATLAB, ModelingToolkit
using PrecompileTools
import SciMLBase

# MATLAB only supports Float64 arrays. Check if a type is MATLAB-compatible.
# Note: We specifically accept standard Julia integer types that MATLAB can convert,
Expand Down Expand Up @@ -52,7 +53,7 @@ else
const mtk_states = ModelingToolkit.states
end

abstract type MATLABAlgorithm <: DiffEqBase.AbstractODEAlgorithm end
abstract type MATLABAlgorithm <: SciMLBase.AbstractODEAlgorithm end
struct ode23 <: MATLABAlgorithm end
struct ode45 <: MATLABAlgorithm end
struct ode113 <: MATLABAlgorithm end
Expand All @@ -63,7 +64,7 @@ struct ode15s <: MATLABAlgorithm end
struct ode15i <: MATLABAlgorithm end

function DiffEqBase.__solve(
prob::DiffEqBase.AbstractODEProblem{uType, tupType, isinplace},
prob::SciMLBase.AbstractODEProblem{uType, tupType, isinplace},
alg::AlgType,
timeseries = [],
ts = [],
Expand Down Expand Up @@ -151,7 +152,7 @@ function DiffEqBase.__solve(

stats = buildDEStats(solstats)

return DiffEqBase.build_solution(
return SciMLBase.build_solution(
prob,
alg,
ts,
Expand All @@ -162,15 +163,15 @@ function DiffEqBase.__solve(
end

"""
buildDEStats(solverstats::Dict{String, <:Any}) -> DiffEqBase.Stats
buildDEStats(solverstats::Dict{String, <:Any}) -> SciMLBase.DEStats

Convert MATLAB ODE solver statistics dictionary to DiffEqBase.Stats.
Convert MATLAB ODE solver statistics dictionary to SciMLBase.DEStats.

The function extracts statistics from the MATLAB solver output and maps them
to the corresponding fields in DiffEqBase.Stats. Missing keys default to 0.
to the corresponding fields in SciMLBase.DEStats. Missing keys default to 0.
"""
function buildDEStats(solverstats::Dict{String, <:Any})::DiffEqBase.Stats
destats = DiffEqBase.Stats(0)
function buildDEStats(solverstats::Dict{String, <:Any})::SciMLBase.DEStats
destats = SciMLBase.DEStats(0)
destats.nf = Int(get(solverstats, "nfevals", 0))
destats.nreject = Int(get(solverstats, "nfailed", 0))
destats.naccept = Int(get(solverstats, "nsteps", 0))
Expand Down
2 changes: 1 addition & 1 deletion test/qa/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ MATLABDiffEq = {path = "../.."}
Aqua = "0.8"
JET = "0.9, 0.10, 0.11"
SafeTestsets = "0.1, 1"
SciMLTesting = "1"
SciMLTesting = "1.7"
Test = "<0.0.1, 1"
julia = "1.10"
39 changes: 28 additions & 11 deletions test/qa/qa.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,29 @@
using SafeTestsets
using SciMLTesting, MATLABDiffEq, JET, Test

@safetestset "Aqua" begin
using MATLABDiffEq, Aqua
Aqua.test_all(MATLABDiffEq)
end

@safetestset "JET static analysis" begin
using MATLABDiffEq, JET, Test
rep = JET.report_package(MATLABDiffEq; target_modules = (MATLABDiffEq,))
@test length(JET.get_reports(rep)) == 0
end
run_qa(
MATLABDiffEq;
explicit_imports = true,
ei_kwargs = (;
# DiffEqBase.__solve (SciMLBase-owned) is the documented solver extension
# point re-exported by DiffEqBase, and the Symbolics-owned MATLABTarget is
# reached through ModelingToolkit; both are accessed through a re-exporter
# that is not the owner.
all_qualified_accesses_via_owners = (;
ignore = (
:__solve, :MATLABTarget,
),
),
# Still non-public upstream: __solve (SciMLBase) and MATLABTarget
# (Symbolics). Drop once they are declared public.
all_qualified_accesses_are_public = (;
ignore = (
:__solve, :MATLABTarget,
),
),
),
# no_implicit_imports: the module deliberately `@reexport using DiffEqBase`
# and `using MATLAB`/`ModelingToolkit`/`PrecompileTools`; making every name
# explicit is a large, risky refactor against heavy deps. Tracked in
# https://github.com/SciML/MATLABDiffEq.jl/issues/85
ei_broken = (:no_implicit_imports,),
)
Loading