# Ease of notation

The following terms introduce a nicer notation for some operations, for example using the ∈ operator, $p ∈ \mathcal M$, to determine whether $p$ is a point on the `Manifold`

$\mathcal M$.

`Base.in`

— Function```
Base.in(p, M::Manifold; kwargs...)
p ∈ M
```

Check, whether a point `p`

is a valid point (i.e. in) a `Manifold`

`M`

. This method employs `is_manifold_point`

deaticating the error throwing option.

```
Base.in(p, TpM::TangentSpaceAtPoint; kwargs...)
X ∈ TangentSpaceAtPoint(M,p)
```

Check whether `X`

is a tangent vector from (in) the tangent space $T_p\mathcal M$, i.e. the `TangentSpaceAtPoint`

at `p`

on the `Manifold`

`M`

. This method uses `is_tangent_vector`

deactivating the error throw option.

`Manifolds.TangentSpace`

— Constant`TangentSpace(M::Manifold, p)`

Return a `TangentSpaceAtPoint`

representing tangent space at `p`

on the `Manifold`

`M`

.

# Public documentation

The following functions are of interest for extending and using the `ProductManifold`

.

`Manifolds.ShapeSpecification`

— Type`ShapeSpecification(reshapers, manifolds::Manifold...)`

A structure for specifying array size and offset information for linear storage of points and tangent vectors on the product manifold of `manifolds`

.

The first argument, `reshapers`

, indicates how a view representing a point in the `ProductArray`

will be reshaped. It can either be an object of type `AbstractReshaper`

that will be applied to all views or a tuple of such objects that will be applied to subsequent manifolds.

Two main reshaping methods are provided by types `StaticReshaper`

that is faster for manifolds represented by small arrays (up to about 100 elements) and `ArrayReshaper`

that is faster for larger arrays.

For example, consider the shape specification for the product of a sphere and group of rotations:

```
julia> M1 = Sphere(2)
Sphere{2}()
julia> M2 = Manifolds.Rotations(2)
Manifolds.Rotations{2}()
julia> reshaper = Manifolds.StaticReshaper()
Manifolds.StaticReshaper()
julia> shape = Manifolds.ShapeSpecification(reshaper, M1, M2)
Manifolds.ShapeSpecification{(1:3, 4:7),Tuple{Tuple{3},Tuple{2,2}},
Tuple{Manifolds.StaticReshaper,Manifolds.StaticReshaper}}(
(Manifolds.StaticReshaper(), Manifolds.StaticReshaper()))
```

`TRanges`

contains ranges in the linear storage that correspond to a specific manifold. `Sphere(2)`

needs three numbers and is first, so it is allocated the first three elements of the linear storage (`1:3`

). `Rotations(2)`

needs four numbers and is second, so the next four numbers are allocated to it (`4:7`

). `TSizes`

describe how the linear storage must be reshaped to correctly represent points. In this case, `Sphere(2)`

expects a three-element vector, so the corresponding size is `Tuple{3}`

. On the other hand, `Rotations(2)`

expects two-by-two matrices, so its size specification is `Tuple{2,2}`

.

`Manifolds.submanifold_component`

— Function```
submanifold_component(M::Manifold, p, i::Integer)
submanifold_component(M::Manifold, p, ::Val(i)) where {i}
submanifold_component(p, i::Integer)
submanifold_component(p, ::Val(i)) where {i}
```

Project the product array `p`

on `M`

to its `i`

th component. A new array is returned.

`Manifolds.submanifold_components`

— Function```
submanifold_components(M::Manifold, p)
submanifold_components(p)
```

Get the projected components of `p`

on the submanifolds of `M`

. The components are returned in a Tuple.

`Manifolds.ProductArray`

— Type`ProductArray(shape::ShapeSpecification, data)`

An array-based representation for points and tangent vectors on the product manifold. `data`

contains underlying representation of points arranged according to `TRanges`

and `TSizes`

from `shape`

. Internal views for each specific sub-point are created and stored in `parts`

.

`Manifolds.ProductRepr`

— Type`ProductRepr(parts)`

A more general but slower representation of points and tangent vectors on a product manifold.

**Example:**

A product point on a product manifold `Sphere(2) × Euclidean(2)`

might be created as

`ProductRepr([1.0, 0.0, 0.0], [2.0, 3.0])`

where `[1.0, 0.0, 0.0]`

is the part corresponding to the sphere factor and `[2.0, 3.0]`

is the part corresponding to the euclidean manifold.

`Manifolds.prod_point`

— Function`prod_point(M::ShapeSpecification, pts...)`

Construct a product point from product manifold `M`

based on point `pts`

represented by `ProductArray`

.

**Example**

To construct a point on the product manifold $S^2 × ℝ^2$ from points on the sphere and in the euclidean space represented by, respectively, `[1.0, 0.0, 0.0]`

and `[-3.0, 2.0]`

you need to construct shape specification first. It describes how linear storage of `ProductArray`

corresponds to array representations expected by `Sphere(2)`

and `Euclidean(2)`

.

```
M1 = Sphere(2)
M2 = Euclidean(2)
reshaper = Manifolds.StaticReshaper()
Mshape = Manifolds.ShapeSpecification(reshaper, M1, M2)
```

Next, the desired point on the product manifold can be obtained by calling `Manifolds.prod_point(Mshape, [1.0, 0.0, 0.0], [-3.0, 2.0])`

.

`Manifolds.StaticReshaper`

— Type`StaticReshaper()`

Reshaper that constructs `SizedArray`

from the `StaticArrays.jl`

package.

`Manifolds.ArrayReshaper`

— Type`ArrayReshaper()`

Reshaper that constructs `Base.ReshapedArray`

.

`Manifolds.make_reshape`

— Function`make_reshape(reshaper::AbstractReshaper, ::Type{Size}, data) where Size`

Reshape array `data`

to size `Size`

using method provided by `reshaper`

.

## Specific exception types

For some manifolds it is useful to keep an extra index, at which point on the manifold, the error occurred as well as to collect all errors that occurred on a manifold. This page contains the manifold-specific error messages this package introduces.