Skip to content

Commit cdbf0e7

Browse files
committed
Fix a small bug in subsolver objectives.
1 parent b5e1c31 commit cdbf0e7

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

src/plans/subsolver_plan.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ abstract type AbstractManifoldSubObjective{
1515
E <: AbstractEvaluationType, O <: AbstractManifoldObjective,
1616
} <: AbstractManifoldObjective{E} end
1717

18-
function get_gradient_function(cgo::AbstractManifoldSubObjective)
19-
return (M, p) -> get_gradient(M, cgo, p)
18+
function get_gradient_function(amso::AbstractManifoldSubObjective)
19+
return (M, p) -> get_gradient(M, get_objective(amso), p)
2020
end
2121

2222
@doc """

test/solvers/test_trust_regions.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,13 @@ include("trust_region_model.jl")
2828
X = rgrad(M, p)
2929
TpM = TangentSpace(M, copy(M, p))
3030
mho = ManifoldHessianObjective(f, rgrad, rhess)
31-
sub_problem = DefaultManoptProblem(TpM, TrustRegionModelObjective(mho))
31+
sub_objective = TrustRegionModelObjective(mho)
32+
sub_problem = DefaultManoptProblem(TpM, sub_objective)
3233
sub_state = TruncatedConjugateGradientState(TpM; X = get_gradient(M, mho, p))
3334
trs1 = TrustRegionsState(M, sub_problem)
3435
trs2 = TrustRegionsState(M, sub_problem, sub_state)
3536
trs3 = TrustRegionsState(M, sub_problem; p = p)
37+
@test Manopt.get_gradient_function(sub_objective)(M, p) == X
3638
end
3739
@testset "Objective accessors" begin
3840
mho = ManifoldHessianObjective(f, rgrad, rhess)

0 commit comments

Comments
 (0)