Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UTF8 Documentation rework #104

Merged
merged 79 commits into from
Feb 5, 2020
Merged
Show file tree
Hide file tree
Changes from 78 commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
436eb29
update documentation to use more utf8, especially in math.
kellertuer Jan 25, 2020
fade359
update documentation, where this might not be that useful.
kellertuer Jan 25, 2020
8fca61f
Adds a notation page.
kellertuer Jan 25, 2020
ed6a6f1
\circ -> ⚬
kellertuer Jan 25, 2020
5f00666
fixes circ, since I mistakenly took the wrong circ.
kellertuer Jan 25, 2020
8ab0928
refactors a few further M.
kellertuer Jan 25, 2020
ed30878
removes a spurious 𝒩.
kellertuer Jan 26, 2020
103f773
Update docs/src/notation.md
kellertuer Jan 28, 2020
4bbd3da
Update src/manifolds/Hyperbolic.jl
kellertuer Jan 28, 2020
ffdcb35
replaces \gets with ←
kellertuer Jan 28, 2020
9bac84d
Merge branch 'documentation-rework' of github.com:JuliaNLSolvers/Mani…
kellertuer Jan 28, 2020
3cfa995
\dots to …
kellertuer Jan 28, 2020
7aba7f8
Replaces \to with → in docstrings.
kellertuer Jan 28, 2020
b0db476
Replace greek letters.
kellertuer Jan 28, 2020
ab8dc0e
Replaces \in \neq and \colon with their utf8s.
kellertuer Jan 28, 2020
783cebb
Changes lfloor and lfloor to their utf8s.
kellertuer Jan 28, 2020
7427d2a
revert ⨉ back to \times.
kellertuer Jan 28, 2020
adf01f7
revert ◦ back to \circ.
kellertuer Jan 28, 2020
eadf25a
removes double-mentioned functions.
kellertuer Jan 28, 2020
c7e8bbf
Fixes the notations table.
kellertuer Jan 28, 2020
e87d942
Fixes a copy-paste-error.
kellertuer Jan 28, 2020
d8d3c59
removes a few files that I added accidentially.
kellertuer Jan 28, 2020
177363e
move from x to p (to avoid confusion with x and X), revert · to \cdot…
kellertuer Jan 29, 2020
b8d62cc
Reworks/unifies the circle.
kellertuer Jan 29, 2020
06d4058
Finishes the Torus by completeing a docstring, unifies docstringforma…
kellertuer Jan 29, 2020
2b47fda
Merge branch 'master' into documentation-rework
kellertuer Jan 30, 2020
4040b41
update Euclidean docstrings.
kellertuer Jan 30, 2020
0a76a38
Replace \infty with ∞
kellertuer Jan 30, 2020
59ba59b
Starts reworking FixedRank.
kellertuer Jan 30, 2020
2f8a1fa
finishes documentation and variables until end of Hyperbolic manifold.
kellertuer Jan 30, 2020
fa11394
Finishes rework of Metric- and Powermanifold as well as Stiefel
kellertuer Jan 30, 2020
9873a60
Refactor SPD notations, especially LogCholesky now has p,q (X,Y) for …
kellertuer Jan 30, 2020
3474cca
Fixes bugs introduces by renaming Cholsky.
kellertuer Jan 30, 2020
bebdb2d
refactor Sphere & Vector Bundle.
kellertuer Jan 31, 2020
4c904bd
Finishes Symmetric & Rotations, replaces \pi->π.
kellertuer Feb 1, 2020
c5f41a1
rework product manifold.
kellertuer Feb 1, 2020
49e6329
refactor to notation.md
kellertuer Feb 1, 2020
46cbc06
use speaking and longer field names.
kellertuer Feb 1, 2020
f3269de
fixes a typo.
kellertuer Feb 1, 2020
2c46963
Fixes a few more replacement bugs.
kellertuer Feb 1, 2020
ae10f7b
Finally renamex fields `.x` to `.point`
kellertuer Feb 1, 2020
968a942
Fixes further .manifold fields, though I have introduced a bug that I…
kellertuer Feb 1, 2020
57d340c
Fixes two minor typos that were introduced by refactoring.
kellertuer Feb 1, 2020
e463523
fixes two mingled docstrings.
kellertuer Feb 4, 2020
d5cb228
improve capitalization and extend notation.md
kellertuer Feb 4, 2020
6431b7d
Update docs/src/orthonormal_bases.md
kellertuer Feb 4, 2020
7621743
Update src/groups/group.jl
kellertuer Feb 4, 2020
a44bddc
replaces two further math notations by utf8
kellertuer Feb 4, 2020
fc176a6
Merge branch 'documentation-rework' of github.com:JuliaNLSolvers/Mani…
kellertuer Feb 4, 2020
6e8ccb4
Update src/manifolds/CholeskySpace.jl
kellertuer Feb 4, 2020
a514bf2
Update src/manifolds/Circle.jl
kellertuer Feb 4, 2020
78a9b74
Update src/manifolds/ProductManifold.jl
kellertuer Feb 4, 2020
0fc2b70
Update src/manifolds/ProductManifold.jl
kellertuer Feb 4, 2020
3c77b77
Update src/manifolds/ProductManifold.jl
kellertuer Feb 4, 2020
24c8589
Replace wedge and vee by their utf8 representations.
kellertuer Feb 4, 2020
e89dc64
Update src/manifolds/ProductManifold.jl
kellertuer Feb 4, 2020
5ec77b8
Update src/manifolds/Circle.jl
kellertuer Feb 4, 2020
b1614d0
undo \vee since it rendered as a large or, replace `\times` with ×.
kellertuer Feb 4, 2020
4224994
Return from caligraphic UTF8 to $\mathcal ...$
kellertuer Feb 4, 2020
21837c3
replace `\partial` with `∂`.
kellertuer Feb 4, 2020
ddd69b3
Apply suggestions from code review
kellertuer Feb 4, 2020
59be2b2
Replace `\Gamme` with `Γ`.
kellertuer Feb 4, 2020
2a10ef7
update `\dim`.
kellertuer Feb 4, 2020
fcd9977
Merge branch 'documentation-rework' of github.com:JuliaNLSolvers/Mani…
kellertuer Feb 4, 2020
e1c06b0
use `\dim` more consistently throughout the docs of `manifold_dimensi…
kellertuer Feb 4, 2020
07f25b7
rename B.v to B.frame_direction in the DiagonalizingONB.
kellertuer Feb 4, 2020
3f72d23
adds a few test cases, rename B.v to B.frame_direction and unify Met…
kellertuer Feb 4, 2020
8c9cca5
fixes documentation for project tangent on the circle and adds a test.
kellertuer Feb 4, 2020
102c755
unify Metric Manifold to not implement exp/log neither but only exp!/…
kellertuer Feb 4, 2020
0be2cf3
Fixes a typo in MetricManifolds log documentation and explains that f…
kellertuer Feb 4, 2020
d20ab25
change vout to Y, introduce Cartesian product and power to notation, …
kellertuer Feb 5, 2020
92940a7
unifies spacing in math formulae, trace to tr, and adds further terms…
kellertuer Feb 5, 2020
b06cad5
Apply suggestions from code review
kellertuer Feb 5, 2020
741085b
apply the remaining changes from review.
kellertuer Feb 5, 2020
e7bba5c
Finalize notations.md.
kellertuer Feb 5, 2020
64f798f
Merge branch 'documentation-rework' of github.com:JuliaNLSolvers/Mani…
kellertuer Feb 5, 2020
fcb4895
Fixes a final typo.
kellertuer Feb 5, 2020
4e21e0e
unifies usage of \dim.
kellertuer Feb 5, 2020
4bef2c9
updates another docstring.
kellertuer Feb 5, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ This can best be achieved by adding a docstring to the method with a general sig
````julia
struct MyManifold <: Manifold end

@doc doc"""
@doc raw"""
exp(M::MyManifold, x, v)

Describe the function.
Expand Down
4 changes: 3 additions & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ makedocs(
# for development, we disable prettyurls
format = Documenter.HTML(prettyurls = false),
modules = [Manifolds, ManifoldsBase],
sitename = "Manifolds",
authors = "Seth Axen, Mateusz Baran, Ronny Bergmann, and contributors.",
sitename = "Manifolds.jl",
pages = [
"Home" => "index.md",
"ManifoldsBase.jl" => "interface.md",
Expand Down Expand Up @@ -38,6 +39,7 @@ makedocs(
"Statistics" => "statistics.md",
"Distributions" => "distributions.md",
"Orthonormal bases" => "orthonormal_bases.md",
"Notation" => "notation.md",
"Library" => [
"Number systems" => "lib/numbers.md",
"Public" => "lib/public.md",
Expand Down
3 changes: 3 additions & 0 deletions docs/src/interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Allocation of new points is performed using a custom mechanism that relies on th
For more complex types, such as nested representations of [`PowerManifold`](@ref) (see [`NestedPowerRepresentation`](@ref)), [`FVector`](@ref) types, checked types like [`ArrayMPoint`](@ref) and more it operates differently.
While `similar` only concerns itself with the higher level of nested structures, `allocate` maps itself through all levels of nesting until a simple array of numbers is reached and then calls `similar`.
The difference can be most easily seen in the following example:

```julia
julia> x = similar([[1.0], [2.0]])
2-element Array{Array{Float64,1},1}:
Expand All @@ -56,6 +57,8 @@ Stacktrace:
julia> y[1]
1-element Array{Float64,1}:
6.90031725726027e-310

```

* [`allocate_result`](@ref) allocates a result of a particular function (for example [`exp`], [`flat`], etc.) on a particular manifold with particular arguments.
It takes into account the possibility that different arguments may have different numeric [`number_eltype`](@ref) types thorough the [`ManifoldsBase.allocate_result_type`](@ref) function.
2 changes: 0 additions & 2 deletions docs/src/lib/internals.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ Manifolds.SizedAbstractArray
```@docs
Manifolds._gradient
Manifolds._jacobian
ManifoldsBase.allocate_result_type
Manifolds.eigen_safe
Manifolds.find_pv
Manifolds.log_safe
ManifoldsBase.number_eltype
Manifolds.size_to_tuple
Manifolds.select_from_tuple
Manifolds.usinc
Expand Down
1 change: 0 additions & 1 deletion docs/src/lib/public.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
Documentation for `Manifolds.jl`'s public interface.

```@docs
allocate
Manifolds.ShapeSpecification
submanifold_component
submanifold_components
Expand Down
2 changes: 1 addition & 1 deletion docs/src/manifolds/euclidean.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Euclidean space

The Euclidean space $\mathbb R^n$ is a simple model space, since it has curvature constantly zero everywhere; hence, nearly all operations simplify.
The Euclidean space $^n$ is a simple model space, since it has curvature constantly zero everywhere; hence, nearly all operations simplify.

```@autodocs
Modules = [Manifolds]
Expand Down
6 changes: 4 additions & 2 deletions docs/src/manifolds/graph.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
For a given graph $G(V,E)$ implemented using [`LightGraphs.jl`](https://juliagraphs.github.io/LightGraphs.jl/latest/), the [`GraphManifold`](@ref) models a [`PowerManifold`](@ref) either on the nodes or edges of the graph, depending on the [`GraphManifoldType`](@ref).
i.e., it's either a $\mathcal M^{\lvert V \rvert}$ for the case of a vertex manifold or a $\mathcal M^{\lvert E \rvert}$ for the case of a edge manifold.

## Example:
## Example

To make a graph manifold over $ℝ^2$ with three vertices and two edges, one can use

To make a graph manifold over $\mathbb{R}^2$ with three vertices and two edges, one can use
```@example
using Manifolds
using LightGraphs
Expand All @@ -18,6 +19,7 @@ add_edge!(G, 1, 2)
add_edge!(G, 2, 3)
N = GraphManifold(G, M, VertexManifold())
```

It supports all [`AbstractPowerManifold`](@ref) operations (it is based on [`NestedPowerRepresentation`](@ref)) and furthermore it is possible to compute a graph logarithm:

```@setup graph-1
Expand Down
4 changes: 2 additions & 2 deletions docs/src/manifolds/product.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Product manifold

Product manifold $M = M_1 \times M_2 \times \dots M_n$ of manifolds $M_1, M_2, \dots, M_n$.
Points on the product manifold can be constructed using [`ProductRepr`](@ref) with canonical projections $\Pi_i \colon M \to M_i$ for $i \in 1, 2, \dots, n$ provided by [`submanifold_component`](@ref).
Product manifold $M = M_1 × M_2 × … M_n$ of manifolds $M_1, M_2, , M_n$.
Points on the product manifold can be constructed using [`ProductRepr`](@ref) with canonical projections $Π_i : M M_i$ for $i 1, 2, , n$ provided by [`submanifold_component`](@ref).

```@autodocs
Modules = [Manifolds]
Expand Down
12 changes: 6 additions & 6 deletions docs/src/manifolds/rotations.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Rotations

The manifold $\mathrm{SO}(n)$ of orthogonal matrices with determinant $+1$ in $\mathbb R^{n\times n}$, i.e.
The manifold $\mathrm{SO}(n)$ of orthogonal matrices with determinant $+1$ in $^{n× n}$, i.e.

$\mathrm{SO}(n) = \bigl\{R \in \mathbb{R}^{n\times n} \big| RR^{\mathrm{T}} =
R^{\mathrm{T}}R = \mathrm{I}_n, \det(R) = 1 \bigr\}$
$\mathrm{SO}(n) = \bigl\{R ∈ ℝ^{n × n} \big| RR^{\mathrm{T}} =
R^{\mathrm{T}}R = I_n, \det(R) = 1 \bigr\}$

The Lie group $\mathrm{SO}(n)$ is a subgroup of the orthogonal group $\mathrm{O}(n)$ and also known as the special orthogonal group or the set of rotations group.
See also [`SpecialOrthogonal`](@ref), which is this manifold equipped with the group operation.
Expand All @@ -12,9 +12,9 @@ Tangent vectors are represented by elements of the corresponding Lie algebra, wh
This convention allows for more efficient operations on tangent vectors.
Tangent spaces at different points are different vector spaces.

Let $L_R\colon \mathrm{SO}(n) \to \mathrm{SO}(n)$ where $R \in \mathrm{SO}(n)$ be the left-multiplication by $R$, that is $L_R(S) = RS$.
The tangent space at rotation $R$, $T_R \mathrm{SO}(n)$, is related to the tangent space at the identity rotation $\mathrm{I}_n$ by the differential of $L_R$ at identity, $(\mathrm{d}L_R)_{\mathrm{I}_n} \colon T_{\mathrm{I}_n} \mathrm{SO}(n) \to T_R \mathrm{SO}(n)$.
For a tangent vector at the identity rotation $v \in T_{\mathrm{I}_n} \mathrm{SO}(n)$ the matrix representation of the corresponding tangent vector $w$ at a rotation $R$ can be obtained by matrix multiplication: $w=Rv \in T_R \mathrm{SO}(n)$.
Let $L_R: \mathrm{SO}(n) \mathrm{SO}(n)$ where $R \mathrm{SO}(n)$ be the left-multiplication by $R$, that is $L_R(S) = RS$.
The tangent space at rotation $R$, $T_R \mathrm{SO}(n)$, is related to the tangent space at the identity rotation $I_n$ by the differential of $L_R$ at identity, $(\mathrm{d}L_R)_{I_n} : T_{I_n} \mathrm{SO}(n) T_R \mathrm{SO}(n)$.
For a tangent vector at the identity rotation $v T_{I_n} \mathrm{SO}(n)$ the matrix representation of the corresponding tangent vector $w$ at a rotation $R$ can be obtained by matrix multiplication: $w=Rv T_R \mathrm{SO}(n)$.
You can compare the functions [`log!(::Manifolds.Rotations, v, x, y)`](@ref) and [`exp!(::Manifolds.Rotations, y, x, v)`](@ref) to see how it works in practice.

```@autodocs
Expand Down
2 changes: 1 addition & 1 deletion docs/src/manifolds/symmetricpositivedefinite.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
The symmetric positive definite matrices

```math
\mathcal P(n) = \bigl\{ A \in \mathbb R^{n\times n}\ \big|\ A = A^{\mathrm{T}} \text{ and } x^{\mathrm{T}}Ax > 0 \text{ for } 0\neq x \in\mathbb R^n \bigr\}
\mathcal P(n) = \bigl\{ A ∈ ℝ^{n × n}\ \big|\ A = A^{\mathrm{T}} \text{ and } x^{\mathrm{T}}Ax > 0 \text{ for } 0 ≠ x ∈ ℝ^n \bigr\}
```

```@docs
Expand Down
6 changes: 3 additions & 3 deletions docs/src/manifolds/torus.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Torus
The torus $\mathbb T^d \equiv [-π,π)^d$ is modeled as an [`AbstractPowerManifold`](@ref) of
The torus $𝕋^d \cong [-π,π)^d$ is modeled as an [`AbstractPowerManifold`](@ref) of
the (real-valued) [`Circle`](@ref) and uses [`MultidimentionalArrayPowerRepresentation`](@ref).
Points on the torus are hence row vectors, $x\in\mathbb R^{d}$.
Points on the torus are hence row vectors, $x ∈ ℝ^{d}$.

## Example

The following code can be used to make a three-dimensional torus $\mathbb{T}^3$ and compute a tangent vector.
The following code can be used to make a three-dimensional torus $𝕋^3$ and compute a tangent vector.
```@example
using Manifolds
M = Torus(3)
Expand Down
4 changes: 2 additions & 2 deletions docs/src/manifolds/vector_bundle.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Vector bundles

Vector bundle $E$ is a manifold that is built on top of another manifold $M$ (base space).
It is characterized by a continuous function $\Pi \colon E \to M$, such that for each point $x \in M$ the preimage of $x$ by $\Pi$, $\Pi^{-1}(\{x\})$, has a structure of a vector space.
Vector bundle $E$ is a manifold that is built on top of another manifold $\mathcal M$ (base space).
It is characterized by a continuous function $Π : E → \mathcal M$, such that for each point $p ∈ \mathcal M$ the preimage of $p$ by $Π$, $Π^{-1}(\{p\})$, has a structure of a vector space.
These vector spaces are called fibers.
Bundle projection can be performed using function [`bundle_projection`](@ref).

Expand Down
41 changes: 41 additions & 0 deletions docs/src/notation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Notation overview

Since manifolds include a reasonable amount of elements and functions, the following list tries to keep an overview of used notation throughout `Manifolds.jl`.
The order is alphabetically by name.
They might be used in a plain form within the code or when referring to that code.
This is for example the case the calligraphic symbols.

Within the documented functions the utf8 symbols are used whenever possible,
as long as that renders still in $\TeX$ within this documentation.

| Symbol | Description | Also used | Comment |
|:--:|:--------------- |:--:|:-- |
| $\times$ | Cartesian product of two manifolds | | see [`ProductManifold`](@ref) |
| $^{\wedge}$ | (n-ary) Cartesian power of a manifold | | see [`PowerManifold`](@ref) |
| $T^*_p \mathcal M$ | the cotangent space at $p$ | | |
| $\xi$ | a cotangent vector from $T^*_p \mathcal M$ | $\xi_1, \xi_2,\ldots,\eta,\zeta$ | sometimes written with base point $\xi_p$. |
| $n$ | dimension (of a manifold) | $n_1,n_2,\ldots,m, \dim(\mathcal M)$| for the real dimension sometimes also $\dim_{\mathbb R}(\mathcal M)$|
| $d(\cdot,\cdot)$ | (Riemannian) distance | $d_{\mathcal M}(\cdot,\cdot)$ | |
| $F$ | a fiber | | |
| $\mathbb F$ | a field | | field a manifold is based on, usually $\mathbb F \in \{\mathbb R,\mathbb C\}$ |
| $\gamma$ | a geodesic | $\gamma_{p;q}$, $\gamma_{p,X}$ | connecting two points $p,q$ or starting in $p$ with velocity $X$. |
| $\circ$ | a group operation | |
| $\cdot^\mathrm{H}$ | Hermitian or conjugate transposed| |
| $e$ | identity element of a group | |
| $I_k$ | identity matrix of size $k\times k$ | |
| $k$ | indices | $i,j$ | |
| $\langle\cdot,\cdot\rangle$ | inner product (in $T_p \mathcal M$) | $\langle\cdot,\cdot\rangle_p, g_p(\cdot,\cdot)$ |
| $\mathfrak g$ | a Lie algebra | |
| $\mathcal{G}$ | a (Lie) group | |
| $\mathcal M$ | a manifold | $\mathcal M_1, \mathcal M_2,\ldots,\mathcal N$ | |
| $\operatorname{Exp}$ | the matrix exponential | |
| $\operatorname{Log}$ | the matrix logarithm | |
| $\mathcal P_{q\gets p}X$ | parallel transport | | of the vector $X$ from $T_p\mathcal M$ to $T_q\mathcal M$
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain the use of this notation vs P_{p \to q} ? The latter seems to read better to me.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats easy, if you concatenate parallel transports $P_{q\gets p}P_{p\gets s}X$, i.e. you transport X from s -> p -> q this version is far better readable than $P_{p\to q}P_{s\to p}$ since for this the order is obscured. The first one can be read just from right to left.

| $p$ | a point on $\mathcal M$ | $p_1, p_2, \ldots,q$ | for 3 points one might use $x,y,z$ |
| $\Xi$ | a set of tangent vectors | $\{X_1,\ldots,X_n\}$ | |
| $T_p \mathcal M$ | the tangent space at $p$ | | |
| $X$ | a tangent vector from $T_p \mathcal M$ | $X_1,X_2,\ldots,Y,Z$ | sometimes written with base point $X_p$ |
| $\operatorname{tr}$ | trace (of a matrix) | |
| $\cdot^\mathrm{T}$ | transposed | |
| $B$ | a vector bundle | |
| $0_k$ | the $k\times k$ zero matrix. | |
4 changes: 2 additions & 2 deletions docs/src/orthonormal_bases.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Orthonormal bases

The following functions and types provide support for orthonormal bases of the tangent space of different manifolds.
An orthonormal basis of the tangent space $T_x M$ of (real) dimension $N$ has a real-coefficient basis $e_1, e_2, \dots, e_N$ if $\mathrm{Re}(g_x(e_i, e_j)) = \delta_{ij}$ for each $i,j \in \{1, 2, \dots, N\}$ where $g_x$ is the Riemannian metric at point $x$.
A vector $v$ from the tangent space $T_x M$ can be expressed as a sum $v = v^i e_i$ where coefficients $v^i$ are calculated as $v^i = \mathrm{Re}(g_x(v, e_i))$.
An orthonormal basis of the tangent space $T_x \mathcal M$ of (real) dimension $N$ has a real-coefficient basis $e_1, e_2, , e_N$ if $\mathrm{Re}(g_x(e_i, e_j)) = \delta_{ij}$ for each $i,j \{1, 2, , N\}$ where $g_x$ is the Riemannian metric at point $x$.
A vector $v$ from the tangent space $T_x \mathcal M$ can be expressed in Einstein notation as a sum $v = v^i e_i$ where coefficients $v^i$ are calculated as $v^i = \mathrm{Re}(g_x(v, e_i))$.

The main types are:
* [`ArbitraryOrthonormalBasis`](@ref), which is designed to work when no special properties of the tangent space basis are required.
Expand Down
58 changes: 29 additions & 29 deletions src/Manifolds.jl
Original file line number Diff line number Diff line change
Expand Up @@ -108,63 +108,63 @@ Abstract type for defining statistical estimation methods.
"""
abstract type AbstractEstimationMethod end

@doc doc"""
hat(M::Manifold, x, vⁱ)
@doc raw"""
hat(M::Manifold, p, Xⁱ)

Given a basis $e_i$ on the tangent space at a point $x$ and tangent
component vector $v^i$, compute the equivalent vector representation
$v=v^i e_i$, where Einstein summation notation is used:
Given a basis $e_i$ on the tangent space at a point `p` and tangent
component vector $X^i$, compute the equivalent vector representation
$X=X^i e_i$, where Einstein summation notation is used:

````math
\wedge: v^i \mapsto v^i e_i
∧ : X^i ↦ X^i e_i
````

For array manifolds, this converts a vector representation of the tangent
vector to an array representation. The [`vee`](@ref) map is the `hat` map's
inverse.
"""
function hat(M::Manifold, x, vⁱ)
v = allocate_result(M, hat, x, vⁱ)
return hat!(M, v, x, vⁱ)
function hat(M::Manifold, p, Xⁱ)
X = allocate_result(M, hat, p, Xⁱ)
return hat!(M, X, p, Xⁱ)
end

function hat!(M::Manifold, v, x, vⁱ)
is_decorator_manifold(M) === Val(true) && return hat!(base_manifold(M), v, x, vⁱ)
error("hat! operator not defined for manifold $(typeof(M)), array $(typeof(v)), point $(typeof(x)), and vector $(typeof(vⁱ))")
function hat!(M::Manifold, X, p, Xⁱ)
is_decorator_manifold(M) === Val(true) && return hat!(base_manifold(M), X, p, Xⁱ)
error("hat! operator not defined for manifold $(typeof(M)), array $(typeof(X)), point $(typeof(p)), and vector $(typeof(Xⁱ))")
end

@doc doc"""
vee(M::Manifold, x, v)
@doc raw"""
vee(M::Manifold, p, X)

Given a basis $e_i$ on the tangent space at a point $x$ and tangent
vector $v$, compute the vector components $v^i$, such that $v = v^i e_i$, where
Given a basis $e_i$ on the tangent space at a point `p` and tangent
vector `X`, compute the vector components $X^i$, such that $X = X^i e_i$, where
Einstein summation notation is used:

````math
\vee: v^i e_i \mapsto v^i
\vee : X^i e_i ↦ X^i
````

For array manifolds, this converts an array representation of the tangent
vector to a vector representation. The [`hat`](@ref) map is the `vee` map's
inverse.
"""
function vee(M::Manifold, x, v)
vⁱ = allocate_result(M, vee, x, v)
return vee!(M, vⁱ, x, v)
function vee(M::Manifold, p, X)
Xⁱ = allocate_result(M, vee, p, X)
return vee!(M, Xⁱ, p, X)
end

function vee!(M::Manifold, vⁱ, x, v)
is_decorator_manifold(M) === Val(true) && return vee!(base_manifold(M), vⁱ, x, v)
error("vee! operator not defined for manifold $(typeof(M)), vector $(typeof(vⁱ)), point $(typeof(x)), and array $(typeof(v))")
function vee!(M::Manifold, Xⁱ, p, X)
is_decorator_manifold(M) === Val(true) && return vee!(base_manifold(M), Xⁱ, p, X)
error("vee! operator not defined for manifold $(typeof(M)), vector $(typeof(Xⁱ)), point $(typeof(p)), and array $(typeof(X))")
end

function allocate_result(M::Manifold, f::typeof(vee), x, v)
T = allocate_result_type(M, f, (x, v))
return allocate(x, T, manifold_dimension(M))
function allocate_result(M::Manifold, f::typeof(vee), p, X)
T = allocate_result_type(M, f, (p, X))
return allocate(p, T, manifold_dimension(M))
end
function allocate_result(M::Manifold, f::typeof(vee), x::StaticArray, v)
T = allocate_result_type(M, f, (x, v))
return allocate(x, T, Size(manifold_dimension(M)))
function allocate_result(M::Manifold, f::typeof(vee), p::StaticArray, X)
T = allocate_result_type(M, f, (p, X))
return allocate(p, T, Size(manifold_dimension(M)))
end

"""
Expand Down
30 changes: 15 additions & 15 deletions src/autodiff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,22 @@ Get vector of currently valid AD backends.
adbackends() = _adbackends

"""
_gradient(f, x::Number, backend = adbackend()) -> Number
_gradient(f, x::Array, backend = adbackend()) -> Array
_gradient(f, p::Number, backend = adbackend()) -> Number
_gradient(f, p::Array, backend = adbackend()) -> Array

Compute gradient of function `f` at point `x` using AD backend `backend`.
Compute gradient of function `f` at `x` using AD backend `backend`.
"""
_gradient(f, x) = _gradient(f, x, Val(adbackend()))
_gradient(f, x, backend::Symbol) = _gradient(f, x, Val(adbackend(backend)))
_gradient(f, p) = _gradient(f, p, Val(adbackend()))
_gradient(f, p, backend::Symbol) = _gradient(f, p, Val(adbackend(backend)))

"""
_jacobian(f, x::Array, backend = adbackend()) -> Array
_jacobian(f, p, backend = adbackend()) -> Array

Compute Jacobian matrix of function `f` at point `x` using AD backend `backend`.
Compute Jacobian matrix of function `f` at `p` using AD backend `backend`.
Inputs and outputs of `f` are vectorized.
"""
_jacobian(f, x) = _jacobian(f, x, Val(adbackend()))
_jacobian(f, x, backend::Symbol) = _jacobian(f, x, Val(adbackend(backend)))
_jacobian(f, p) = _jacobian(f, p, Val(adbackend()))
_jacobian(f, p, backend::Symbol) = _jacobian(f, p, Val(adbackend(backend)))

# Finite differences

Expand All @@ -64,14 +64,14 @@ adbackend!(:finitedifferences)

_default_fdm() = central_fdm(5, 1)

_gradient(f, x, backend::Val{:finitedifferences}) = _gradient(f, x, _default_fdm())
_gradient(f, p, backend::Val{:finitedifferences}) = _gradient(f, p, _default_fdm())

function _gradient(f, x, fdm::FiniteDifferences.FiniteDifferenceMethod)
return FiniteDifferences.grad(fdm, f, x)[1]
function _gradient(f, p, fdm::FiniteDifferences.FiniteDifferenceMethod)
return FiniteDifferences.grad(fdm, f, p)[1]
end

_jacobian(f, x, backend::Val{:finitedifferences}) = _jacobian(f, x, _default_fdm())
_jacobian(f, p, backend::Val{:finitedifferences}) = _jacobian(f, p, _default_fdm())

function _jacobian(f, x, fdm::FiniteDifferences.FiniteDifferenceMethod)
return FiniteDifferences.jacobian(fdm, f, x)[1]
function _jacobian(f, p, fdm::FiniteDifferences.FiniteDifferenceMethod)
return FiniteDifferences.jacobian(fdm, f, p)[1]
end
4 changes: 2 additions & 2 deletions src/distributions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ struct FVectorvariate <: VariateForm end
FVectorSupport(space::Manifold, VectorBundleFibers)

Value support for vector bundle fiber-valued distributions (values from a fiber of a vector
bundle at point `x` from the given manifold).
bundle at a `point` from the given manifold).
For example used for tangent vector-valued distributions.
"""
struct FVectorSupport{TSpace<:VectorBundleFibers,T} <: ValueSupport
space::TSpace
x::T
point::T
end

"""
Expand Down
Loading