Skip to content

Commit 2d89801

Browse files
committed
Fix documentation.
1 parent a6aacf3 commit 2d89801

3 files changed

Lines changed: 26 additions & 10 deletions

File tree

docs/src/plans/index.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,29 @@ You can further activate a “Tutorial” mode by `set_parameter!(:Mode, "Tutori
5858
Manopt.is_tutorial_mode
5959
```
6060

61-
# A factory for providing manifold defaults
61+
## A factory for providing manifold defaults
6262

6363
In several cases a manifold might not yet be known at the time a (keyword) argument should be provided. Therefore, any type with a manifold default can be wrapped into a factory.
6464

6565
```@docs
6666
Manopt.ManifoldDefaultsFactory
6767
Manopt._produce_type
68+
```
69+
70+
## Keyword arguments and their verification
71+
72+
Internally `Manopt.jl` passes keywords for the (high-level) solver
73+
functions to several inner functions, e.g. to add debug or caching.
74+
Besides the documentation, one can check with the internal function [`Manopt.accepted_keywords`](@ref) which keywords a solver accepts.
75+
76+
A solver also warns, if a keyword is passed, that is not handled by the
77+
solver or any of the inner functions it calls.
78+
79+
```@docs
80+
Manopt.Keywords
81+
Manopt.accepted_keywords
82+
Manopt.add!
83+
Manopt.calls_with_kwargs
84+
Manopt.direct_keywords
85+
Manopt.keywords_accepted
6886
```

src/plans/keywords.jl

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,12 @@ accepts when constructed.
152152
153153
This function uses [`direct_keywords`](@ref) to find keywords a function directly accepts,
154154
and [`calls_with_kwargs`](@ref) to find functions it passes keyword to, where they also
155-
might be accepted
155+
might be accepted.
156+
In order for nonmutating functions `f` to work the same as their mutating variants `f!`,
157+
the allocating one, one should set [`calls_with_kwargs`](@ref)`(f) = (f,)`.
156158
157-
this also includes keywords that are passed on to internal structures.
159+
this also includes keywords that are passed on to internal structures, also specified using
160+
[`calls_with_kwargs`](@ref).
158161
"""
159162
function accepted_keywords(f)
160163
kw = direct_keywords(f)
@@ -178,12 +181,7 @@ calls_with_kwargs(f) = ()
178181
direct_keywords(solver)
179182
direct_keywords(stepsize)
180183
181-
Return a set of keywords a function directly would work with,
182-
i.e. that are directly defined in one of its dispatch variants, including
183-
a mutating variant.
184-
185-
For example `direct_keywords(gradient_descent)` and `direct_keywords(gradient_descent!)`
186-
should return the same set [`Keywords!`](@ref).
184+
Return a set of keywords a function directly would work with.
187185
"""
188186
function direct_keywords(f)
189187
methods_f = methods(f)

src/plans/stepsize.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,7 @@ $(_var(:Keyword, :vector_transport_method))
836836
* `bb_max_stepsize=1e3`
837837
$(_var(:Keyword, :retraction_method))
838838
* `strategy=direct`
839-
* `storage=[`StoreStateAction`](@ref)`(M; store_fields=[:Iterate, :Gradient])``
839+
* `storage=`[`StoreStateAction`](@ref)`(M; store_fields=[:Iterate, :Gradient])`
840840
* `stepsize_reduction=0.5`
841841
* `sufficient_decrease=1e-4`
842842
* `stop_when_stepsize_less=0.0`

0 commit comments

Comments
 (0)