Sphere and unit norm arrays
Manifolds.AbstractSphere
โ TypeAbstractSphere{๐ฝ} <: AbstractEmbeddedManifold{๐ฝ,DefaultIsometricEmbeddingType}
An abstract type to represent a unit sphere that is represented isometrically in the embedding.
The classical sphere, i.e. unit norm (real- or complex-valued) vectors can be generated as usual: to create the 2-dimensional sphere (in $โ^3$), use Sphere(2)
and Sphere(2,โ)
, respectively.
Manifolds.Sphere
โ TypeSphere{n,๐ฝ} <: AbstractSphere{๐ฝ}
The (unit) sphere manifold $๐^{n}$ is the set of all unit norm vectors in $๐ฝ^{n+1}$. The sphere is represented in the embedding, i.e.
where $๐ฝ\in\{โ,โ,โ\}$. Note that compared to the ArraySphere
, here the argument n
of the manifold is the dimension of the manifold, i.e. $๐^{n} โ ๐ฝ^{n+1}$, $n\in โ$.
The tangent space at point $p$ is given by
where $๐ฝ\in\{โ,โ,โ\}$ and $โจ\cdot,\cdotโฉ$ denotes the inner product in the embedding $๐ฝ^{n+1}$.
For $๐ฝ=โ$, the manifold is the complex sphere, written $โ๐^n$, embedded in $โ^{n+1}$. $โ๐^n$ is the complexification of the real sphere $๐^{2n+1}$. Likewise, the quaternionic sphere $โ๐^n$ is the quaternionification of the real sphere $๐^{4n+3}$. Consequently, $โ๐^0$ is equivalent to $๐^1$ and Circle
, while $โ๐^1$ and $โ๐^0$ are equivalent to $๐^3$, though with different default representations.
This manifold is modeled as a special case of the more general case, i.e. as an embedded manifold to the Euclidean
, and several functions like the inner
product and the zero_tangent_vector
are inherited from the embedding.
Constructor
Sphere(n[, field=โ])
Generate the (real-valued) sphere $๐^{n} โ โ^{n+1}$, where field
can also be used to generate the complex- and quaternionic-valued sphere.
For the higher-dimensional arrays, for example unit (Frobenius) norm matrices, the manifold is generated using the size of the matrix. To create the unit sphere of $3ร2$ real-valued matrices, write ArraySphere(3,2)
and the complex case is done โ as for the Euclidean
case โ with an keyword argument ArraySphere(3,2; field = โ)
. This case also covers the classical sphere as a special case, but you specify the size of the vectors/embedding instead: The 2-sphere can here be generated ArraySphere(3)
.
Manifolds.ArraySphere
โ TypeArraySphere{T<:Tuple,๐ฝ} <: AbstractSphere{๐ฝ}
The (unit) sphere manifold $๐^{nโ,nโ,...,nแตข}$ is the set of all unit (Frobenius) norm elements of $๐ฝ^{nโ,nโ,...,nแตข}$, where ๐ฝ\in{โ,โ,โ}. The generalized sphere is represented in the embedding, and supports arbitrary sized arrays or in other words arbitrary tensors of unit norm. The set formally reads
where $๐ฝ\in\{โ,โ,โ\}$. Setting $i=1$ and $๐ฝ=โ$ this simplifies to unit vectors in $โ^n$, see Sphere
for this special case. Note that compared to this classical case, the argument for the generalized case here is given by the dimension of the embedding. This means that Sphere(2)
and ArraySphere(3)
are the same manifold.
The tangent space at point $p$ is given by
where $๐ฝ\in\{โ,โ,โ\}$ and $โจ\cdot,\cdotโฉ$ denotes the (Frobenius) inner product in the embedding $๐ฝ^{n_1, n_2, โฆ, n_i}$.
This manifold is modeled as an embedded manifold to the Euclidean
, i.e. several functions like the inner
product and the zero_tangent_vector
are inherited from the embedding.
Constructor
ArraySphere(nโ,nโ,...,nแตข; field=โ)
Generate sphere in $๐ฝ^{n_1, n_2, โฆ, n_i}$, where $๐ฝ$ defaults to the real-valued case $โ$.
Functions on unit spheres
Base.exp
โ Methodexp(M::AbstractSphere, p, X)
Compute the exponential map from p
in the tangent direction X
on the AbstractSphere
M
by following the great arc eminating from p
in direction X
.
where $\lVert X \rVert_p$ is the norm
on the tangent space at p
of the AbstractSphere
M
.
Base.log
โ Methodlog(M::AbstractSphere, p, q)
Compute the logarithmic map on the AbstractSphere
M
, i.e. the tangent vector, whose geodesic starting from p
reaches q
after time 1. The formula reads for $x โ -y$
and a deterministic choice from the set of tangent vectors is returned if $x=-y$, i.e. for opposite points.
Manifolds.normal_tvector_distribution
โ Methodnormal_tvector_distribution(S::Sphere{n,โ}, p, ฯ)
Generate a distribution in the tangent space at p
by generating a normal distribution in ambient space with standard deviation ฯ
projected to the tangent space at p
.
Manifolds.uniform_distribution
โ Methoduniform_distribution(M::Sphere{n,โ}, p) where {n}
Uniform distribution on given Sphere
M
. Generated points will be of similar type as p
.
ManifoldsBase.check_manifold_point
โ Methodcheck_manifold_point(M::AbstractSphere, p; kwargs...)
Check whether p
is a valid point on the AbstractSphere
M
, i.e. is a point in the embedding of unit length. The tolerance for the last test can be set using the kwargs...
.
ManifoldsBase.check_tangent_vector
โ Methodcheck_tangent_vector(M::AbstractSphere, p, X; check_base_point = true, kwargs... )
Check whether X
is a tangent vector to p
on the AbstractSphere
M
, i.e. after check_manifold_point
(M,p)
, X
has to be of same dimension as p
and orthogonal to p
. The optional parameter check_base_point
indicates, whether to call check_manifold_point
for p
or not. The tolerance for the last test can be set using the kwargs...
.
ManifoldsBase.distance
โ Methoddistance(M::AbstractSphere, p, q)
Compute the geodesic distance betweeen p
and q
on the AbstractSphere
M
. The formula is given by the (shorter) great arc length on the (or a) great circle both p
and q
lie on.
ManifoldsBase.get_coordinates
โ Methodget_coordinates(M::AbstractSphere{โ}, p, X, B::DefaultOrthonormalBasis)
Represent the tangent vector X
at point p
from the AbstractSphere
M
in an orthonormal basis by rotating the hyperplane containing X
to a hyperplane whose normal is the $x$-axis.
Given $q = p ฮป + x$, where $ฮป = \operatorname{sgn}(โจx, pโฉ)$, and $โจโ , โ โฉ_{\mathrm{F}}$ denotes the Frobenius inner product, the formula for $Y$ is
ManifoldsBase.get_vector
โ Methodget_vector(M::AbstractSphere{โ}, p, X, B::DefaultOrthonormalBasis)
Convert a one-dimensional vector of coefficients X
in the basis B
of the tangent space at p
on the AbstractSphere
M
to a tangent vector Y
at p
by rotating the hyperplane containing X
, whose normal is the $x$-axis, to the hyperplane whose normal is p
.
Given $q = p ฮป + x$, where $ฮป = \operatorname{sgn}(โจx, pโฉ)$, and $โจโ , โ โฉ_{\mathrm{F}}$ denotes the Frobenius inner product, the formula for $Y$ is
ManifoldsBase.injectivity_radius
โ Methodinjectivity_radius(M::AbstractSphere[, p])
Return the injectivity radius for the AbstractSphere
M
, which is globally $ฯ$.
injectivity_radius(M::Sphere, x, ::ProjectionRetraction)
Return the injectivity radius for the ProjectionRetraction
on the AbstractSphere
, which is globally $\frac{ฯ}{2}$.
ManifoldsBase.inverse_retract
โ Methodinverse_retract(M::AbstractSphere, p, q, ::ProjectionInverseRetraction)
Compute the inverse of the projection based retraction on the AbstractSphere
M
, i.e. rearranging $p+X = q\lVert p+X\rVert_2$ yields since $\Re(โจp,Xโฉ) = 0$ and when $d_{๐^2}(p,q) โค \frac{ฯ}{2}$ that
ManifoldsBase.manifold_dimension
โ Methodmanifold_dimension(M::AbstractSphere)
Return the dimension of the AbstractSphere
M
, respectively i.e. the dimension of the embedding -1.
ManifoldsBase.project
โ Methodproject(M::AbstractSphere, p, X)
Project the point X
onto the tangent space at p
on the Sphere
M
.
ManifoldsBase.project
โ Methodproject(M::AbstractSphere, p)
Project the point p
from the embedding onto the Sphere
M
.
where $\lVert\cdot\rVert$ denotes the usual 2-norm for vectors if $m=1$ and the Frobenius norm for the case $m>1$.
ManifoldsBase.representation_size
โ Methodrepresentation_size(M::AbstractSphere)
Return the size points on the AbstractSphere
M
are represented as, i.e., the representation size of the embedding.
ManifoldsBase.retract
โ Methodretract(M::AbstractSphere, p, X, ::ProjectionRetraction)
Compute the retraction that is based on projection, i.e.
ManifoldsBase.vector_transport_to
โ Methodvector_transport_to(M::AbstractSphere, p, X, q, ::ParallelTransport)
Compute the parallel transport on the Sphere
of the tangent vector X
at p
to q
, provided, the geodesic
between p
and q
is unique. The formula reads
Statistics.mean
โ Methodmean(
S::AbstractSphere,
x::AbstractVector,
[w::AbstractWeights,]
method = GeodesicInterpolationWithinRadius(ฯ/2);
kwargs...,
)
Compute the Riemannian mean
of x
using GeodesicInterpolationWithinRadius
.