Skip to content

Commit 5b6fd22

Browse files
committed
Merge branch 'master' of github.com:SciML/DiffEqBase.jl into ap/kwargs
2 parents e78c33d + c47b6b7 commit 5b6fd22

File tree

5 files changed

+126
-94
lines changed

5 files changed

+126
-94
lines changed

Project.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "DiffEqBase"
22
uuid = "2b5f629d-d688-5b77-993f-72d75c75574e"
33
authors = ["Chris Rackauckas <[email protected]>"]
4-
version = "6.128.4"
4+
version = "6.129.0"
55

66
[deps]
77
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
@@ -20,6 +20,7 @@ Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
2020
MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221"
2121
Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a"
2222
PreallocationTools = "d236fae5-4411-538c-8e31-a6e3d9e00b46"
23+
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
2324
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
2425
RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd"
2526
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
@@ -71,6 +72,7 @@ FunctionWrappersWrappers = "0.1"
7172
MuladdMacro = "0.2.1"
7273
Parameters = "0.12.0"
7374
PreallocationTools = "0.4"
75+
PrecompileTools = "1"
7476
RecursiveArrayTools = "2"
7577
Reexport = "1.0"
7678
Requires = "1.0"

src/DiffEqBase.jl

Lines changed: 99 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -7,101 +7,108 @@ if !isdefined(Base, :get_extension)
77
using Requires
88
end
99

10-
using ArrayInterface
11-
12-
using StaticArraysCore # data arrays
13-
14-
using LinearAlgebra, Printf
15-
16-
using DocStringExtensions
17-
18-
using FunctionWrappers: FunctionWrapper
19-
20-
using MuladdMacro, Parameters
10+
import PrecompileTools
11+
12+
PrecompileTools.@recompile_invalidations begin
13+
using ArrayInterface
14+
15+
using StaticArraysCore # data arrays
16+
17+
using LinearAlgebra, Printf
18+
19+
using DocStringExtensions
20+
21+
using FunctionWrappers: FunctionWrapper
22+
23+
using MuladdMacro, Parameters
24+
25+
using Statistics
26+
27+
using FastBroadcast: @.., True, False
28+
29+
using Static: reduce_tup
30+
31+
import ChainRulesCore
32+
import RecursiveArrayTools
33+
import SparseArrays
34+
import TruncatedStacktraces
35+
36+
import ChainRulesCore: NoTangent, @non_differentiable
37+
import ZygoteRules
38+
39+
using Setfield
40+
41+
using ForwardDiff
42+
43+
using EnumX
44+
45+
using Markdown
46+
47+
# Could be made optional/glue
48+
import PreallocationTools
49+
50+
import FunctionWrappersWrappers
51+
52+
using SciMLBase
53+
54+
using SciMLOperators: AbstractSciMLOperator, AbstractSciMLScalarOperator
55+
56+
using SciMLBase: @def, DEIntegrator, DEProblem,
57+
AbstractDiffEqInterpolation,
58+
DECallback, AbstractDEOptions, DECache, AbstractContinuousCallback,
59+
AbstractDiscreteCallback, AbstractLinearProblem, AbstractNonlinearProblem,
60+
AbstractOptimizationProblem, AbstractSteadyStateProblem,
61+
AbstractJumpProblem,
62+
AbstractNoiseProblem, AbstractEnsembleProblem, AbstractDynamicalODEProblem,
63+
DEAlgorithm, StandardODEProblem, AbstractIntegralProblem,
64+
AbstractSensitivityAlgorithm, AbstractODEAlgorithm,
65+
AbstractSDEAlgorithm, AbstractDDEAlgorithm, AbstractDAEAlgorithm,
66+
AbstractSDDEAlgorithm, AbstractRODEAlgorithm, DAEInitializationAlgorithm,
67+
AbstractSteadyStateAlgorithm, AbstractODEProblem, AbstractDiscreteProblem,
68+
AbstractSDEProblem, AbstractRODEProblem, AbstractDDEProblem,
69+
AbstractDAEProblem, AbstractSDDEProblem, AbstractBVProblem,
70+
AbstractTimeseriesSolution, AbstractNoTimeSolution, numargs,
71+
AbstractODEFunction, AbstractSDEFunction, AbstractRODEFunction,
72+
AbstractDDEFunction, AbstractSDDEFunction, AbstractDAEFunction,
73+
AbstractNonlinearFunction, AbstractEnsembleSolution,
74+
AbstractODESolution, AbstractRODESolution, AbstractDAESolution,
75+
AbstractDDESolution,
76+
EnsembleAlgorithm, EnsembleSolution, EnsembleSummary,
77+
NonlinearSolution,
78+
TimeGradientWrapper, TimeDerivativeWrapper, UDerivativeWrapper,
79+
UJacobianWrapper, ParamJacobianWrapper, JacobianWrapper,
80+
check_error!, has_jac, has_tgrad, has_Wfact, has_Wfact_t, has_paramjac,
81+
AbstractODEIntegrator, AbstractSDEIntegrator, AbstractRODEIntegrator,
82+
AbstractDDEIntegrator, AbstractSDDEIntegrator,
83+
AbstractDAEIntegrator, unwrap_cache, has_reinit, reinit!,
84+
postamble!, last_step_failed, islinear, has_stats,
85+
initialize_dae!, build_solution, solution_new_retcode,
86+
solution_new_tslocation, plot_indices,
87+
NullParameters, isinplace, AbstractADType, AbstractDiscretization,
88+
DISCRETE_OUTOFPLACE_DEFAULT, DISCRETE_INPLACE_DEFAULT,
89+
has_analytic, calculate_solution_errors!, AbstractNoiseProcess,
90+
has_colorvec, parameterless_type, undefined_exports,
91+
is_diagonal_noise, AbstractDiffEqFunction, sensitivity_solution,
92+
interp_summary, AbstractHistoryFunction, LinearInterpolation,
93+
ConstantInterpolation, HermiteInterpolation, SensitivityInterpolation,
94+
NoAD, @add_kwonly,
95+
calculate_ensemble_errors, DEFAULT_UPDATE_FUNC, isconstant,
96+
DEFAULT_REDUCTION, isautodifferentiable,
97+
isadaptive, isdiscrete, has_syms, AbstractAnalyticalSolution,
98+
RECOMPILE_BY_DEFAULT, wrap_sol, has_destats
99+
100+
import SciMLBase: solve, init, step!, solve!, __init, __solve, update_coefficients!,
101+
update_coefficients, isadaptive, wrapfun_oop, wrapfun_iip,
102+
unwrap_fw, promote_tspan, set_u!, set_t!, set_ut!
103+
104+
import SciMLBase: AbstractDiffEqLinearOperator # deprecation path
105+
106+
import Tricks
107+
end
21108

22109
using Reexport
110+
Reexport.@reexport using SciMLBase
23111

24-
using Statistics
25-
26-
using FastBroadcast: @.., True, False
27-
28-
using Static: reduce_tup
29-
30-
import ChainRulesCore
31-
import RecursiveArrayTools
32-
import SparseArrays
33-
import TruncatedStacktraces
34-
35-
import ChainRulesCore: NoTangent, @non_differentiable
36-
import ZygoteRules
37-
38-
using Setfield
39-
40-
using ForwardDiff
41-
42-
using EnumX
43-
44-
using Markdown
45-
46-
# Could be made optional/glue
47-
import PreallocationTools
48-
49-
import FunctionWrappersWrappers
50-
@reexport using SciMLBase
51-
52-
using SciMLOperators: AbstractSciMLOperator, AbstractSciMLScalarOperator
53-
54-
using SciMLBase: @def, DEIntegrator, DEProblem,
55-
AbstractDiffEqInterpolation,
56-
DECallback, AbstractDEOptions, DECache, AbstractContinuousCallback,
57-
AbstractDiscreteCallback, AbstractLinearProblem, AbstractNonlinearProblem,
58-
AbstractOptimizationProblem, AbstractSteadyStateProblem,
59-
AbstractJumpProblem,
60-
AbstractNoiseProblem, AbstractEnsembleProblem, AbstractDynamicalODEProblem,
61-
DEAlgorithm, StandardODEProblem, AbstractIntegralProblem,
62-
AbstractSensitivityAlgorithm, AbstractODEAlgorithm,
63-
AbstractSDEAlgorithm, AbstractDDEAlgorithm, AbstractDAEAlgorithm,
64-
AbstractSDDEAlgorithm, AbstractRODEAlgorithm, DAEInitializationAlgorithm,
65-
AbstractSteadyStateAlgorithm, AbstractODEProblem, AbstractDiscreteProblem,
66-
AbstractSDEProblem, AbstractRODEProblem, AbstractDDEProblem,
67-
AbstractDAEProblem, AbstractSDDEProblem, AbstractBVProblem,
68-
AbstractTimeseriesSolution, AbstractNoTimeSolution, numargs,
69-
AbstractODEFunction, AbstractSDEFunction, AbstractRODEFunction,
70-
AbstractDDEFunction, AbstractSDDEFunction, AbstractDAEFunction,
71-
AbstractNonlinearFunction, AbstractEnsembleSolution,
72-
AbstractODESolution, AbstractRODESolution, AbstractDAESolution,
73-
AbstractDDESolution,
74-
EnsembleAlgorithm, EnsembleSolution, EnsembleSummary,
75-
NonlinearSolution,
76-
TimeGradientWrapper, TimeDerivativeWrapper, UDerivativeWrapper,
77-
UJacobianWrapper, ParamJacobianWrapper, JacobianWrapper,
78-
check_error!, has_jac, has_tgrad, has_Wfact, has_Wfact_t, has_paramjac,
79-
AbstractODEIntegrator, AbstractSDEIntegrator, AbstractRODEIntegrator,
80-
AbstractDDEIntegrator, AbstractSDDEIntegrator,
81-
AbstractDAEIntegrator, unwrap_cache, has_reinit, reinit!,
82-
postamble!, last_step_failed, islinear, has_stats,
83-
initialize_dae!, build_solution, solution_new_retcode,
84-
solution_new_tslocation, plot_indices,
85-
NullParameters, isinplace, AbstractADType, AbstractDiscretization,
86-
DISCRETE_OUTOFPLACE_DEFAULT, DISCRETE_INPLACE_DEFAULT,
87-
has_analytic, calculate_solution_errors!, AbstractNoiseProcess,
88-
has_colorvec, parameterless_type, undefined_exports,
89-
is_diagonal_noise, AbstractDiffEqFunction, sensitivity_solution,
90-
interp_summary, AbstractHistoryFunction, LinearInterpolation,
91-
ConstantInterpolation, HermiteInterpolation, SensitivityInterpolation,
92-
NoAD, @add_kwonly,
93-
calculate_ensemble_errors, DEFAULT_UPDATE_FUNC, isconstant,
94-
DEFAULT_REDUCTION, isautodifferentiable,
95-
isadaptive, isdiscrete, has_syms, AbstractAnalyticalSolution,
96-
RECOMPILE_BY_DEFAULT, wrap_sol, has_destats
97-
98-
import SciMLBase: solve, init, step!, solve!, __init, __solve, update_coefficients!,
99-
update_coefficients, isadaptive, wrapfun_oop, wrapfun_iip,
100-
unwrap_fw, promote_tspan, set_u!, set_t!, set_ut!
101-
102-
import SciMLBase: AbstractDiffEqLinearOperator # deprecation path
103-
104-
import Tricks
105112
SciMLBase.isfunctionwrapper(x::FunctionWrapper) = true
106113

107114
"""

src/solve.jl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,21 @@ function Base.showerror(io::IO, e::NoTspanError)
174174
println(io, TruncatedStacktraces.VERBOSE_MSG)
175175
end
176176

177+
const NAN_TSPAN_MESSAGE = """
178+
NaN tspan is set in the problem or chosen in the init/solve call.
179+
Note that -Inf and Inf values are allowed in the timespan for solves
180+
which are terminated via callbacks, however NaN values are not allowed
181+
since the direction of time is undetermined.
182+
"""
183+
184+
struct NaNTspanError <: Exception end
185+
186+
function Base.showerror(io::IO, e::NaNTspanError)
187+
print(io, NAN_TSPAN_MESSAGE)
188+
println(io, TruncatedStacktraces.VERBOSE_MSG)
189+
end
190+
191+
177192
const NON_SOLVER_MESSAGE = """
178193
The arguments to solve are incorrect.
179194
The second argument must be a solver choice, `solve(prob,alg)`
@@ -1197,6 +1212,8 @@ function get_concrete_tspan(prob, isadapt, kwargs, p)
11971212

11981213
isadapt && eltype(tspan) <: Integer && (tspan = float.(tspan))
11991214

1215+
any(isnan, tspan) && throw(NaNTspanError())
1216+
12001217
tspan
12011218
end
12021219

test/downstream/solve_error_handling.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ prob = ODEProblem{false}(f, 1.0 + im, tspan)
2828
prob = ODEProblem{false}(f, u0, (nothing, nothing))
2929
@test_throws DiffEqBase.NoTspanError solve(prob, Tsit5())
3030

31+
prob = ODEProblem{false}(f, u0, (NaN, 1.0))
32+
@test_throws DiffEqBase.NaNTspanError solve(prob, Tsit5())
33+
34+
prob = ODEProblem{false}(f, u0, (1.0, NaN))
35+
@test_throws DiffEqBase.NaNTspanError solve(prob, Tsit5())
36+
3137
prob = ODEProblem{false}(f, Any[1.0, 1.0f0], tspan)
3238
@test_throws DiffEqBase.NonConcreteEltypeError solve(prob, Tsit5())
3339

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ end
104104
@time @safetestset "Table Inference Tests" begin
105105
include("downstream/tables.jl")
106106
end
107-
@time @safetestset "Default linsolve with structure" begin
107+
VERSION >= v"1.7" && @time @safetestset "Default linsolve with structure" begin
108108
include("downstream/default_linsolve_structure.jl")
109109
end
110110
@time @safetestset "Callback Merging Tests" begin

0 commit comments

Comments
 (0)