Skip to content

Commit cde916d

Browse files
committed
Fix the tutorial on how to implement a solver and expandf the explanation therein on status_summary
1 parent 1efa5a2 commit cde916d

1 file changed

Lines changed: 8 additions & 11 deletions

File tree

tutorials/ImplementASolver.qmd

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,7 @@ We can defined this as
9797
```{julia}
9898
#| output: false
9999
mutable struct RandomWalkState{
100-
P,
101-
R<:AbstractRetractionMethod,
102-
S<:StoppingCriterion,
100+
P, R<:AbstractRetractionMethod, S<:StoppingCriterion,
103101
} <: AbstractManoptSolverState
104102
p::P
105103
q::P
@@ -269,9 +267,7 @@ given start point unchanged would just add a `copy(M, p)` upfront.
269267

270268
```{julia}
271269
function random_walk_algorithm!(
272-
M::AbstractManifold,
273-
mgo::ManifoldCostObjective,
274-
p;
270+
M::AbstractManifold, mgo::ManifoldCostObjective, p;
275271
σ = 0.1,
276272
retraction_method::AbstractRetractionMethod=default_retraction_method(M, typeof(p)),
277273
stopping_criterion::StoppingCriterion=StopAfterIteration(200),
@@ -280,8 +276,7 @@ function random_walk_algorithm!(
280276
dmgo = decorate_objective!(M, mgo; kwargs...)
281277
dmp = DefaultManoptProblem(M, dmgo)
282278
s = RandomWalkState(M, [1.0, 0.0, 0.0];
283-
σ=0.1,
284-
retraction_method=retraction_method, stopping_criterion=stopping_criterion,
279+
σ=0.1, retraction_method=retraction_method, stopping_criterion=stopping_criterion,
285280
)
286281
ds = decorate_state!(s; kwargs...)
287282
solve!(dmp, ds)
@@ -307,12 +302,14 @@ For the case that you set `return_state=true` the solver should return a summary
307302
Internally this is mapped to the (human-readable) display of a `status_summary`
308303
It should reflect its main parameters, if they are not too verbose and provide information
309304
about the reason it stopped and whether this indicates convergence.
305+
Compared to Julias own `show(io::IO, state)` method, the status summary aims to be
306+
in prose text.
310307

311-
Here it would for example look like
308+
Here it would for example look like
312309

313310
```{julia}
314311
#| output: false
315-
import Manopt: status_summary: show
312+
import Manopt: status_summary
316313
function status_summary(rws::RandomWalkState; context::Symbol = :default)
317314
(context === :short) && return repr(rws)
318315
i = get_count(rws, :Iterations)
@@ -328,7 +325,7 @@ function status_summary(rws::RandomWalkState; context::Symbol = :default)
328325
* σ : $(rws.σ)
329326
330327
## Stopping criterion
331-
$(status_summary(rws.stop))
328+
$(status_summary(rws.stop; context = context))
332329
This indicates convergence: $Conv"""
333330
return s
334331
end

0 commit comments

Comments
 (0)