From 3b093517e5dd64a1f888fce9eecb83ec07da5eba Mon Sep 17 00:00:00 2001 From: hajg-ijk <112711660+hajg-ijk@users.noreply.github.com> Date: Fri, 12 Jul 2024 08:30:16 +0200 Subject: [PATCH] A few edits to the notebooks (#19) * Run formatter * Fix some old typos --------- Co-authored-by: Ronny Bergmann --- docs/src/examples/H2-Signal-TV.md | 4 ---- docs/src/examples/RCBM-Median.md | 2 ++ docs/src/examples/Spectral-Procrustes.md | 12 ++++++------ examples/H2-Signal-TV.qmd | 4 ---- examples/RCBM-Median.qmd | 3 +++ examples/Spectral-Procrustes.qmd | 12 ++++++------ 6 files changed, 17 insertions(+), 20 deletions(-) diff --git a/docs/src/examples/H2-Signal-TV.md b/docs/src/examples/H2-Signal-TV.md index 2d6d82e..d26ece9 100644 --- a/docs/src/examples/H2-Signal-TV.md +++ b/docs/src/examples/H2-Signal-TV.md @@ -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) diff --git a/docs/src/examples/RCBM-Median.md b/docs/src/examples/RCBM-Median.md index 9481256..3df03bc 100644 --- a/docs/src/examples/RCBM-Median.md +++ b/docs/src/examples/RCBM-Median.md @@ -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 diff --git a/docs/src/examples/Spectral-Procrustes.md b/docs/src/examples/Spectral-Procrustes.md index b64fec6..0ef2a97 100644 --- a/docs/src/examples/Spectral-Procrustes.md +++ b/docs/src/examples/Spectral-Procrustes.md @@ -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 @@ -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) diff --git a/examples/H2-Signal-TV.qmd b/examples/H2-Signal-TV.qmd index e5bf9aa..e866e9c 100644 --- a/examples/H2-Signal-TV.qmd +++ b/examples/H2-Signal-TV.qmd @@ -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) diff --git a/examples/RCBM-Median.qmd b/examples/RCBM-Median.qmd index e472443..4369782 100644 --- a/examples/RCBM-Median.qmd +++ b/examples/RCBM-Median.qmd @@ -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" diff --git a/examples/Spectral-Procrustes.qmd b/examples/Spectral-Procrustes.qmd index 8fe7dd2..378135b 100644 --- a/examples/Spectral-Procrustes.qmd +++ b/examples/Spectral-Procrustes.qmd @@ -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 , @@ -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) =