Skip to content

Commit 01398cc

Browse files
committed
Remove UnPack
1 parent 82c3e0b commit 01398cc

23 files changed

+280
-282
lines changed

Project.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "StochasticDiffEq"
22
uuid = "789caeaf-c7a9-5a7d-9973-96adeb23e2a0"
33
authors = ["Chris Rackauckas <[email protected]>"]
4-
version = "6.85.0"
4+
version = "6.86.0"
55

66
[deps]
77
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
@@ -30,7 +30,6 @@ SciMLOperators = "c0aeaf25-5076-4817-a8d5-81caf7dfa961"
3030
SimpleNonlinearSolve = "727e6d20-b764-4bd8-a329-72de5adea6c7"
3131
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
3232
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
33-
UnPack = "3a884ed6-31ef-47d7-9d2a-63182c4928ed"
3433

3534
[compat]
3635
ADTypes = "1"
@@ -61,7 +60,6 @@ SciMLOperators = "0.2.9, 0.3, 0.4, 1"
6160
SimpleNonlinearSolve = "2"
6261
SparseArrays = "1.6"
6362
StaticArrays = "0.11, 0.12, 1.0"
64-
UnPack = "0.1, 1.0"
6563
julia = "1.10"
6664

6765
[extras]

src/SROCK_utils.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# (absolute value wise) by power iteration.
33
function maxeig!(integrator, cache::StochasticDiffEqConstantCache)
44
isfirst = integrator.iter == 1 || integrator.u_modified
5-
@unpack t, dt, uprev, u, p = integrator
5+
(; t, dt, uprev, u, p) = integrator
66
maxiter = 50
77
safe = 1.2
88
fsalfirst = integrator.f(uprev, p, t)
@@ -73,7 +73,7 @@ end
7373

7474
function maxeig!(integrator, cache::StochasticDiffEqMutableCache)
7575
isfirst = integrator.iter == 1 || integrator.u_modified
76-
@unpack t, dt, uprev, u, p = integrator
76+
(; t, dt, uprev, u, p) = integrator
7777
fz, z, fsalfirst = cache.atmp, cache.tmp, cache.fsalfirst
7878
integrator.f(fsalfirst, uprev, p, t)
7979
ccache = cache.constantcache

src/StochasticDiffEq.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import OrdinaryDiffEqCore: default_controller, isstandard, ispredictive,
1919
step_accept_controller!,
2020
step_reject_controller!, PIController, DummyController, issplit
2121

22-
using UnPack, RecursiveArrayTools, DataStructures
22+
using RecursiveArrayTools, DataStructures
2323
using DiffEqNoiseProcess, Random, ArrayInterface
2424
using SimpleNonlinearSolve, ForwardDiff, StaticArrays, MuladdMacro, FiniteDiff, Base.Threads
2525
using Adapt

src/caches/rossler_caches.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ struct SRIConstantCache{VType1, VType2, MType, uType} <: StochasticDiffEqConstan
1717
end
1818

1919
function SRIConstantCache(tableau, rate_prototype, error_terms)
20-
@unpack c₀, c₁, A₀, A₁, B₀, B₁, α, β₁, β₂, β₃, β₄ = tableau
20+
(; c₀, c₁, A₀, A₁, B₀, B₁, α, β₁, β₂, β₃, β₄) = tableau
2121
stages = length(α)
2222
H0 = Array{typeof(rate_prototype)}(undef, stages)
2323
H1 = Array{typeof(rate_prototype)}(undef, stages)

src/caches/sra_caches.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ struct SRAConstantCache{VType1, VType2, MType, uType} <: StochasticDiffEqConstan
344344
end
345345

346346
function SRAConstantCache(tableau, rate_prototype)
347-
@unpack c₀, c₁, A₀, B₀, α, β₁, β₂ = tableau
347+
(; c₀, c₁, A₀, B₀, α, β₁, β₂) = tableau
348348
stages = length(α)
349349
H0 = Vector{typeof(rate_prototype)}(undef, stages)
350350
SRAConstantCache(c₀, c₁, A₀', B₀', α, β₁, β₂, stages, H0)

src/dense.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ Get the value at tvals where the solution is known at the
105105
times ts (sorted), with values timeseries and derivatives ks
106106
"""
107107
function sde_interpolation(tvals, id, idxs, deriv, p, continuity::Symbol = :left)
108-
@unpack ts, timeseries = id
108+
(; ts, timeseries) = id
109109
@inbounds tdir = sign(ts[end]-ts[1])
110110
idx = sortperm(tvals, rev = tdir<0)
111111

@@ -150,7 +150,7 @@ Get the value at tval where the solution is known at the
150150
times ts (sorted), with values timeseries and derivatives ks
151151
"""
152152
function sde_interpolation(tval::Number, id, idxs, deriv, p, continuity::Symbol = :left)
153-
@unpack ts, timeseries = id
153+
(; ts, timeseries) = id
154154
@inbounds tdir = sign(ts[end]-ts[1])
155155

156156
if continuity === :left
@@ -177,7 +177,7 @@ end
177177

178178
function sde_interpolation!(
179179
out, tval::Number, id, idxs, deriv, p, continuity::Symbol = :left)
180-
@unpack ts, timeseries = id
180+
(; ts, timeseries) = id
181181
@inbounds tdir = sign(ts[end]-ts[1])
182182

183183
if continuity === :left
@@ -203,7 +203,7 @@ function sde_interpolation!(
203203
end
204204

205205
function sde_interpolation!(vals, tvals, id, idxs, deriv, p, continuity::Symbol = :left)
206-
@unpack ts, timeseries = id
206+
(; ts, timeseries) = id
207207
@inbounds tdir = sign(ts[end]-ts[1])
208208
idx = sortperm(tvals, rev = tdir<0)
209209

src/iterated_integrals.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function get_iterated_I(dt, dW, dZ, alg::JDiagonal_oop, p = nothing, c = 1, γ =
3131
end
3232

3333
function get_iterated_I!(dt, dW, dZ, alg::JDiagonal_iip, p = nothing, c = 1, γ = 1//1)
34-
@unpack J = alg
34+
(; J) = alg
3535
if dW isa Number
3636
alg.J = 1//2 .* dW .^ 2
3737
else
@@ -46,7 +46,7 @@ function get_iterated_I(dt, dW, dZ, alg::JCommute_oop, p = nothing, c = 1, γ =
4646
end
4747

4848
function get_iterated_I!(dt, dW, dZ, alg::JCommute_iip, p = nothing, c = 1, γ = 1//1)
49-
@unpack J = alg
49+
(; J) = alg
5050
mul!(J, vec(dW), vec(dW)')
5151
@.. J *= 1//2
5252
return nothing
@@ -76,7 +76,7 @@ end
7676

7777
function get_iterated_I!(
7878
dt, dW, dZ, alg::IteratedIntegralAlgorithm_iip, p = nothing, c = 1, γ = 1//1)
79-
@unpack J, levyalg = alg
79+
(; J, levyalg) = alg
8080
if isnothing(p)
8181
ε = c * dt^+ 1//2)
8282
p = terms_needed(length(dW), dt, ε, levyalg, MaxL2())

src/perform_step/SROCK_perform_step.jl

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@muladd function perform_step!(integrator, cache::SROCK1ConstantCache)
2-
@unpack t, dt, uprev, u, W, p, f = integrator
2+
(; t, dt, uprev, u, W, p, f) = integrator
33

44
alg = unwrap_alg(integrator, true)
55
alg.eigen_est === nothing ? maxeig!(integrator, cache) : alg.eigen_est(integrator)
@@ -95,8 +95,8 @@
9595
end
9696

9797
@muladd function perform_step!(integrator, cache::SROCK1Cache)
98-
@unpack uᵢ₋₁, uᵢ₋₂, k, gₘ₋₁, gₘ₋₂ = cache
99-
@unpack t, dt, uprev, u, W, p, f = integrator
98+
(; uᵢ₋₁, uᵢ₋₂, k, gₘ₋₁, gₘ₋₂) = cache
99+
(; t, dt, uprev, u, W, p, f) = integrator
100100
ccache = cache.constantcache
101101
alg = unwrap_alg(integrator, true)
102102
alg.eigen_est === nothing ? maxeig!(integrator, cache) : alg.eigen_est(integrator)
@@ -190,8 +190,8 @@ end
190190
end
191191

192192
@muladd function perform_step!(integrator, cache::SROCK2ConstantCache)
193-
@unpack t, dt, uprev, u, W, p, f = integrator
194-
@unpack recf, recf2, mα, mσ, mτ = cache
193+
(; t, dt, uprev, u, W, p, f) = integrator
194+
(; recf, recf2, mα, mσ, mτ) = cache
195195

196196
gen_prob = !((is_diagonal_noise(integrator.sol.prob)) || (W.dW isa Number) ||
197197
(length(W.dW) == 1))
@@ -323,11 +323,11 @@ end
323323
end
324324

325325
@muladd function perform_step!(integrator, cache::SROCK2Cache)
326-
@unpack uᵢ, uₓ, uᵢ₋₁, uᵢ₋₂, k, Gₛ, Gₛ₁, vec_χ, WikRange = cache
326+
(; uᵢ, uₓ, uᵢ₋₁, uᵢ₋₂, k, Gₛ, Gₛ₁, vec_χ, WikRange) = cache
327327

328-
@unpack t, dt, uprev, u, W, p, f = integrator
328+
(; t, dt, uprev, u, W, p, f) = integrator
329329

330-
@unpack recf, recf2, mα, mσ, mτ = cache.constantcache
330+
(; recf, recf2, mα, mσ, mτ) = cache.constantcache
331331
ccache = cache.constantcache
332332
gen_prob = !((is_diagonal_noise(integrator.sol.prob)) || (W.dW isa Number) ||
333333
(length(W.dW) == 1))
@@ -476,7 +476,7 @@ end
476476
end
477477

478478
@muladd function perform_step!(integrator, cache::SROCKEMConstantCache)
479-
@unpack t, dt, uprev, u, W, p, f = integrator
479+
(; t, dt, uprev, u, W, p, f) = integrator
480480

481481
alg = unwrap_alg(integrator, true)
482482
alg.eigen_est === nothing ? maxeig!(integrator, cache) : alg.eigen_est(integrator)
@@ -567,8 +567,8 @@ end
567567
end
568568

569569
@muladd function perform_step!(integrator, cache::SROCKEMCache)
570-
@unpack uᵢ₋₁, uᵢ₋₂, tmp, k, Gₛ, Gₛ₁, WikRange = cache
571-
@unpack t, dt, uprev, u, W, p, f = integrator
570+
(; uᵢ₋₁, uᵢ₋₂, tmp, k, Gₛ, Gₛ₁, WikRange) = cache
571+
(; t, dt, uprev, u, W, p, f) = integrator
572572
ccache = cache.constantcache
573573
alg = unwrap_alg(integrator, true)
574574
alg.eigen_est === nothing ? maxeig!(integrator, cache) : alg.eigen_est(integrator)
@@ -662,7 +662,7 @@ end
662662
end
663663

664664
@muladd function perform_step!(integrator, cache::SKSROCKConstantCache)
665-
@unpack t, dt, uprev, u, W, p, f = integrator
665+
(; t, dt, uprev, u, W, p, f) = integrator
666666

667667
alg = unwrap_alg(integrator, true)
668668
alg.eigen_est === nothing ? maxeig!(integrator, cache) : alg.eigen_est(integrator)
@@ -747,8 +747,8 @@ end
747747
end
748748

749749
@muladd function perform_step!(integrator, cache::SKSROCKCache)
750-
@unpack uᵢ₋₁, uᵢ₋₂, k, Gₛ, WikRange = cache
751-
@unpack t, dt, uprev, u, W, p, f = integrator
750+
(; uᵢ₋₁, uᵢ₋₂, k, Gₛ, WikRange) = cache
751+
(; t, dt, uprev, u, W, p, f) = integrator
752752

753753
ccache = cache.constantcache
754754
alg = unwrap_alg(integrator, true)
@@ -838,8 +838,8 @@ end
838838
end
839839

840840
@muladd function perform_step!(integrator, cache::TangXiaoSROCK2ConstantCache)
841-
@unpack t, dt, uprev, u, W, p, f = integrator
842-
@unpack recf, recf2, mα, mσ, mτ, mn̂, c1, c2 = cache
841+
(; t, dt, uprev, u, W, p, f) = integrator
842+
(; recf, recf2, mα, mσ, mτ, mn̂, c1, c2) = cache
843843

844844
= mn̂[integrator.alg.version_num]
845845

@@ -1000,9 +1000,9 @@ end
10001000
end
10011001

10021002
@muladd function perform_step!(integrator, cache::TangXiaoSROCK2Cache)
1003-
@unpack uᵢ, uₓ, uᵢ₋₁, uᵢ₋₂, Û₁, Û₂, k, Gₛ, Gₛ₁ = cache
1004-
@unpack t, dt, uprev, u, W, p, f = integrator
1005-
@unpack recf, recf2, mα, mσ, mτ, mn̂, c1, c2 = cache.constantcache
1003+
(; uᵢ, uₓ, uᵢ₋₁, uᵢ₋₂, Û₁, Û₂, k, Gₛ, Gₛ₁) = cache
1004+
(; t, dt, uprev, u, W, p, f) = integrator
1005+
(; recf, recf2, mα, mσ, mτ, mn̂, c1, c2) = cache.constantcache
10061006

10071007
= mn̂[integrator.alg.version_num]
10081008
ccache = cache.constantcache
@@ -1148,8 +1148,8 @@ end
11481148
end
11491149

11501150
@muladd function perform_step!(integrator, cache::KomBurSROCK2ConstantCache)
1151-
@unpack t, dt, uprev, u, W, p, f = integrator
1152-
@unpack recf, mσ, mτ, mδ = cache
1151+
(; t, dt, uprev, u, W, p, f) = integrator
1152+
(; recf, mσ, mτ, mδ) = cache
11531153

11541154
gen_prob = !((is_diagonal_noise(integrator.sol.prob)) || (W.dW isa Number) ||
11551155
(length(W.dW) == 1))
@@ -1345,10 +1345,10 @@ end
13451345
end
13461346

13471347
@muladd function perform_step!(integrator, cache::KomBurSROCK2Cache)
1348-
@unpack utmp, uᵢ₋₁, uᵢ₋₂, k, yₛ₋₁, yₛ₋₂, yₛ₋₃, SXₛ₋₁, SXₛ₋₂,
1349-
SXₛ₋₃, Gₛ, Xₛ₋₁, Xₛ₋₂, Xₛ₋₃, vec_χ = cache
1350-
@unpack t, dt, uprev, u, W, p, f = integrator
1351-
@unpack recf, mσ, mτ, mδ = cache.constantcache
1348+
(; utmp, uᵢ₋₁, uᵢ₋₂, k, yₛ₋₁, yₛ₋₂, yₛ₋₃, SXₛ₋₁, SXₛ₋₂,
1349+
SXₛ₋₃, Gₛ, Xₛ₋₁, Xₛ₋₂, Xₛ₋₃, vec_χ) = cache
1350+
(; t, dt, uprev, u, W, p, f) = integrator
1351+
(; recf, mσ, mτ, mδ) = cache.constantcache
13521352

13531353
ccache = cache.constantcache
13541354
gen_prob = !((is_diagonal_noise(integrator.sol.prob)) || (W.dW isa Number) ||
@@ -1572,8 +1572,8 @@ end
15721572
end
15731573

15741574
@muladd function perform_step!(integrator, cache::SROCKC2ConstantCache)
1575-
@unpack t, dt, uprev, u, W, p, f = integrator
1576-
@unpack recf, mσ, mτ = cache
1575+
(; t, dt, uprev, u, W, p, f) = integrator
1576+
(; recf, mσ, mτ) = cache
15771577

15781578
alg = unwrap_alg(integrator, true)
15791579
alg.eigen_est === nothing ? maxeig!(integrator, cache) : alg.eigen_est(integrator)
@@ -1655,10 +1655,10 @@ end
16551655
end
16561656

16571657
@muladd function perform_step!(integrator, cache::SROCKC2Cache)
1658-
@unpack uᵢ, tmp, uᵢ₋₁, uᵢ₋₂, k, Gₛ, Gₛ₁, WikRange = cache
1659-
@unpack t, dt, uprev, u, W, p, f = integrator
1658+
(; uᵢ, tmp, uᵢ₋₁, uᵢ₋₂, k, Gₛ, Gₛ₁, WikRange) = cache
1659+
(; t, dt, uprev, u, W, p, f) = integrator
16601660

1661-
@unpack recf, mσ, mτ = cache.constantcache
1661+
(; recf, mσ, mτ) = cache.constantcache
16621662
ccache = cache.constantcache
16631663

16641664
alg = unwrap_alg(integrator, true)

src/perform_step/dynamical.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function throwex(integrator)
1212
end
1313

1414
function initialize!(integrator, cache::BAOABConstantCache)
15-
@unpack t, dt, uprev, u, p, W = integrator
15+
(; t, dt, uprev, u, p, W) = integrator
1616
du1 = integrator.uprev.x[1]
1717
u1 = integrator.uprev.x[2]
1818

@@ -21,7 +21,7 @@ function initialize!(integrator, cache::BAOABConstantCache)
2121
end
2222

2323
function initialize!(integrator, cache::BAOABCache)
24-
@unpack t, dt, uprev, u, p, W = integrator
24+
(; t, dt, uprev, u, p, W) = integrator
2525
du1 = integrator.uprev.x[1]
2626
u1 = integrator.uprev.x[2]
2727

@@ -30,8 +30,8 @@ function initialize!(integrator, cache::BAOABCache)
3030
end
3131

3232
@muladd function perform_step!(integrator, cache::BAOABConstantCache)
33-
@unpack t, dt, sqdt, uprev, u, p, W, f = integrator
34-
@unpack half, c1, c2 = cache
33+
(; t, dt, sqdt, uprev, u, p, W, f) = integrator
34+
(; half, c1, c2) = cache
3535
du1 = uprev.x[1]
3636
u1 = uprev.x[2]
3737

@@ -56,8 +56,8 @@ end
5656
end
5757

5858
@muladd function perform_step!(integrator, cache::BAOABCache)
59-
@unpack t, dt, sqdt, uprev, u, p, W, f = integrator
60-
@unpack utmp, dutmp, k, gtmp, noise, half, c1, c2 = cache
59+
(; t, dt, sqdt, uprev, u, p, W, f) = integrator
60+
(; utmp, dutmp, k, gtmp, noise, half, c1, c2) = cache
6161
du1 = uprev.x[1]
6262
u1 = uprev.x[2]
6363

0 commit comments

Comments
 (0)