Skip to content

Commit ecded14

Browse files
committed
refactor: minor stylistic fixes
1 parent 21b02bd commit ecded14

File tree

5 files changed

+13
-19
lines changed

5 files changed

+13
-19
lines changed

src/algorithms/broyden.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,14 @@ end
152152
153153
Broyden Update Rule corresponding to "bad broyden's method" [broyden1965class](@cite).
154154
"""
155-
@concrete struct BadBroydenUpdateRule <: AbstractApproximateJacobianUpdateRule{true} end
155+
struct BadBroydenUpdateRule <: AbstractApproximateJacobianUpdateRule{true} end
156156

157157
"""
158158
GoodBroydenUpdateRule()
159159
160160
Broyden Update Rule corresponding to "good broyden's method" [broyden1965class](@cite).
161161
"""
162-
@concrete struct GoodBroydenUpdateRule <: AbstractApproximateJacobianUpdateRule{true} end
162+
struct GoodBroydenUpdateRule <: AbstractApproximateJacobianUpdateRule{true} end
163163

164164
@concrete mutable struct BroydenUpdateRuleCache{mode} <:
165165
AbstractApproximateJacobianUpdateRuleCache{true}

src/algorithms/extension_algs.jl

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -362,11 +362,7 @@ function FixedPointAccelerationJL(;
362362
end
363363
end
364364
if extrapolation_period === missing
365-
if algorithm === :SEA || algorithm === :VEA
366-
extrapolation_period = 6
367-
else
368-
extrapolation_period = 7
369-
end
365+
extrapolation_period = algorithm === :SEA || algorithm === :VEA ? 6 : 7
370366
else
371367
if (algorithm === :SEA || algorithm === :VEA) && extrapolation_period % 2 != 0
372368
error("`extrapolation_period` must be multiples of 2 for SEA and VEA")
@@ -404,11 +400,10 @@ end
404400
405401
This algorithm is only available if `SIAMFANLEquations.jl` is installed.
406402
"""
407-
@concrete struct SIAMFANLEquationsJL{L <: Union{Symbol, Nothing}} <:
408-
AbstractNonlinearSolveExtensionAlgorithm
403+
@concrete struct SIAMFANLEquationsJL <: AbstractNonlinearSolveExtensionAlgorithm
409404
method::Symbol
410405
delta
411-
linsolve::L
406+
linsolve <: Union{Symbol, Nothing}
412407
m::Int
413408
beta
414409
autodiff

src/algorithms/klement.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ end
8686
8787
Update rule for [`Klement`](@ref).
8888
"""
89-
@concrete struct KlementUpdateRule <: AbstractApproximateJacobianUpdateRule{false} end
89+
struct KlementUpdateRule <: AbstractApproximateJacobianUpdateRule{false} end
9090

9191
@concrete mutable struct KlementUpdateRuleCache <:
9292
AbstractApproximateJacobianUpdateRuleCache{false}

src/algorithms/lbroyden.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,30 @@ and line search.
1818
function LimitedMemoryBroyden(; max_resets::Int = 3, linesearch = nothing,
1919
threshold::Union{Val, Int} = Val(10), reset_tolerance = nothing, alpha = nothing)
2020
threshold isa Int && (threshold = Val(threshold))
21-
initialization = BroydenLowRankInitialization{_unwrap_val(threshold)}(alpha, threshold)
21+
initialization = BroydenLowRankInitialization(alpha, threshold)
2222
return ApproximateJacobianSolveAlgorithm{false, :LimitedMemoryBroyden}(; linesearch,
2323
descent = NewtonDescent(), update_rule = GoodBroydenUpdateRule(),
2424
max_resets, initialization, reinit_rule = NoChangeInStateReset(; reset_tolerance))
2525
end
2626

2727
"""
28-
BroydenLowRankInitialization{T}(alpha, threshold::Val{T})
28+
BroydenLowRankInitialization(alpha, threshold::Val)
2929
3030
An initialization for `LimitedMemoryBroyden` that uses a low rank approximation of the
3131
Jacobian. The low rank updates to the Jacobian matrix corresponds to what SciPy calls
3232
["simple"](https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.broyden2.html#scipy-optimize-broyden2).
3333
"""
34-
@concrete struct BroydenLowRankInitialization{T} <: AbstractJacobianInitialization
34+
@concrete struct BroydenLowRankInitialization <: AbstractJacobianInitialization
3535
alpha
36-
threshold::Val{T}
36+
threshold <: Val
3737
end
3838

3939
jacobian_initialized_preinverted(::BroydenLowRankInitialization) = true
4040

4141
function __internal_init(
42-
prob::AbstractNonlinearProblem, alg::BroydenLowRankInitialization{T},
42+
prob::AbstractNonlinearProblem, alg::BroydenLowRankInitialization,
4343
solver, f::F, fu, u, p; maxiters = 1000,
44-
internalnorm::IN = L2_NORM, kwargs...) where {T, F, IN}
44+
internalnorm::IN = L2_NORM, kwargs...) where {F, IN}
4545
if u isa Number # Use the standard broyden
4646
return __internal_init(prob, IdentityInitialization(true, FullStructure()),
4747
solver, f, fu, u, p; maxiters, kwargs...)

src/algorithms/levenberg_marquardt.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ end
9595

9696
function __internal_init(
9797
prob::AbstractNonlinearProblem, f::LevenbergMarquardtDampingFunction,
98-
initial_damping, J, fu, u, ::Val{NF};
99-
internalnorm::F = L2_NORM, kwargs...) where {F, NF}
98+
initial_damping, J, fu, u, ::Val{NF}; kwargs...) where {NF}
10099
T = promote_type(eltype(u), eltype(fu))
101100
DᵀD = __init_diagonal(u, T(f.min_damping))
102101
if NF

0 commit comments

Comments
 (0)