Skip to content

Commit 76505f6

Browse files
authored
Merge branch 'master' into md-links
2 parents e78daf8 + 898f9ac commit 76505f6

File tree

7 files changed

+19
-29
lines changed

7 files changed

+19
-29
lines changed

Project.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "SciMLBase"
22
uuid = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
33
authors = ["Chris Rackauckas <[email protected]> and contributors"]
4-
version = "2.115.0"
4+
version = "2.116.2"
55

66
[deps]
77
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
@@ -57,6 +57,7 @@ SciMLBaseDistributionsExt = "Distributions"
5757
SciMLBaseForwardDiffExt = "ForwardDiff"
5858
SciMLBaseMLStyleExt = "MLStyle"
5959
SciMLBaseMakieExt = "Makie"
60+
SciMLBaseMeasurementsExt = "Measurements"
6061
SciMLBaseMonteCarloMeasurementsExt = "MonteCarloMeasurements"
6162
SciMLBaseMooncakeExt = "Mooncake"
6263
SciMLBasePartialFunctionsExt = "PartialFunctions"

ext/SciMLBaseMeasurementsExt.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
module SciMLBaseMeasurementsExt
22

33
using Measurements
4-
using SciMLBase: value
4+
using SciMLBase: SciMLBase
55

66
function SciMLBase.promote_u0(u0::AbstractArray{<:Measurements.Measurement},
77
p::AbstractArray{<:Measurements.Measurement}, t0)
88
u0
99
end
1010
SciMLBase.promote_u0(u0, p::AbstractArray{<:Measurements.Measurement}, t0) = eltype(p).(u0)
1111

12-
value(x::Type{Measurements.Measurement{T}}) where {T} = T
13-
value(x::Measurements.Measurement) = Measurements.value(x)
12+
SciMLBase.value(x::Type{Measurements.Measurement{T}}) where {T} = T
13+
SciMLBase.value(x::Measurements.Measurement) = Measurements.value(x)
1414

15-
unitfulvalue(x::Type{Measurements.Measurement{T}}) where {T} = T
16-
unitfulvalue(x::Measurements.Measurement) = Measurements.value(x)
15+
SciMLBase.unitfulvalue(x::Type{Measurements.Measurement{T}}) where {T} = T
16+
SciMLBase.unitfulvalue(x::Measurements.Measurement) = Measurements.value(x)
1717

1818
end

src/SciMLBase.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ using Distributed
1414
using Markdown
1515
using Printf
1616
import Preferences
17-
using PreallocationTools: get_tmp, DiffCache
17+
using PreallocationTools: get_tmp, DiffCache, FixedSizeDiffCache
1818

1919
import Logging, ArrayInterface
2020
import IteratorInterfaceExtensions

src/errors.jl

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,6 @@ function Base.showerror(io::IO, e::CommonKwargError)
120120
unrecognized = collect(keys(e.kwargs))[notin]
121121
print(io, "Unrecognized keyword arguments: ")
122122
printstyled(io, unrecognized; bold = true, color = :red)
123-
print(io, "\n\n")
124-
println(io, TruncatedStacktraces.VERBOSE_MSG)
125123
end
126124

127125
@enum KeywordArgError KeywordArgWarn KeywordArgSilent
@@ -147,7 +145,6 @@ struct IncompatibleInitialConditionError <: Exception end
147145

148146
function Base.showerror(io::IO, e::IncompatibleInitialConditionError)
149147
print(io, INCOMPATIBLE_U0_MESSAGE)
150-
println(io, TruncatedStacktraces.VERBOSE_MSG)
151148
end
152149

153150
const NO_DEFAULT_ALGORITHM_MESSAGE = """
@@ -164,7 +161,6 @@ struct NoDefaultAlgorithmError <: Exception end
164161

165162
function Base.showerror(io::IO, e::NoDefaultAlgorithmError)
166163
print(io, NO_DEFAULT_ALGORITHM_MESSAGE)
167-
println(io, TruncatedStacktraces.VERBOSE_MSG)
168164
end
169165

170166
const NO_TSPAN_MESSAGE = """
@@ -175,7 +171,6 @@ struct NoTspanError <: Exception end
175171

176172
function Base.showerror(io::IO, e::NoTspanError)
177173
print(io, NO_TSPAN_MESSAGE)
178-
println(io, TruncatedStacktraces.VERBOSE_MSG)
179174
end
180175

181176
const NAN_TSPAN_MESSAGE = """
@@ -189,7 +184,6 @@ struct NaNTspanError <: Exception end
189184

190185
function Base.showerror(io::IO, e::NaNTspanError)
191186
print(io, NAN_TSPAN_MESSAGE)
192-
println(io, TruncatedStacktraces.VERBOSE_MSG)
193187
end
194188

195189
const NON_SOLVER_MESSAGE = """
@@ -207,7 +201,6 @@ struct NonSolverError <: Exception end
207201

208202
function Base.showerror(io::IO, e::NonSolverError)
209203
print(io, NON_SOLVER_MESSAGE)
210-
println(io, TruncatedStacktraces.VERBOSE_MSG)
211204
end
212205

213206
const NOISE_SIZE_MESSAGE = """
@@ -235,7 +228,6 @@ function Base.showerror(io::IO, e::NoiseSizeIncompatabilityError)
235228
println(io, NOISE_SIZE_MESSAGE)
236229
println(io, "size(prob.noise_rate_prototype,2) = $(e.prototypesize)")
237230
println(io, "length(prob.noise.W[1]) = $(e.noisesize)")
238-
println(io, TruncatedStacktraces.VERBOSE_MSG)
239231
end
240232

241233
const PROBSOLVER_PAIRING_MESSAGE = """
@@ -256,7 +248,6 @@ function Base.showerror(io::IO, e::ProblemSolverPairingError)
256248
println(io, "Solver type: $(SciMLBase.__parameterless_type(typeof(e.alg)))")
257249
println(io,
258250
"Problem types compatible with the chosen solver: $(compatible_problem_types(e.prob,e.alg))")
259-
println(io, TruncatedStacktraces.VERBOSE_MSG)
260251
end
261252

262253
function compatible_problem_types(prob, alg)
@@ -297,7 +288,6 @@ struct DirectAutodiffError <: Exception end
297288

298289
function Base.showerror(io::IO, e::DirectAutodiffError)
299290
println(io, DIRECT_AUTODIFF_INCOMPATABILITY_MESSAGE)
300-
println(io, TruncatedStacktraces.VERBOSE_MSG)
301291
end
302292

303293
const NONNUMBER_ELTYPE_MESSAGE = """
@@ -336,7 +326,6 @@ end
336326
function Base.showerror(io::IO, e::NonNumberEltypeError)
337327
print(io, NONNUMBER_ELTYPE_MESSAGE)
338328
print(io, e.eltype)
339-
println(io, TruncatedStacktraces.VERBOSE_MSG)
340329
end
341330

342331
const GENERIC_NUMBER_TYPE_ERROR_MESSAGE = """
@@ -362,7 +351,6 @@ function Base.showerror(io::IO, e::GenericNumberTypeError)
362351
println(io, "Solver: $(e.alg)")
363352
println(io, "u0 type: $(e.uType)")
364353
print(io, "Timespan type: $(e.tType)")
365-
println(io, TruncatedStacktraces.VERBOSE_MSG)
366354
end
367355

368356
const COMPLEX_SUPPORT_ERROR_MESSAGE = """
@@ -381,7 +369,6 @@ end
381369
function Base.showerror(io::IO, e::ComplexSupportError)
382370
println(io, COMPLEX_SUPPORT_ERROR_MESSAGE)
383371
println(io, "Solver: $(e.alg)")
384-
println(io, TruncatedStacktraces.VERBOSE_MSG)
385372
end
386373

387374
const COMPLEX_TSPAN_ERROR_MESSAGE = """
@@ -396,7 +383,6 @@ struct ComplexTspanError <: Exception end
396383

397384
function Base.showerror(io::IO, e::ComplexTspanError)
398385
println(io, COMPLEX_TSPAN_ERROR_MESSAGE)
399-
println(io, TruncatedStacktraces.VERBOSE_MSG)
400386
end
401387

402388
const TUPLE_STATE_ERROR_MESSAGE = """
@@ -434,7 +420,6 @@ struct TupleStateError <: Exception end
434420

435421
function Base.showerror(io::IO, e::TupleStateError)
436422
println(io, TUPLE_STATE_ERROR_MESSAGE)
437-
println(io, TruncatedStacktraces.VERBOSE_MSG)
438423
end
439424

440425
const MASS_MATRIX_ERROR_MESSAGE = """
@@ -455,7 +440,6 @@ function Base.showerror(io::IO, e::IncompatibleMassMatrixError)
455440
println(io, e.sz)
456441
print(io, "length(u0): ")
457442
println(e.len)
458-
println(io, TruncatedStacktraces.VERBOSE_MSG)
459443
end
460444

461445
const LATE_BINDING_TSTOPS_ERROR_MESSAGE = """
@@ -468,5 +452,4 @@ struct LateBindingTstopsNotSupportedError <: Exception end
468452

469453
function Base.showerror(io::IO, e::LateBindingTstopsNotSupportedError)
470454
println(io, LATE_BINDING_TSTOPS_ERROR_MESSAGE)
471-
println(io, TruncatedStacktraces.VERBOSE_MSG)
472455
end

src/scimlfunctions.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2261,7 +2261,7 @@ All of the remaining functions are optional for improving or accelerating
22612261
the usage of `f` and `bc`. These include:
22622262
22632263
- `cost(u, p)`: the target to be minimized, similar with the `cost` function
2264-
in [`OptimizationFunction`](@ref). This is used to define the objective function
2264+
in `OptimizationFunction`. This is used to define the objective function
22652265
of the BVP, which can be minimized by optimization solvers.
22662266
- `equality(res, u, t)`: equality constraints functions for the BVP.
22672267
- `inequality(res, u, t)`: inequality constraints functions for the BVP.
@@ -4279,7 +4279,6 @@ function OptimizationFunction{iip}(f, adtype::AbstractADType = NoAD();
42794279
lag_hess_colorvec = nothing,
42804280
initialization_data = __has_initialization_data(f) ? f.initialization_data :
42814281
nothing) where {iip}
4282-
isinplace(f, 2; has_two_dispatches = false, isoptimization = true)
42834282
sys = sys_or_symbolcache(sys, syms, paramsyms)
42844283
OptimizationFunction{
42854284
iip, typeof(adtype), typeof(f), typeof(grad), typeof(fg), typeof(hess),
@@ -4948,6 +4947,7 @@ __has_Wfact(f) = hasfield(typeof(f), :Wfact)
49484947
__has_Wfact_t(f) = hasfield(typeof(f), :Wfact_t)
49494948
__has_W_prototype(f) = hasfield(typeof(f), :W_prototype)
49504949
__has_paramjac(f) = hasfield(typeof(f), :paramjac)
4950+
__has_controljac(f) = hasfield(typeof(f), :controljac)
49514951
__has_jac_prototype(f) = hasfield(typeof(f), :jac_prototype)
49524952
__has_controljac_prototype(f) = hasfield(typeof(f), :controljac_prototype)
49534953
__has_sparsity(f) = hasfield(typeof(f), :sparsity)

src/solve.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ end
2929
function Base.showerror(io::IO, e::NonConcreteEltypeError)
3030
print(io, NONCONCRETE_ELTYPE_MESSAGE)
3131
print(io, e.eltype)
32-
println(io, TruncatedStacktraces.VERBOSE_MSG)
3332
end
3433

3534
# Skip the DiffEqBase handling
@@ -462,6 +461,7 @@ end
462461

463462
anyeltypedual(x) = anyeltypedual(x, Val{0})
464463
anyeltypedual(x, counter) = Any
464+
anyeltypedual(x::FixedSizeDiffCache, counter = 0) = Any
465465

466466
value(x) = x
467467
unitfulvalue(x) = x
@@ -530,7 +530,6 @@ struct AdjointNotFoundError <: Exception end
530530

531531
function Base.showerror(io::IO, e::AdjointNotFoundError)
532532
print(io, ADJOINT_NOT_FOUND_MESSAGE)
533-
println(io, TruncatedStacktraces.VERBOSE_MSG)
534533
end
535534

536535
function _concrete_solve_adjoint(args...; kwargs...)
@@ -547,7 +546,6 @@ struct ForwardSensitivityNotFoundError <: Exception end
547546

548547
function Base.showerror(io::IO, e::ForwardSensitivityNotFoundError)
549548
print(io, FORWARD_SENSITIVITY_NOT_FOUND_MESSAGE)
550-
println(io, TruncatedStacktraces.VERBOSE_MSG)
551549
end
552550

553551
function _concrete_solve_forward(args...; kwargs...)

test/function_building_error_messages.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,14 @@ optf(u, p) = 1.0
507507
OptimizationFunction(optf)
508508
OptimizationProblem(optf, 1.0)
509509

510+
# Test OptimizationFunction{iip} respects explicit iip parameter
511+
# This function would fail isinplace check due to method ambiguity
512+
struct ProblematicOptFunction end
513+
(::ProblematicOptFunction)(x, p) = sum(x .^ 2)
514+
# But when iip is explicitly provided, it should work without calling isinplace
515+
@test_nowarn OptimizationFunction{false}(ProblematicOptFunction())
516+
@test_nowarn OptimizationFunction{true}(ProblematicOptFunction())
517+
510518
# BVPFunction
511519

512520
bfoop(u, p, t) = u

0 commit comments

Comments
 (0)