Skip to content

Commit

Permalink
A few edits to the notebooks (#19)
Browse files Browse the repository at this point in the history
* Run formatter

* Fix some old typos

---------

Co-authored-by: Ronny Bergmann <git@ronnybergmann.net>
  • Loading branch information
hajg-ijk and kellertuer authored Jul 12, 2024
1 parent 9a2cd6e commit 3b09351
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 20 deletions.
4 changes: 0 additions & 4 deletions docs/src/examples/H2-Signal-TV.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,6 @@ function artificial_H2_signal(
)
end
end
#! In order to have length(data) ∝ pts, we need typeof(l) == Int and mod(pts, l) == 0.
if pts != length(data)
@warn "The length of the output signal will differ from the input number of points."
end
return data, geodesics
end
function matrixify_Poincare_ball(input)
Expand Down
2 changes: 2 additions & 0 deletions docs/src/examples/RCBM-Median.md
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,8 @@ We can take a look at how the algorithms compare to each other in their performa

## The Median on the Sphere

For the last experiment, note that a major difference here is that the sphere has constant positive sectional curvature equal to $1$. In this case, we lose the global convexity of the Riemannian distance and thus of the objective. Minimizers still exist, but they may, in general, be non-unique.

``` julia
subexperiment_name = "Sn"
k_max_sn = 1.0
Expand Down
12 changes: 6 additions & 6 deletions docs/src/examples/Spectral-Procrustes.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ using ManifoldDiff, Manifolds, Manopt, ManoptExamples

## The Problem

Given two matrices $A, B \in \mathbb R^{n \times d}$ we aim to solve the orthogonal Procrustes problem
Given two matrices $A, B \in \mathbb R^{n \times d}$ we aim to solve the Procrustes problem

``` math
{\arg\min}_{p \in \mathrm{SO}(d)}\ \Vert A - B \, p \Vert_2
Expand All @@ -31,22 +31,22 @@ Given two matrices $A, B \in \mathbb R^{n \times d}$ we aim to solve the orthogo
where $\mathrm{SO}(d)$ is equipped with the standard bi-invariant metric, and where $\Vert \,\cdot\, \Vert_2$ denotes the spectral norm of a matrix, , its largest singular value.
We aim to find the best matrix $p \in \mathbb R^{d \times d}$ such that $p^\top p = \mathrm{id}$ is the identity matrix, or in other words $p$ is the best rotation.
Note that the spectral norm is convex in the Euclidean sense, but not geodesically convex on $\mathrm{SO}(d)$.
If we define the objective as
Let us define the objective as

``` math
f (p)
=
\Vert A - B \, p \Vert_2
,
.
```

its subdifferential is given by
To obtain subdifferential information, we use

``` math
\partial f(p) = \mathrm{proj}_p(-B^\top UV^\top)
\mathrm{proj}_p(-B^\top UV^\top)
```

where $U$ and $V$ are some left and right singular vectors, respectively, corresponding to the largest singular value of $A - B \, p$, and $\mathrm{proj}_p$ is the projection onto
as a substitute for $\partial f(p)$, where $U$ and $V$ are some left and right singular vectors, respectively, corresponding to the largest singular value of $A - B \, p$, and $\mathrm{proj}_p$ is the projection onto

``` math
\mathcal T_p \mathrm{SO}(d)
Expand Down
4 changes: 0 additions & 4 deletions examples/H2-Signal-TV.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,6 @@ function artificial_H2_signal(
)
end
end
#! In order to have length(data) ∝ pts, we need typeof(l) == Int and mod(pts, l) == 0.
if pts != length(data)
@warn "The length of the output signal will differ from the input number of points."
end
return data, geodesics
end
function matrixify_Poincare_ball(input)
Expand Down
3 changes: 3 additions & 0 deletions examples/RCBM-Median.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,9 @@ benchmarking && pretty_table(A2_SPD, tf = tf_markdown, header=col_names_2)
```

## The Median on the Sphere

For the last experiment, note that a major difference here is that the sphere has constant positive sectional curvature equal to $1$. In this case, we lose the global convexity of the Riemannian distance and thus of the objective. Minimizers still exist, but they may, in general, be non-unique.

```{julia}
#| output: false
subexperiment_name = "Sn"
Expand Down
12 changes: 6 additions & 6 deletions examples/Spectral-Procrustes.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ using ManifoldDiff, Manifolds, Manopt, ManoptExamples

## The Problem

Given two matrices $A, B \in \mathbb R^{n \times d}$ we aim to solve the orthogonal Procrustes problem
Given two matrices $A, B \in \mathbb R^{n \times d}$ we aim to solve the Procrustes problem
```math
{\arg\min}_{p \in \mathrm{SO}(d)}\ \Vert A - B \, p \Vert_2
,
Expand All @@ -53,18 +53,18 @@ Given two matrices $A, B \in \mathbb R^{n \times d}$ we aim to solve the orthogo
where $\mathrm{SO}(d)$ is equipped with the standard bi-invariant metric, and where $\Vert \,\cdot\, \Vert_2$ denotes the spectral norm of a matrix, \ie, its largest singular value.
We aim to find the best matrix $p \in \mathbb R^{d \times d}$ such that $p^\top p = \mathrm{id}$ is the identity matrix, or in other words $p$ is the best rotation.
Note that the spectral norm is convex in the Euclidean sense, but not geodesically convex on $\mathrm{SO}(d)$.
If we define the objective as
Let us define the objective as
```math
f (p)
=
\Vert A - B \, p \Vert_2
,
.
```
its subdifferential is given by
To obtain subdifferential information, we use
```math
\partial f(p) = \mathrm{proj}_p(-B^\top UV^\top)
\mathrm{proj}_p(-B^\top UV^\top)
```
where $U$ and $V$ are some left and right singular vectors, respectively, corresponding to the largest singular value of $A - B \, p$, and $\mathrm{proj}_p$ is the projection onto
as a substitute for $\partial f(p)$, where $U$ and $V$ are some left and right singular vectors, respectively, corresponding to the largest singular value of $A - B \, p$, and $\mathrm{proj}_p$ is the projection onto
```math
\mathcal T_p \mathrm{SO}(d)
=
Expand Down

0 comments on commit 3b09351

Please sign in to comment.