Skip to content

Commit

Permalink
Merge pull request #6 from mhauru/master
Browse files Browse the repository at this point in the history
Fix finalize! signature in README
  • Loading branch information
Jutho authored Aug 17, 2020
2 parents 6f08a89 + 2524f0b commit 7b325c1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ x, fx, gx, normgradhistory = optimize(fg, x₀, algorithm; kwargs...)
Here, the optimization problem (objective function) is specified as a function `fval, gval = fg(x)` that returns both the function value and its gradient at a given point `x`. The function value `fval` is assumed to be a real number of some type `T<:Real`. Both `x` and the gradient `gval` can be of any type, including tuples and named tuples. As a user, you should then also specify the following functions via keyword arguments

* `Pη = precondition(x, η)`: apply a preconditioner to the current gradient or tangent vector `η` at the position `x`
* `x, f, g = finalize!(x, f, g)`: after every step (i.e. upon completion of the linesearch), allows to modify the position and corresponding function value or gradient, or to do other things like printing out statistics. Note that this step happens before computing new directions in Conjugate Gradient and LBFGS, so if `f` and `g` are modified, this is at the user's own risk (e.g. Wolfe conditions might no longer be satisfied, ...).
* `x, f, g = finalize!(x, f, g, numiter)`: after every step (i.e. upon completion of the linesearch), allows to modify the position and corresponding function value or gradient, or to do other things like printing out statistics. Note that this step happens before computing new directions in Conjugate Gradient and LBFGS, so if `f` and `g` are modified, this is at the user's own risk (e.g. Wolfe conditions might no longer be satisfied, ...).
* `x, ξ = retract(x₀, η, α)`: take a step in direction `η` (same type as gradients) starting from point `x₀` and with step length `α`, returns the new ``x(α) = Rₓ₀(α * η)`` and the local tangent to this path at that position, i.e. ``ξ = D Rₓ₀(α * η)[η]`` (informally, ``ξ = dx(α) / dα``).
* `s = inner(x, ξ1, ξ2)`: compute the inner product between two gradients or similar objects at position `x`. The `x` dependence is useful for optimization on manifolds, where this function represents the metric; in particular it should be symmetric `inner(x, ξ1, ξ2) == inner(x, ξ2, ξ1)` and real-valued.
* `η = scale!(η, β)`: compute the equivalent of `η*β`, possibly in place, but we always use the return value. This is mostly used as `scale!(g, -1)` to compute the negative gradient as part of the step direction.
Expand Down

0 comments on commit 7b325c1

Please sign in to comment.