Skip to content

Commit f50a3ee

Browse files
committed
Continue work on proximal objective.
1 parent 3867614 commit f50a3ee

3 files changed

Lines changed: 22 additions & 15 deletions

File tree

src/plans/count.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ struct ManifoldCountObjective{
4848
counts::Dict{Symbol, I}
4949
objective::O
5050
end
51+
ManifoldCountObjective(::AbstractManifold, o::AbstractManifoldObjective, c) = ManifoldCountObjective(o, c)
5152
function ManifoldCountObjective(
5253
objective::O, counts::Dict{Symbol, I}
5354
) where {

src/plans/first_order_plan.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1082,7 +1082,10 @@ end
10821082
function show(io::IO, dg::DebugGradient)
10831083
return print(io, "DebugGradient(; format=\"$(dg.format)\", at_init=$(dg.at_init))")
10841084
end
1085-
status_summary(dg::DebugGradient) = "(:Gradient, \"$(dg.format)\")"
1085+
function status_summary(dg::DebugGradient; context = :default)
1086+
_is_inline(context) && (return "(:Gradient, \"$(dg.format)\")")
1087+
return "A DebugAction to print the gradient at the current iterate “$(dg.format)"
1088+
end
10861089

10871090
@doc """
10881091
DebugGradientNorm <: DebugAction

src/plans/proximal_plan.jl

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,7 @@ end
112112
function get_proximal_map(
113113
M::AbstractManifold,
114114
mpo::ManifoldProximalMapObjective{AllocatingEvaluation, F, <:Union{<:Tuple, <:Vector}},
115-
λ,
116-
p,
117-
i,
115+
λ, p, i,
118116
) where {F}
119117
check_prox_number(mpo.proximal_maps!!, i)
120118
return mpo.proximal_maps!![i](M, λ, p)
@@ -128,9 +126,7 @@ function get_proximal_map!(
128126
M::AbstractManifold,
129127
q,
130128
mpo::ManifoldProximalMapObjective{AllocatingEvaluation, F, <:Union{<:Tuple, <:Vector}},
131-
λ,
132-
p,
133-
i,
129+
λ, p, i,
134130
) where {F}
135131
check_prox_number(mpo.proximal_maps!!, i)
136132
copyto!(M, q, mpo.proximal_maps!![i](M, λ, p))
@@ -144,22 +140,17 @@ end
144140
function get_proximal_map(
145141
M::AbstractManifold,
146142
mpo::ManifoldProximalMapObjective{InplaceEvaluation, F, <:Union{<:Tuple, <:Vector}},
147-
λ,
148-
p,
149-
i,
143+
λ, p, i,
150144
) where {F}
151145
check_prox_number(mpo.proximal_maps!!, i)
152146
q = allocate_result(M, get_proximal_map, p)
153147
mpo.proximal_maps!![i](M, q, λ, p)
154148
return q
155149
end
156150
function get_proximal_map!(
157-
M::AbstractManifold,
158-
q,
151+
M::AbstractManifold, q,
159152
mpo::ManifoldProximalMapObjective{InplaceEvaluation, F, <:Union{<:Tuple, <:Vector}},
160-
λ,
161-
p,
162-
i,
153+
λ, p, i,
163154
) where {F}
164155
check_prox_number(mpo.proximal_maps!!, i)
165156
mpo.proximal_maps!![i](M, q, λ, p)
@@ -192,6 +183,18 @@ function get_proximal_map!(
192183
mpo.proximal_maps!!(M, q, λ, p)
193184
return q
194185
end
186+
function status_summary(mpo::ManifoldProximalMapObjective; context = :default)
187+
return "A proximal map objective for a cost with $(mpo.number_of_proxes) proximal maps"
188+
end
189+
function show(io::IO, mpo::ManifoldProximalMapObjective{E}) where {E}
190+
print(io, "ManifoldProximalMapObjective(")
191+
print(io, mpo.cost); print(io, ", ")
192+
print(io, mpo.proximal_maps!!); print(io, ", ")
193+
print(io, mpo.number_of_proxes); print(io, "; ")
194+
print(io, _to_kw(E))
195+
return print(io, ")")
196+
end
197+
195198
#
196199
#
197200
# Proximal based State

0 commit comments

Comments
 (0)