Skip to content

Commit e1fd9b1

Browse files
committed
Remove UnPack
1 parent 5fa4efd commit e1fd9b1

File tree

8 files changed

+17
-21
lines changed

8 files changed

+17
-21
lines changed

Project.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "LinearSolve"
22
uuid = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae"
33
authors = ["SciML"]
4-
version = "3.48.1"
4+
version = "3.49.0"
55

66
[deps]
77
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
@@ -27,7 +27,6 @@ SciMLLogging = "a6db7da4-7206-11f0-1eab-35f2a5dbe1d1"
2727
SciMLOperators = "c0aeaf25-5076-4817-a8d5-81caf7dfa961"
2828
Setfield = "efcf1570-3423-57d1-acb7-fd33fddbac46"
2929
StaticArraysCore = "1e83bf80-4336-4d27-bf5d-d5a4f845583c"
30-
UnPack = "3a884ed6-31ef-47d7-9d2a-63182c4928ed"
3130

3231
[weakdeps]
3332
AMDGPU = "21141c5a-9bdb-4563-92ae-f87d6854732e"
@@ -138,7 +137,6 @@ StableRNGs = "1.0"
138137
StaticArrays = "1.9"
139138
StaticArraysCore = "1.4.3"
140139
Test = "1.10"
141-
UnPack = "1.0.2"
142140
Zygote = "0.7"
143141
blis_jll = "0.9.0"
144142
julia = "1.10"

ext/LinearSolveHYPREExt.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ using LinearSolve: HYPREAlgorithm, LinearCache, LinearProblem, LinearSolve,
88
__conditioning, LinearSolveAdjoint, LinearVerbosity
99
using SciMLLogging: SciMLLogging, verbosity_to_int, @SciMLMessage
1010
using SciMLBase: LinearProblem, LinearAliasSpecifier, SciMLBase
11-
using UnPack: @unpack
1211
using Setfield: @set!
1312

1413
mutable struct HYPRECache
@@ -71,7 +70,7 @@ function SciMLBase.init(prob::LinearProblem, alg::HYPREAlgorithm,
7170
assumptions = OperatorAssumptions(),
7271
sensealg = LinearSolveAdjoint(),
7372
kwargs...)
74-
@unpack A, b, u0, p = prob
73+
(; A, b, u0, p) = prob
7574

7675
if haskey(kwargs, :alias_A) || haskey(kwargs, :alias_b)
7776
aliases = LinearAliasSpecifier()

ext/LinearSolvePardisoExt.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module LinearSolvePardisoExt
33
using Pardiso, LinearSolve
44
using SparseArrays
55
using SparseArrays: nonzeros, rowvals, getcolptr
6-
using LinearSolve: PardisoJL, @unpack, LinearVerbosity
6+
using LinearSolve: PardisoJL, LinearVerbosity
77
using SciMLLogging: SciMLLogging, @SciMLMessage, verbosity_to_bool
88
using LinearSolve.SciMLBase
99

@@ -22,7 +22,7 @@ function LinearSolve.init_cacheval(alg::PardisoJL,
2222
reltol,
2323
verbose::Union{LinearVerbosity, Bool},
2424
assumptions::LinearSolve.OperatorAssumptions)
25-
@unpack nprocs, solver_type, matrix_type, cache_analysis, iparm, dparm, vendor = alg
25+
(; nprocs, solver_type, matrix_type, cache_analysis, iparm, dparm, vendor) = alg
2626
A = convert(AbstractMatrix, A)
2727

2828
if isnothing(vendor)
@@ -137,7 +137,7 @@ function LinearSolve.init_cacheval(alg::PardisoJL,
137137
end
138138

139139
function SciMLBase.solve!(cache::LinearSolve.LinearCache, alg::PardisoJL; kwargs...)
140-
@unpack A, b, u = cache
140+
(; A, b, u) = cache
141141
A = convert(AbstractMatrix, A)
142142
if cache.isfresh
143143
phase = alg.cache_analysis ? Pardiso.NUM_FACT : Pardiso.ANALYSIS_NUM_FACT

src/LinearSolve.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ using SciMLOperators: SciMLOperators, AbstractSciMLOperator, IdentityOperator,
2424
using SciMLLogging: SciMLLogging, @SciMLMessage, verbosity_to_int, AbstractVerbositySpecifier, AbstractMessageLevel, AbstractVerbosityPreset,
2525
Silent, InfoLevel, WarnLevel, CustomLevel, None, Minimal, Standard, Detailed, All
2626
using Setfield: @set, @set!
27-
using UnPack: @unpack
2827
using DocStringExtensions: DocStringExtensions
2928
using EnumX: EnumX, @enumx
3029
using Markdown: Markdown, @doc_str

src/default.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ end
445445
function SciMLBase.solve!(cache::LinearCache, alg::Nothing,
446446
args...; assump::OperatorAssumptions = OperatorAssumptions(),
447447
kwargs...)
448-
@unpack A, b = cache
448+
(; A, b) = cache
449449
SciMLBase.solve!(cache, defaultalg(A, b, assump), args...; kwargs...)
450450
end
451451

src/preconditioners.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ end
3535
Base.eltype(A::ComposePreconditioner) = promote_type(eltype(A.inner), eltype(A.outer))
3636

3737
function LinearAlgebra.ldiv!(A::ComposePreconditioner, x)
38-
@unpack inner, outer = A
38+
(; inner, outer) = A
3939

4040
ldiv!(inner, x)
4141
ldiv!(outer, x)
4242
end
4343

4444
function LinearAlgebra.ldiv!(y, A::ComposePreconditioner, x)
45-
@unpack inner, outer = A
45+
(; inner, outer) = A
4646

4747
ldiv!(y, inner, x)
4848
ldiv!(outer, y)

src/simplegmres.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ end
162162

163163
function _init_cacheval(::Val{false}, alg::SimpleGMRES, A, b, u, Pl, Pr, maxiters::Int,
164164
abstol, reltol, ::Union{LinearVerbosity, Bool}, ::OperatorAssumptions; zeroinit = true, kwargs...)
165-
@unpack memory, restart, blocksize, warm_start = alg
165+
(; memory, restart, blocksize, warm_start) = alg
166166

167167
if zeroinit
168168
return SimpleGMRESCache{false}(memory, 0, restart, maxiters, blocksize,
@@ -218,8 +218,8 @@ function _init_cacheval(::Val{false}, alg::SimpleGMRES, A, b, u, Pl, Pr, maxiter
218218
end
219219

220220
function SciMLBase.solve!(cache::SimpleGMRESCache{false}, lincache::LinearCache)
221-
@unpack memory, n, restart, maxiters, blocksize, ε, PlisI, PrisI, Pl, Pr = cache
222-
@unpack Δx, q, p, x, A, b, abstol, reltol, w, V, s, c, z, R, β, warm_start = cache
221+
(; memory, n, restart, maxiters, blocksize, ε, PlisI, PrisI, Pl, Pr) = cache
222+
(; Δx, q, p, x, A, b, abstol, reltol, w, V, s, c, z, R, β, warm_start) = cache
223223

224224
T = eltype(x)
225225
q = PlisI ? w : q
@@ -394,7 +394,7 @@ end
394394
function _init_cacheval(::Val{true}, alg::SimpleGMRES, A, b, u, Pl, Pr, maxiters::Int,
395395
abstol, reltol, ::Union{LinearVerbosity, Bool}, ::OperatorAssumptions; zeroinit = true,
396396
blocksize = alg.blocksize)
397-
@unpack memory, restart, warm_start = alg
397+
(; memory, restart, warm_start) = alg
398398

399399
if zeroinit
400400
return SimpleGMRESCache{true}(memory, 0, restart, maxiters, blocksize,
@@ -449,8 +449,8 @@ function _init_cacheval(::Val{true}, alg::SimpleGMRES, A, b, u, Pl, Pr, maxiters
449449
end
450450

451451
function SciMLBase.solve!(cache::SimpleGMRESCache{true}, lincache::LinearCache)
452-
@unpack memory, n, restart, maxiters, blocksize, ε, PlisI, PrisI, Pl, Pr = cache
453-
@unpack Δx, q, p, x, A, b, abstol, reltol, w, V, s, c, z, R, β, warm_start = cache
452+
(; memory, n, restart, maxiters, blocksize, ε, PlisI, PrisI, Pl, Pr) = cache
453+
(; Δx, q, p, x, A, b, abstol, reltol, w, V, s, c, z, R, β, warm_start) = cache
454454
bsize = n ÷ blocksize
455455

456456
__batch = Base.Fix2(reshape, (blocksize, bsize))

src/solve_function.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ end
4747

4848
function SciMLBase.solve!(cache::LinearCache, alg::LinearSolveFunction,
4949
args...; kwargs...)
50-
@unpack A, b, u, p, isfresh, Pl, Pr, cacheval = cache
51-
@unpack solve_func = alg
50+
(; A, b, u, p, isfresh, Pl, Pr, cacheval) = cache
51+
(; solve_func) = alg
5252

5353
u = solve_func(A, b, u, p, isfresh, Pl, Pr, cacheval; kwargs...)
5454
return SciMLBase.build_linear_solution(alg, u, nothing, cache)
@@ -79,7 +79,7 @@ sol = solve(prob, alg)
7979
struct DirectLdiv! <: AbstractSolveFunction end
8080

8181
function SciMLBase.solve!(cache::LinearCache, alg::DirectLdiv!, args...; kwargs...)
82-
@unpack A, b, u = cache
82+
(; A, b, u) = cache
8383
ldiv!(u, A, b)
8484

8585
return SciMLBase.build_linear_solution(alg, u, nothing, cache)

0 commit comments

Comments
 (0)