Skip to content

Commit

Permalink
fix two places where complex manifolds would yield errors due to thei…
Browse files Browse the repository at this point in the history
…r complex inner products.
  • Loading branch information
kellertuer committed Jan 26, 2024
1 parent b3dae7e commit 6f4c074
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/plans/conjugate_gradient_plan.jl
Original file line number Diff line number Diff line change
Expand Up @@ -564,9 +564,9 @@ function (u::DirectionUpdateRuleStorage{<:PolakRibiereCoefficient})(

gradienttr = vector_transport_to(M, p_old, X_old, cgs.p, u.coefficient.transport_method)
ν = cgs.X - gradienttr
β = inner(M, cgs.p, cgs.X, ν) / inner(M, p_old, X_old, X_old)
β = real(inner(M, cgs.p, cgs.X, ν)) / real(inner(M, p_old, X_old, X_old))
update_storage!(u.storage, amp, cgs)
return max(0, β)
return max(zero(β), β)
end
function show(io::IO, u::PolakRibiereCoefficient)
return print(io, "PolakRibiereCoefficient($(u.transport_method))")
Expand Down Expand Up @@ -668,7 +668,7 @@ function (u::DirectionUpdateRuleStorage{<:ConjugateGradientBealeRestart})(
num = inner(M, cgs.p, cgs.X, Xoldpk)
# update storage only after that in case they share
update_storage!(u.storage, amp, cgs)
return (num / denom) > u.coefficient.threshold ? zero(β) : β
return real(num / denom) > u.coefficient.threshold ? zero(β) : β
end
function show(io::IO, u::ConjugateGradientBealeRestart)
return print(
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/quasi_Newton.jl
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ function update_hessian!(
sk_normsq = norm(M, p, st.sk)^2

# if the decision rule is fulfilled, the new sk and yk are added
if sk_normsq != 0 && (inner(M, p, st.sk, st.yk) / sk_normsq) >= bound
if sk_normsq != 0 && real(inner(M, p, st.sk, st.yk) / sk_normsq) >= bound
update_hessian!(d.update, mp, st, p_old, iter)
else
# the stored vectors are just transported to the new tangent space, sk and yk are not added
Expand Down

0 comments on commit 6f4c074

Please sign in to comment.