Skip to content

Commit dd64c48

Browse files
authored
Fix links and move them to extref in the AD tutorial. (#443)
* Fix links and move them to extref in the AD tutorial. * Add Changelog. * Fix two typos.
1 parent 58c7078 commit dd64c48

4 files changed

Lines changed: 16 additions & 6 deletions

File tree

Changelog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ The file was started with Version `0.4`.
66
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
77
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
88

9+
## [0.5.9] unreleased
10+
11+
### Fixed
12+
13+
* the links in the AD tutorial are fixed and moved to using `extref`
14+
915
## [0.5.8] February 28, 2025
1016

1117
### Fixed

docs/make.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ end
139139
# (e) finally make docs
140140
bib = CitationBibliography(joinpath(@__DIR__, "src", "references.bib"); style=:alpha)
141141
links = InterLinks(
142+
"ManifoldDiff" => ("https://juliamanifolds.github.io/ManifoldDiff.jl/stable/"),
142143
"ManifoldsBase" => ("https://juliamanifolds.github.io/ManifoldsBase.jl/stable/"),
143144
"Manifolds" => ("https://juliamanifolds.github.io/Manifolds.jl/stable/"),
144145
)

src/plans/stopping_criterion.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ $(_var(:Field, :last_change))
204204
$(_var(:Field, :inverse_retraction_method))
205205
$(_var(:Field, :storage))
206206
* `at_iteration::Int`: indicate at which iteration this stopping criterion was last active.
207-
* `inverse_retraction`: An [`AbstractInverseRetractionMethod`](@ref) that can be passed
207+
* `inverse_retraction`: An [`AbstractInverseRetractionMethod`](@extref `ManifoldsBase.AbstractInverseRetractionMethod`) that can be passed
208208
to approximate the distance by this inverse retraction and a norm on the tangent space.
209209
This can be used if neither the distance nor the logarithmic map are availannle on `M`.
210210
* `last_change`: store the last change

tutorials/AutomaticDifferentiation.qmd

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ More generally take a change of the metric into account as
141141
= Df(p)[X] = g_p(\operatorname{grad}f(p), X)
142142
```
143143

144-
or in words: we have to change the Riesz representer of the (restricted/projected) differential of $f$ ($\tilde f$) to the one with respect to the Riemannian metric. This is done using [`change_representer`](https://juliamanifolds.github.io/Manifolds.jl/latest/manifolds/metric.html#Manifolds.change_representer-Tuple{AbstractManifold,%20AbstractMetric,%20Any,%20Any}).
144+
or in words: we have to change the Riesz representer of the (restricted/projected) differential of $f$ ($\tilde f$) to the one with respect to the Riemannian metric. This is done using ``[`change_representer`](@extref `ManifoldsBase.change_representer-Tuple{AbstractManifold, ManifoldsBase.AbstractMetric, Any, Any}`)``{=commonmark}.
145145

146146
### A continued example
147147

@@ -187,7 +187,7 @@ This can be computed for symmetric positive definite matrices by summing the squ
187187
G(q) = sum(log.(eigvals(Symmetric(q))) .^ 2) / 2
188188
```
189189

190-
We can also interpret this as a function on the space of matrices and apply the Euclidean finite differences machinery; in this way we can easily derive the Euclidean gradient. But when computing the Riemannian gradient, we have to change the representer (see again [`change_representer`](https://juliamanifolds.github.io/Manifolds.jl/latest/manifolds/metric.html#Manifolds.change_representer-Tuple{AbstractManifold,%20AbstractMetric,%20Any,%20Any})) after projecting onto the tangent space $T_p\mathcal P(n)$ at $p$.
190+
We can also interpret this as a function on the space of matrices and apply the Euclidean finite differences machinery; in this way we can easily derive the Euclidean gradient. But when computing the Riemannian gradient, we have to change the representer (see again ``[`change_representer`](@extref `ManifoldsBase.change_representer-Tuple{AbstractManifold, ManifoldsBase.AbstractMetric, Any, Any}`)``{=commonmark}) after projecting onto the tangent space $T_p\mathcal P(n)$ at $p$.
191191

192192
Let's first define a point and the manifold $N=\mathcal P(3)$.
193193

@@ -204,7 +204,7 @@ We could first just compute the gradient using `FiniteDifferences.jl`, but this
204204
FiniteDifferences.grad(central_fdm(5, 1), G, q)
205205
```
206206

207-
Instead, we use the [`RiemannianProjectedBackend`](https://juliamanifolds.github.io/Manifolds.jl/latest/features/differentiation.html#Manifolds.RiemannianProjectionBackend) of `Manifolds.jl`, which in this case internally uses `FiniteDifferences.jl` to compute a Euclidean gradient but then uses the conversion explained before to derive the Riemannian gradient.
207+
Instead, we use the ``[`RiemannianProjectedBackend`](@extref `ManifoldDiff.RiemannianProjectionBackend`)``{=commonmark} of ``[`ManifoldDiff.jl`](@extref ManifoldDiff :std:doc:`index`)``{=commonmark}, which in this case internally uses `FiniteDifferences.jl` to compute a Euclidean gradient but then uses the conversion explained before to derive the Riemannian gradient.
208208

209209
We define this here again as a function `grad_G_FD` that could be used in the `Manopt.jl` framework within a gradient based optimization.
210210

@@ -220,7 +220,7 @@ end
220220
G1 = grad_G_FD(N, q)
221221
```
222222

223-
Now, we can again compare this to the (known) solution of the gradient, namely the gradient of (half of) the distance squared $G(q) = \frac{1}{2}d^2_{\mathcal P(3)}(q,I_3)$ is given by $\operatorname{grad} G(q) = -\operatorname{log}_q I_3$, where $\operatorname{log}$ is the [logarithmic map](https://juliamanifolds.github.io/Manifolds.jl/latest/manifolds/symmetricpositivedefinite.html#Base.log-Tuple{SymmetricPositiveDefinite,%20Vararg{Any,%20N}%20where%20N}) on the manifold.
223+
Now, we can again compare this to the (known) solution of the gradient, namely the gradient of (half of) the distance squared $G(q) = \frac{1}{2}d^2_{\mathcal P(3)}(q,I_3)$ is given by $\operatorname{grad} G(q) = -\operatorname{log}_q I_3$, where $\operatorname{log}$ is th ``[logarithmic map](@extref Manifolds :jl:method:`Base.log-Tuple{SymmetricPositiveDefinite, Vararg{Any}}`)``{=commonmark} on the manifold.
224224

225225
```{julia}
226226
G2 = -log(N, q, Matrix{Float64}(I, 3, 3))
@@ -243,11 +243,14 @@ This tutorial is cached. It was last run on the following package versions.
243243

244244
```{julia}
245245
#| code-fold: true
246+
#| echo: false
246247
using Pkg
247248
Pkg.status()
248249
```
249250
```{julia}
250251
#| code-fold: true
252+
#| echo: false
253+
#| output: asis
251254
using Dates
252-
now()
255+
println("This tutorial was last rendered $(Dates.format(now(), "U d, Y, H:M:S")).");
253256
```

0 commit comments

Comments
 (0)