Skip to content

Commit 03ab065

Browse files
committed
a bit more comments, a bit more UTF, a bit better name for an internal function
1 parent a44c7ca commit 03ab065

4 files changed

Lines changed: 11 additions & 10 deletions

File tree

docs/src/solvers/generalized_cauchy_direction_subsolver.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,5 @@ Manopt.set_zero_at_index!
6969
```@docs
7070
Manopt.LimitedMemorySegmentHessianUpdater
7171
Manopt.hessian_value_from_inner_products
72-
Manopt.set_M_current_scale!
72+
Manopt.update_current_scale!
7373
```

src/plans/box_plan.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ has_anisotropic_max_stepsize(M::ProductManifold) = any(has_anisotropic_max_steps
1313
1414
An approximation of Hessian of a scalar function of the form ``B_0 = θ I``,
1515
``B_{k+1} = B_k - W_k M_k W_k^{\mathrm{T}}``,
16-
where ``\theta > 0`` is an initial scaling guess.
17-
Matrix ``M_k = \left(\begin{smallmatrix}M_{11} & M_{21}^{\mathrm{T}}\\ M_{21} & M_{22}\end{smallmatrix}\right)``
16+
where ``θ > 0`` is an initial scaling guess.
17+
Matrix ``M_k = \left(\begin{smallmatrix}M₁₁ & M₂₁^{\mathrm{T}}\\ M₂₁ & M₂₂\end{smallmatrix}\right)``
1818
is stored using its blocks.
1919
Blocks ``W_k`` are (implicitly) composed from `memory_y` and `memory_s` stored in `qn_du`
2020
of type [`QuasiNewtonLimitedMemoryDirectionUpdate`](@ref).
2121
22-
Initial scale ``\theta`` is stored in the field `initial_scale` but if the memory isn't empty,
22+
Initial scale ``θ`` is stored in the field `initial_scale` but if the memory isn't empty,
2323
the current scale is set to squared norm of $s_k$ divided by inner product of ``s_k`` and ``y_k``
2424
where ``k`` is the oldest index for which the denominator is not equal to 0.
2525
@@ -210,21 +210,21 @@ function hessian_value(gh::QuasiNewtonLimitedMemoryBoxDirectionUpdate, M::Abstra
210210
end
211211

212212
@doc raw"""
213-
set_M_current_scale!(M::AbstractManifold, p, gh::QuasiNewtonLimitedMemoryBoxDirectionUpdate)
213+
update_current_scale!(M::AbstractManifold, p, gh::QuasiNewtonLimitedMemoryBoxDirectionUpdate)
214214
215215
Refresh the scaling factor and blockwise Hessian approximation stored in `gh` using the
216216
nonzero curvature pairs currently in memory.
217217
218218
- Identifies the most recent index with nonzero ``ρ_i`` to scale the initial Hessian guess
219219
by ``ρ_i‖y_i‖^2 / θ``.
220220
- Builds ``L_k`` and ``S_k^\top S_k`` from the stored ``(s_i, y_i)`` pairs and updates the
221-
block matrices ``M_{11}``, ``M_{21}``, and ``M_{22}`` via the blockwise inverse formula.
221+
block matrices ``M₁₁``, ``M₂₁``, and ``M₂₂`` via the blockwise inverse formula.
222222
- If all ``ρ_i`` vanish, resets `current_scale` to the inverse of `initial_scale` and
223223
clears the block matrices.
224224
225225
Returns the mutated `gh`.
226226
"""
227-
function set_M_current_scale!(M::AbstractManifold, p, gh::QuasiNewtonLimitedMemoryBoxDirectionUpdate)
227+
function update_current_scale!(M::AbstractManifold, p, gh::QuasiNewtonLimitedMemoryBoxDirectionUpdate)
228228
m = length(gh.qn_du.memory_s)
229229
last_safe_index = -1
230230
for i in eachindex(gh.qn_du.ρ)
@@ -329,7 +329,7 @@ function update_hessian!(
329329
)
330330
(capacity(gh.qn_du.memory_s) == 0) && return gh
331331
update_hessian!(gh.qn_du, mp, st, p_old, k)
332-
set_M_current_scale!(get_manifold(mp), get_iterate(st), gh)
332+
update_current_scale!(get_manifold(mp), get_iterate(st), gh)
333333
return gh
334334
end
335335

src/plans/stopping_criterion.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,12 +465,13 @@ end
465465
A stopping criterion to stop when
466466
467467
````math
468-
\\frac{f_k - f_{k+1}}{\\max(\\lvert f_k \\rvert, \\lvert f_{k+1} \\rvert, 1)} \\leq tol,
468+
\\frac{f_k - f_{k+1}}{\\max(\\lvert f_k \\rvert, \\lvert f_{k+1} \\rvert, 1)} tol,
469469
````
470470
471471
based on Eq. (1) in [ZhuByrdLuNocedal:1997](@cite)
472472
473473
# Fields
474+
* tolerance: the threshold `tol` in the above formula.
474475
$(_fields([:at_iteration, :last_change]))
475476
* `last_cost``: the last cost value
476477

test/solvers/test_quasi_Newton_box.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ using RecursiveArrayTools
152152
ha2 = QuasiNewtonLimitedMemoryBoxDirectionUpdate(QuasiNewtonLimitedMemoryDirectionUpdate(M, p, InverseBFGS(), 2))
153153
idx = Manopt.get_bounds_index(M)
154154
@test Manopt.hessian_value(ha2, M, p, Manopt.UnitVector(b), grad) 4.0
155-
Manopt.set_M_current_scale!(M, p, ha2)
155+
Manopt.update_current_scale!(M, p, ha2)
156156
@test ha2.current_scale == ha2.qn_du.initial_scale
157157
@test ha2.M_11 == fill(0.0, 0, 0)
158158
@test ha2.M_21 == fill(0.0, 0, 0)

0 commit comments

Comments
 (0)