@@ -7,7 +7,7 @@ Keyword `alpha` corresponds to static step length, default is 1.0.
77If keyword `scaled = true`, then the initial step length
88is scaled with the `l_2` norm of the step direction.
99"""
10- @with_kw struct InitialStatic{T}
10+ @kwdef struct InitialStatic{T}
1111 alpha:: T = 1.0
1212 scaled:: Bool = false # Scales step. alpha ← min(alpha,||s||_2) / ||s||_2
1313end
@@ -29,7 +29,7 @@ within the bounds [alphamin, alphamax]
2929
3030If state.alpha is NaN, then return fallback value is.alpha
3131"""
32- @with_kw struct InitialPrevious{T}
32+ @kwdef struct InitialPrevious{T}
3333 alpha:: T = 1.0
3434 alphamin:: T = 0.0
3535 alphamax:: T = Inf
@@ -61,7 +61,7 @@ This procedure have several arguments, with the following defaults.
6161
6262If αmax ≠ 1.0, then you should consider to ensure that snap2one[2] < αmax.
6363"""
64- @with_kw struct InitialQuadratic{T}
64+ @kwdef struct InitialQuadratic{T}
6565 αmin:: T = 1e-12 # Minimum initial step size (value somewhat arbitrary)
6666 αmax:: T = 1.0 # Maximum initial step size (advised by Nocedal+Wright)
6767 α0:: T = 1.0 # Fallback at first iteration
@@ -121,7 +121,7 @@ function InitialConstantChange{T}(; αmin = 1e-12,
121121 snap2one = (0.75 , Inf )) where T
122122 αmin, αmax, α0, ρ = convert .(T, (αmin, αmax, α0, ρ))
123123 snap2one = convert .(T, snap2one)
124- InitialConstantChange (αmin, αmax, α0, ρ, snap2one, Ref {T} (convert (T, NaN )))
124+ InitialConstantChange (αmin, αmax, α0, ρ, snap2one, Ref (convert (T, NaN )))
125125end
126126
127127# Have to make this constructor without with_kw because Ref(NaN) has to adapt to T
@@ -131,7 +131,7 @@ function InitialConstantChange(; αmin = 1e-12,
131131 ρ = 0.25 ,
132132 snap2one = (0.75 , Inf ))
133133 T = promote_type (typeof .((αmin, αmax, α0, ρ))... )
134- InitialConstantChange (αmin, αmax, α0, ρ, snap2one, Ref {T} (convert (T, NaN )))
134+ InitialConstantChange (αmin, αmax, α0, ρ, snap2one, Ref (convert (T, NaN )))
135135end
136136
137137function (is:: InitialConstantChange{T} )(ls, state, phi_0, dphi_0, df) where T
@@ -163,7 +163,7 @@ Initial step size algorithm from
163163If α0 is NaN, then procedure I0 is called at the first iteration,
164164otherwise, we select according to procedure I1-2, with starting value α0.
165165"""
166- @with_kw struct InitialHagerZhang{T}
166+ @kwdef struct InitialHagerZhang{T}
167167 ψ0:: T = 0.01
168168 ψ1:: T = 0.2
169169 ψ2:: T = 2.0
0 commit comments