Skip to content

Commit

Permalink
Replace further arguments.
Browse files Browse the repository at this point in the history
  • Loading branch information
kellertuer committed Aug 21, 2024
1 parent b4e1a6a commit 2cda5e0
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 28 deletions.
31 changes: 20 additions & 11 deletions src/documentation_glossary.jl
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,8 @@ define!(
# for each variable as a symbol, we store
# The variable name should be the symbol
# :default – in positional or keyword arguments
# :description – a text description of the variable (always functions)
# :description – a text description of the variable
# :type a type
#
_var(args...; kwargs...) = glossary(:Variable, args...; kwargs...)

#Meta: How to format an argument, a field of a struct, and a keyword
Expand Down Expand Up @@ -184,7 +183,25 @@ define!(
(; M="M", p="p") ->
"a cost function ``f: $(_tex(:Cal, M))→ ℝ`` implemented as `($M, $p) -> v`",
)
define!(:Variable, :f, :type, "Any")
define!(:Variable, :f, :type, "Function")

define!(
:Variable,
:grad_f,
:description,
(; M="M", p="p") ->
"the (Riemannian) gradient ``$(_tex(:grad))f``: $(_math(:M, M=M))$(_math(:TpM; M=M, p=p)) of f as a function `(M, p) -> X` or a function `(M, X, p) -> X` computing `X` in-place",
)
define!(:Variable, :grad_f, :type, "Function")

define!(
:Variable,
:Hess_f,
:description,
(; M="M", p="p") ->
"the (Riemannian) Hessian ``$(_tex(:Hess))f``: $(_math(:TpM, M=M, p=p))$(_math(:TpM; M=M, p=p)) of f as a function `(M, p, X) -> Y` or a function `(M, Y, p, X) -> Y` computing `Y` in-place",
)
define!(:Variable, :Hess_f, :type, "Function")

define!(
:Variable, :M, :description, (; M="M") -> "a Riemannian manifold ``$(_tex(:Cal, M))``"
Expand Down Expand Up @@ -297,14 +314,6 @@ _sc(args...; kwargs...) = glossary(:StoppingCriterion, args...; kwargs...)
# Old strings

# Arguments
_arg_grad_f = raw"""
* `grad_f`: the gradient ``\operatorname{grad}f: \mathcal M → T\mathcal M`` of f
as a function `(M, p) -> X` or a function `(M, X, p) -> X` computing `X` in-place
"""
_arg_Hess_f = """
* `Hess_f`: the Hessian ``$(_tex(:Hess))_long`` of f
as a function `(M, p, X) -> Y` or a function `(M, Y, p, X) -> Y` computing `Y` in-place
"""
_arg_sub_problem = "* `sub_problem` a [`AbstractManoptProblem`](@ref) to specify a problem for a solver or a closed form solution function."
_arg_sub_state = "* `sub_state` a [`AbstractManoptSolverState`](@ref) for the `sub_problem`."
_arg_subgrad_f = raw"""
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/FrankWolfe.jl
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ use a retraction and its inverse.
$(_var(:Argument, :M; type=true))
$(_var(:Argument, :f))
$_arg_grad_f
$(_var(:Argument, :grad_f))
$(_var(:Argument, :p))
$(_note(:GradientObjective))
Expand Down
4 changes: 2 additions & 2 deletions src/solvers/adaptive_regularization_with_cubics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@ For more details see [AgarwalBoumalBullinsCartis:2020](@cite).
$(_var(:Argument, :M; type=true))
$(_var(:Argument, :f))
$_arg_grad_f
$_arg_Hess_f
$(_var(:Argument, :grad_f))
$(_var(:Argument, :Hess_f))
$(_var(:Argument, :p))
the cost `f` and its gradient and Hessian might also be provided as a [`ManifoldHessianObjective`](@ref)
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/augmented_Lagrangian_method.jl
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ where ``θ_ρ ∈ (0,1)`` is a constant scaling factor.
$(_var(:Argument, :M; type=true))
$(_var(:Argument, :f))
$_arg_grad_f
$(_var(:Argument, :grad_f))
# Optional (if not called with the [`ConstrainedManifoldObjective`](@ref) `cmo`)
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/conjugate_gradient_descent.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ $(_doc_update_delta_k)
$(_var(:Argument, :M; type=true))
$(_var(:Argument, :f))
$(_arg_grad_f)
$(_var(:Argument, :grad_f))
$(_var(:Argument, :p))
# Keyword arguments
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/exact_penalty_method.jl
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ $(_doc_EMP_ρ_update)
$(_var(:Argument, :M; type=true))
$(_var(:Argument, :f))
$(_arg_grad_f)
$(_var(:Argument, :grad_f))
$(_var(:Argument, :p))
# Keyword arguments
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/gradient_descent.jl
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ The algorithm can be performed in-place of `p`.
$(_var(:Argument, :M; type=true))
$(_var(:Argument, :f))
$_arg_grad_f
$(_var(:Argument, :grad_f))
$(_var(:Argument, :p))
$(_note(:GradientObjective))
Expand Down
10 changes: 5 additions & 5 deletions src/solvers/interior_point_Newton.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ the constraints are further fulfilled.
# Input
* `M`: a manifold ``$(_math(:M))``
* `f`: a cost function ``f : $(_math(:M)) → ℝ`` to minimize
* `grad_f`: the gradient ``$(_tex(:grad)) f : $(_math(:M)) → T $(_math(:M))`` of ``f``
* `Hess_f`: the Hessian ``$(_tex(:Hess))f(p): T_p$(_math(:M)) → T_p$(_math(:M))``, ``X ↦ $(_tex(:Hess))f(p)[X] = ∇_X$(_tex(:grad))f(p)``
$(_var(:Field, :p))
$(_var(:Argument, :M))
$(_var(:Argument, :f))
$(_var(:Argument, :grad_f))
$(_var(:Argument, :Hess_f))
$(_var(:Argument, :p))
or a [`ConstrainedManifoldObjective`](@ref) `cmo` containing `f`, `grad_f`, `Hess_f`, and the constraints
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 @@ -196,7 +196,7 @@ The ``k``th iteration consists of
$(_var(:Argument, :M; type=true))
$(_var(:Argument, :f))
$(_arg_grad_f)
$(_var(:Argument, :grad_f))
$(_var(:Argument, :p))
# Keyword arguments
Expand Down
4 changes: 2 additions & 2 deletions src/solvers/truncated_conjugate_gradient_descent.jl
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,8 @@ see [AbsilBakerGallivan:2006, ConnGouldToint:2000](@cite).
$(_var(:Argument, :M; type=true))
$(_var(:Argument, :f))
$(_arg_grad_f)
$(_arg_Hess_f)
$(_var(:Argument, :grad_f))
$(_var(:Argument, :Hess_f))
$(_var(:Argument, :p))
$(_var(:Argument, :X))
Expand Down
4 changes: 2 additions & 2 deletions src/solvers/trust_regions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,8 @@ by default the [`truncated_conjugate_gradient_descent`](@ref) is used.
$(_var(:Argument, :M; type=true))
$(_var(:Argument, :f))
$(_arg_grad_f)
$(_arg_Hess_f)
$(_var(:Argument, :grad_f))
$(_var(:Argument, :Hess_f))
$(_var(:Argument, :p))
# Keyword arguments
Expand Down

0 comments on commit 2cda5e0

Please sign in to comment.