Skip to content

Commit d9ce06f

Browse files
Merge pull request #281 from ChrisRackauckas-Claude/fix-deprecations-20260208
Fix deprecation warnings
2 parents 09bc887 + 28c367f commit d9ce06f

1 file changed

Lines changed: 9 additions & 13 deletions

File tree

src/cost_functions.jl

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function (f::L2Loss)(sol::DiffEqBase.AbstractNoTimeSolution)
4848

4949
sumsq = 0.0
5050

51-
if weight == nothing
51+
if weight === nothing
5252
@inbounds for i in 1:length(sol)
5353
sumsq += (data[i] - sol[i])^2
5454
end
@@ -80,12 +80,12 @@ function (f::L2Loss)(sol::SciMLBase.AbstractSciMLSolution)
8080

8181
sumsq = 0.0
8282

83-
if weight == nothing
83+
if weight === nothing
8484
@inbounds for i in 1:length(sol)
8585
for j in 1:length(sol[i])
8686
sumsq += (data[j, i] - sol[j, i])^2
8787
end
88-
if diff_weight != nothing && i != 1
88+
if diff_weight !== nothing && i != 1
8989
for j in 1:length(sol[i])
9090
if diff_weight isa Real
9191
sumsq += diff_weight *
@@ -118,7 +118,7 @@ function (f::L2Loss)(sol::SciMLBase.AbstractSciMLSolution)
118118
sumsq = sumsq + ((data[j, i] - sol[j, i])^2) * weight[j, i]
119119
end
120120
end
121-
if diff_weight != nothing && i != 1
121+
if diff_weight !== nothing && i != 1
122122
for j in 1:length(sol[i])
123123
if diff_weight isa Real
124124
sumsq += diff_weight *
@@ -141,7 +141,7 @@ function (f::L2Loss)(sol::SciMLBase.AbstractSciMLSolution)
141141
end
142142
end
143143
end
144-
if colloc_grad != nothing
144+
if colloc_grad !== nothing
145145
for i in 1:size(colloc_grad)[2]
146146
sol.prob.f.f(@view(dudt[:, i]), sol.u[i], sol.prob.p, sol.t[i])
147147
end
@@ -162,7 +162,7 @@ function L2Loss(
162162
return L2Loss(
163163
t, matrixize(data), matrixize(differ_weight),
164164
matrixize(data_weight), matrixize(colloc_grad),
165-
colloc_grad == nothing ? nothing : zeros(size(colloc_grad))
165+
colloc_grad === nothing ? nothing : zeros(size(colloc_grad))
166166
)
167167
end
168168

@@ -218,7 +218,7 @@ function (f::LogLikeLoss)(sol::SciMLBase.AbstractSciMLSolution)
218218
end
219219
end
220220

221-
if f.diff_distributions != nothing
221+
if f.diff_distributions !== nothing
222222
distributions = f.diff_distributions
223223
diff_data = sol.u[2:end] - sol.u[1:(end - 1)]
224224
fill_length = length(f.t) - length(diff_data)
@@ -244,11 +244,7 @@ end
244244

245245
function (f::LogLikeLoss)(sol::DiffEqBase.AbstractEnsembleSolution)
246246
distributions = f.data_distributions
247-
if sol_tmp isa DiffEqBase.AbstractEnsembleSolution
248-
failure = any(!SciMLBase.successful_retcode(s.retcode) for s in sol_tmp)
249-
else
250-
failure = !SciMLBase.successful_retcode(sol_tmp.retcode)
251-
end
247+
failure = any(!SciMLBase.successful_retcode(s.retcode) for s in sol)
252248
failure && return Inf
253249
ll = 0.0
254250
if eltype(distributions) <: UnivariateDistribution
@@ -269,7 +265,7 @@ function (f::LogLikeLoss)(sol::DiffEqBase.AbstractEnsembleSolution)
269265
end
270266
end
271267

272-
if f.diff_distributions != nothing
268+
if f.diff_distributions !== nothing
273269
distributions = f.diff_distributions
274270
fdll = 0
275271
if eltype(distributions) <: UnivariateDistribution

0 commit comments

Comments
 (0)