Skip to content

Commit

Permalink
minor change
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuszbaran committed Jan 30, 2024
1 parent 56e929d commit 3ed78d0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/ImprovedHagerZhangLinesearch.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ using Manopt: max_stepsize, get_cost_function
# on the parameters

mutable struct HagerZhangLinesearch{
T,TRM<:AbstractRetractionMethod,VTM<:AbstractVectorTransportMethod,P,TX
T<:Real,TRM<:AbstractRetractionMethod,VTM<:AbstractVectorTransportMethod,P,TX
} <: Linesearch
delta::T # c_1 Wolfe sufficient decrease condition
sigma::T # c_2 Wolfe curvature condition (Recommend 0.1 for GradientDescent)
Expand Down Expand Up @@ -51,11 +51,11 @@ function HagerZhangLinesearch(
gamma::T=0.66,
linesearchmax::Int=50,
psi3::T=0.1,
) where {P,TRM<:AbstractRetractionMethod,VTM<:AbstractVectorTransportMethod,T,TX}
) where {P,TRM<:AbstractRetractionMethod,VTM<:AbstractVectorTransportMethod,T<:Real,TX}
return HagerZhangLinesearch{T,TRM,VTM,P,TX}(
delta,
sigma,
alphamax,
convert(T, alphamax),
rho,
epsilon,
gamma,
Expand Down Expand Up @@ -124,6 +124,7 @@ function (ls::HagerZhangLinesearch)(ϕdϕ, c::T, phi_0::Real, dphi_0::Real) wher
throw(ErrorException("Value and slope at step length = 0 must be finite."))
end
if dphi_0 >= eps(T) * abs(phi_0)
println("Values: $dphi_0, $(abs(phi_0))")
throw(ErrorException("Search direction is not a direction of descent."))
elseif dphi_0 >= 0
return zeroT, phi_0
Expand Down

0 comments on commit 3ed78d0

Please sign in to comment.