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

Atlases and charts #325

Merged
merged 83 commits into from
May 22, 2021
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
8b06608
initial work on atlases
mateuszbaran Jan 13, 2021
0fecdae
formatting
mateuszbaran Jan 13, 2021
76c8a37
Fixing det_local_metric
mateuszbaran Jan 13, 2021
f7dee55
transition maps and some mutating variants
mateuszbaran Jan 14, 2021
96ca9b4
some work on cotangent spaces
mateuszbaran Jan 17, 2021
fb784e7
fixing metric tests
mateuszbaran Jan 17, 2021
5a34d65
progress on new flat/sharp
mateuszbaran Jan 19, 2021
fd4251e
formatting
mateuszbaran Jan 19, 2021
f2a9e74
fixing flat and sharp
mateuszbaran Jan 20, 2021
6e9d543
FVector cleanup
mateuszbaran Jan 20, 2021
8729de6
formatting
mateuszbaran Jan 20, 2021
d9ac30e
select_chart -> get_chart_index
mateuszbaran Jan 20, 2021
aac1224
select_chart -> get_chart_index
mateuszbaran Jan 20, 2021
bf13b6a
basis related fixes, mostly
mateuszbaran Jan 22, 2021
b586ef4
removing unnecessary inner method
mateuszbaran Jan 27, 2021
6ee949f
Merge branch 'master' into mbaran/atlases
mateuszbaran Jan 27, 2021
e92aea2
marking some metric tests broken and small fixes
mateuszbaran Jan 29, 2021
229976c
formatting
mateuszbaran Jan 29, 2021
f7b13f1
first part of stereographic atlas
mateuszbaran Feb 12, 2021
cd6bcde
fixed some broken tests
mateuszbaran Feb 12, 2021
08cf67c
fixing metric tests
mateuszbaran Feb 15, 2021
2cae2a6
minor addition to StereographicAtlas
mateuszbaran Feb 16, 2021
068696a
improvements to StereographicAtlas
mateuszbaran Feb 18, 2021
48018a6
Merge branch 'master' into mbaran/atlases
mateuszbaran Feb 19, 2021
00d3886
some documentation
mateuszbaran Feb 19, 2021
c874115
minor improvements
mateuszbaran Mar 5, 2021
ee5716b
Merge branch 'master' into mbaran/atlases
mateuszbaran Mar 12, 2021
d979df0
minor docs changes
mateuszbaran Mar 12, 2021
b493d81
documentation improvements
mateuszbaran Mar 12, 2021
df0da2a
zero_tangent_vector -> zero_vector
mateuszbaran Mar 12, 2021
eaa3f14
formatting
mateuszbaran Mar 12, 2021
cf5fff4
version bumped
mateuszbaran Mar 12, 2021
1e2782a
@doc doc -> @doc raw
mateuszbaran Mar 16, 2021
6440064
improved documentation of get_chart_index
mateuszbaran Mar 18, 2021
6e79094
fix two tests on metric group manifold
mateuszbaran Mar 19, 2021
d134eef
updated notation and docs
mateuszbaran Mar 19, 2021
9a268a1
Merge branch 'master' into mbaran/atlases
mateuszbaran Mar 30, 2021
8300eac
Merge branch 'master' into mbaran/atlases
mateuszbaran Mar 30, 2021
a0b1922
mutating flat/sharp fixes, minor fixes
mateuszbaran Mar 30, 2021
bea30ba
Merge branch 'master' into mbaran/atlases
mateuszbaran Mar 30, 2021
c17b1d0
docs cleanup
mateuszbaran Mar 30, 2021
ebf9b52
docs improvements
mateuszbaran Mar 30, 2021
289cb6c
Apply suggestions from code review
mateuszbaran Apr 7, 2021
87b50ec
Project.toml version compat
mateuszbaran Apr 7, 2021
6c37fdf
Merge branch 'master' into mbaran/atlases
mateuszbaran Apr 7, 2021
291bfa1
change order of parameters in RetractionAtlas; formatting
mateuszbaran Apr 7, 2021
ab25d4a
basis moved to the last position on argument lists of metric-related …
mateuszbaran Apr 7, 2021
15e1f5e
two methods moved to PowerManifold.jl
mateuszbaran Apr 7, 2021
10398bd
small disambiguation
mateuszbaran Apr 7, 2021
1477751
number system type param for atlases
mateuszbaran Apr 8, 2021
d5e9d9b
some generic atlas tests
mateuszbaran Apr 8, 2021
95278c2
formatting
mateuszbaran Apr 8, 2021
a02b2df
Merge branch 'master' into mbaran/atlases
mateuszbaran Apr 19, 2021
11fdb21
rename all the things
mateuszbaran Apr 19, 2021
d52df66
a few new tests and updating old methods
mateuszbaran Apr 21, 2021
ac84992
document relation of bases and metric-related functions
mateuszbaran Apr 26, 2021
0f0569f
corrected argument order around EuclideanMetric
mateuszbaran May 4, 2021
887697c
Merge branch 'master' into mbaran/atlases
mateuszbaran May 4, 2021
b151689
this test requires a fix in ManifoldsBase
mateuszbaran May 7, 2021
2856319
... or maybe not
mateuszbaran May 7, 2021
72c87b3
Metric -> AbstractMetric
mateuszbaran May 7, 2021
b5dc53d
check_manifold_point -> check_point
mateuszbaran May 7, 2021
730f646
is_manifold_point -> is_point
mateuszbaran May 7, 2021
c8b16dd
*_tangent_vector -> *_vector
mateuszbaran May 7, 2021
14ead0c
check_base_point removed from check_vector
mateuszbaran May 8, 2021
095b24b
docs adjustments
mateuszbaran May 8, 2021
bde1a7a
Merge branch 'master' into mbaran/atlases
mateuszbaran May 19, 2021
ce0acf6
fixes
mateuszbaran May 19, 2021
04e5b0f
documenter project update
mateuszbaran May 19, 2021
60c1bf1
ManifoldsBase version compat
mateuszbaran May 19, 2021
c3feee3
small fixes
mateuszbaran May 19, 2021
c10966d
specialized flat/sharp for product manifold removed and one more test
mateuszbaran May 19, 2021
9ae9c77
minor changes
mateuszbaran May 20, 2021
eb6c735
more tests and some exports
mateuszbaran May 20, 2021
0750b3d
more tests
mateuszbaran May 20, 2021
8fe15b4
new test, removed some unused code
mateuszbaran May 20, 2021
3f0b2ad
improve error message and test coverage
kellertuer May 21, 2021
208e1fa
increase test coverage.
kellertuer May 21, 2021
7e09d7e
export a few more atlas and InducedBasis related functions.
kellertuer May 21, 2021
c3a56da
Adds a test for aribtrary Euclidean metric related induced bases.
kellertuer May 21, 2021
3c08828
start a power and product manifold metric test.
kellertuer May 21, 2021
cab06fe
removed two methods of det_local_metric
mateuszbaran May 21, 2021
87fa5fa
two untested methods deleted
mateuszbaran May 21, 2021
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
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ The non-mutating one (e.g. `exp`) always falls back to use the mutating one, so
suffice to implement the mutating one (e.g. `exp!`).

Note that since the first argument is _always_ the [`Manifold`](https://juliamanifolds.github.io/Manifolds.jl/latest/interface.html#ManifoldsBase.Manifold), the mutated argument is always the second one in the signature.
In the example we have `exp(M, x, v)` for the exponential map and `exp!(M, y, v, x)` for the mutating one, that stores the result in `y`.
In the example we have `exp(M, p, X)` for the exponential map and `exp!(M, q, X, p)` for the mutating one, that stores the result in `q`.
mateuszbaran marked this conversation as resolved.
Show resolved Hide resolved

On the other hand, the user will most likely look for the documentation of the non-mutating version, so we recommend adding the docstring for the non-mutating one, where all different signatures should be collected in one string when reasonable.
This can best be achieved by adding a docstring to the method with a general signature with the first argument being your manifold:
Expand All @@ -59,7 +59,7 @@ This can best be achieved by adding a docstring to the method with a general sig
struct MyManifold <: Manifold end

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

Describe the function.
"""
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Manifolds"
uuid = "1cead3c2-87b3-11e9-0ccd-23c62b72b94e"
authors = ["Seth Axen <[email protected]>", "Mateusz Baran <[email protected]>", "Ronny Bergmann <[email protected]>", "Antoine Levitt <[email protected]>"]
version = "0.4.17"
version = "0.5.0"

[deps]
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
Expand Down
1 change: 1 addition & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ makedocs(
],
],
"Features on Manifolds" => [
"Atlases and charts" => "features/atlases.md",
"Differentiation" => "features/differentiation.md",
"Distributions" => "features/distributions.md",
"Statistics" => "features/statistics.md",
Expand Down
44 changes: 44 additions & 0 deletions docs/src/features/atlases.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# [Atlases and charts](@id atlases_and_charts)

Atlases on an $n$-dimensional manifold $\mathcal M$ are collections of charts $\{(U_i, \varphi_i) \colon i \in I\}$ such that $U_i \subseteq \mathcal M$ and each chart $\varphi_i$ is a function from $U_i$ to $\mathbb{R}^n$.
They provide a basic connection between manifolds and Euclidean spaces.

Most operations on manifolds in `Manifolds.jl` avoid operating in a chart through appropriate embeddings and formulas derived for particular manifolds, though atlases provide the most general way of working with manifolds.
They are extensively used in metric-related functions on [`MetricManifold`](@ref Main.Manifolds.MetricManifold)s.
kellertuer marked this conversation as resolved.
Show resolved Hide resolved

Atlases are represented by objects of subtypes of [`AbstractAtlas`](@ref Main.Manifolds.AbstractAtlas).
There are no type restrictions for indices of charts in atlases.

Operations using atlases and charts are available through the following functions:

* [`get_chart_index`](@ref Main.Manifolds.get_chart_index) can be used to select an appropriate chart for the neighborhood of a given point.
* [`get_point_coordinates`](@ref Main.Manifolds.get_point_coordinates) converts a point to its coordinates in a chart.
* [`get_point`](@ref Main.Manifolds.get_point) converts coordinates in a chart to the point that corresponds to them.
* [`induced_basis`](@ref Main.Manifolds.induced_basis) returns a basis of a given vector space at a point induced by a chart.
* [`transition_map`](@ref Main.Manifolds.transition_map) converts coordinates of a point between two charts.

```@autodocs
Modules = [Manifolds,ManifoldsBase]
Pages = ["atlases.jl"]
Order = [:type, :function]
```

## Cotangent space

Related to atlases, there is also support for the cotangent space and coefficients of
cotangent vectors in bases of the cotangent space.
mateuszbaran marked this conversation as resolved.
Show resolved Hide resolved

```@autodocs
Modules = [Manifolds,ManifoldsBase]
Pages = ["cotangent_space.jl"]
Order = [:type, :function]
```

## Musical isomorphisms

Functions [`sharp`](@ref) and [`flat`](@ref) implement musical isomorphisms for arbitrary vector bundles.

```@docs
sharp
flat
```
2 changes: 1 addition & 1 deletion docs/src/features/differentiation.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ Order = [:type, :function, :constant]
Modules = [Manifolds]
Pages = ["riemannian_diff.jl"]
Order = [:type, :function, :constant]
```
```
20 changes: 16 additions & 4 deletions docs/src/interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,20 @@ julia> y[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.
* [`allocate_result`](@ref) allocates a result of a particular function (for example [`exp`](@ref), [`flat`](@ref), 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.

## Bases

The following functions and types provide support for bases of the tangent space of different manifolds.
The following functions and types provide support for bases of a the tangent space of different manifolds.
mateuszbaran marked this conversation as resolved.
Show resolved Hide resolved
Moreover, bases of the cotangent space are also supported, though this description focuses on the tangent space.
An orthonormal basis of the tangent space $T_p \mathcal M$ of (real) dimension $n$ has a real-coefficient basis $e_1, e_2, …, e_n$ if $\mathrm{Re}(g_p(e_i, e_j)) = δ_{ij}$ for each $i,j ∈ \{1, 2, …, n\}$ where $g_p$ is the Riemannian metric at point $p$.
A vector $X$ from the tangent space $T_p \mathcal M$ can be expressed in Einstein notation as a sum $X = X^i e_i$, where (real) coefficients $X^i$ are calculated as $X^i = \mathrm{Re}(g_p(X, e_i))$.

Bases are closely related to [atlases](@ref atlases_and_charts).

The main types are:

* [`DefaultOrthonormalBasis`](@ref), which is designed to work when no special properties of the tangent space basis are required.
It is designed to make [`get_coordinates`](@ref) and [`get_vector`](@ref) fast.
* [`DiagonalizingOrthonormalBasis`](@ref), which diagonalizes the curvature tensor and makes the curvature in the selected direction equal to 0.
Expand All @@ -86,12 +90,20 @@ The main functions are:
* [`get_vector`](@ref) returns a vector for the specified coordinates.
* [`get_vectors`](@ref) returns a vector of basis vectors. Calling it should be avoided for high-dimensional manifolds.

Coordinates of a vector in a basis can be stored in an [`FVector`](@ref) to explicitly indicate which basis they are expressed in. It is useful to avoid potential ambiguities.
mateuszbaran marked this conversation as resolved.
Show resolved Hide resolved

```@autodocs
Modules = [ManifoldsBase,Manifolds]
Pages = ["bases.jl"]
Order = [:type, :function]
```

```@autodocs
Modules = [ManifoldsBase,Manifolds]
Pages = ["vector_spaces.jl"]
Order = [:type, :function]
```

## Vector transport

There are three main functions for vector transport:
Expand Down Expand Up @@ -143,8 +155,8 @@ Order = [:macro, :type, :function]
## Abstract Power Manifold

```@autodocs
Modules = [ ManifoldsBase]
Pages = ["PowerManifold.jl"]
Modules = [Manifolds, ManifoldsBase]
Pages = ["src/PowerManifold.jl"]
Order = [:macro, :type, :function]
```

Expand Down
6 changes: 6 additions & 0 deletions docs/src/manifolds/sphere.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ To create the unit sphere of $3×2$ real-valued matrices, write `ArraySphere(3,2
ArraySphere
```

There is also one atlas available on the sphere.

```@docs
Manifolds.StereographicAtlas
```

## Functions on unit spheres
```@autodocs
Modules = [Manifolds]
Expand Down
1 change: 1 addition & 0 deletions docs/src/misc/notation.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Within the documented functions, the utf8 symbols are used whenever possible, as
| ``\tau_p`` | action map by group element ``p`` | ``\mathrm{L}_p``, ``\mathrm{R}_p`` | either left or right |
| ``\times`` | Cartesian product of two manifolds | | see [`ProductManifold`](@ref) |
| ``^{\wedge}`` | (n-ary) Cartesian power of a manifold | | see [`PowerManifold`](@ref) |
| ``a`` | coordinates of a point in a chart | | see [`Manifolds.get_point_coordinates`](@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``. |
| ``\mathrm{d}\phi_p(q)`` | Differential of a map ``\phi: \mathcal M \to \mathcal N`` with respect to ``p`` at a point ``q``. For functions of multiple variables, for example ``\phi(p, p_1)`` where ``p \in \mathcal M`` and ``p_1 \in \mathcal M_1``, variable ``p`` is explicitly stated to specify with respect to which argument the differential is calculated. | ``\mathrm{d}\phi_q``, ``(\mathrm{d}\phi)_q``, ``(\phi_*)_q``, ``D_p\phi(q)`` | pushes tangent vectors ``X \in T_q \mathcal M`` forward to ``\mathrm{d}\phi_p(q)[X] \in T_{\phi(q)} \mathcal N`` |
Expand Down
24 changes: 18 additions & 6 deletions src/Manifolds.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import ManifoldsBase:
decorator_transparent_dispatch,
default_decorator_dispatch,
distance,
dual_basis,
embed,
embed!,
exp!,
Expand Down Expand Up @@ -53,12 +54,15 @@ import ManifoldsBase:
retract,
retract!,
set_component!,
vector_space_dimension,
vector_transport_direction,
vector_transport_direction!,
vector_transport_to,
vector_transport_to!,
zero_tangent_vector,
zero_tangent_vector!
zero_vector,
zero_vector!,
CotangentSpace,
TangentSpace
import Base: copyto!, convert, in, isapprox, isempty, length, showerror

using Base.Iterators: repeated
Expand All @@ -82,17 +86,24 @@ using ManifoldsBase:
AbstractPowerRepresentation,
AbstractVectorTransportMethod,
AbstractLinearVectorTransportMethod,
DifferentiatedRetractionVectorTransport,
ComponentManifoldError,
CompositeManifoldError,
CotangentSpaceType,
CoTFVector,
DefaultManifold,
DefaultOrDiagonalizingBasis,
DiagonalizingBasisData,
DifferentiatedRetractionVectorTransport,
FVector,
InversePowerRetraction,
PowerManifold,
PowerManifoldNested,
PowerRetraction,
PowerVectorTransport,
TangentSpaceType,
TCoTSpaceType,
TFVector,
VectorSpaceType,
VeeOrthogonalBasis,
@decorator_transparent_fallback,
@decorator_transparent_function,
Expand All @@ -119,6 +130,9 @@ using StatsBase
using StatsBase: AbstractWeights

include("utils.jl")

include("atlases.jl")
include("cotangent_space.jl")
include("differentiation.jl")
include("riemannian_diff.jl")

Expand Down Expand Up @@ -461,9 +475,7 @@ export ×,
vee,
vee!,
zero_vector,
zero_vector!,
zero_tangent_vector,
zero_tangent_vector!
zero_vector!
# Lie group types & functions
export AbstractGroupAction,
AbstractGroupOperation,
Expand Down
Loading