Internal documentation

This page documents the internal types and methods of Manifolds.jl's that might be of use for writing your own manifold.

Functions

Manifolds.eigen_safeFunction
eigen_safe(x)

Compute the eigendecomposition of x. If x is a StaticMatrix, it is converted to a Matrix before the decomposition.

source
Manifolds.estimated_sectional_curvatureFunction
estimated_sectional_curvature(M::AbstractManifold, p, X, Y; r::Real=1e-3, N::Int=10000)

Approximate sectional curvature of manifold M in the plane spanned by vectors X and Y from tangent space at p using a circle on M of radius r divided into N segments.

The approximation is derived from the Bertrand–Diguet–Puiseux theorem which states that

\[\kappa_p(X, Y) = \lim_{r \to 0^+} 3\frac{2\pi r-C(r)}{\pi r^3},\]

where $C(r)$ is the circumference of the circle of radius $r$ around p in submanifold of M spanned by X and Y. The circumference calculation method has a tendency to return curvature values larger than the exact ones.

source
Manifolds.estimated_sectional_curvature_matrixFunction
estimated_sectional_curvature_matrix(M::AbstractManifold, p, B::AbstractBasis; r::Real=1e-3, N::Int=10000)

Estimate the matrix of sectional curvatures of manifold M at point p using estimated_sectional_curvature. Entry (i, j)corresponds to sectional curvature of the surface spanned by vectorsiandjfrom basisB`.

source
Manifolds.get_parameter_typeFunction
get_parameter_type(M::AbstractManifold)

Get parameter argument of the constructor of manifold M. Returns either :field or :type.

See also

get_parameter, TypeParameter

source
Manifolds.isnormalFunction
isnormal(x; kwargs...) -> Bool

Check if the matrix or number x is normal, that is, if it commutes with its adjoint:

\[x x^\mathrm{H} = x^\mathrm{H} x.\]

By default, this is an equality check. Provide kwargs for isapprox to perform an approximate check.

source
Manifolds.log_safeFunction
log_safe(x)

Compute the matrix logarithm of x. If x is a StaticMatrix, it is converted to a Matrix before computing the log.

source
Manifolds.log_safe!Function
log_safe!(y, x)

Compute the matrix logarithm of x. If the eltype of y is real, then the imaginary part of x is ignored, and a DomainError is raised if real(x) has no real logarithm.

source
Manifolds.mul!_safeFunction
mul!_safe(Y, A, B) -> Y

Call mul! safely, that is, A and/or B are permitted to alias with Y.

source
Manifolds.nzsignFunction
nzsign(z[, absz])

Compute a modified sign(z) that is always nonzero, i.e. where

\[\operatorname(nzsign)(z) = \begin{cases} 1 & \text{if } z = 0\\ \frac{z}{|z|} & \text{otherwise} \end{cases}\]

Note that the condition absz == 0 would be incorrectly handled by ForwardDiff.jl.

source
Manifolds.projected_distributionFunction
projected_distribution(M::AbstractManifold, d, [p=rand(d)])

Wrap the standard distribution d into a manifold-valued distribution. Generated points will be of similar type to p. By default, the type is not changed.

source
Manifolds.realifyFunction
realify(X::AbstractMatrix{T𝔽}, 𝔽::AbstractNumbers) -> Y::AbstractMatrix{<:Real}

Given a matrix $X ∈ 𝔽^{n×n}$, compute $Y ∈ ℝ^{m×m}$, where $m = n \operatorname{dim}_𝔽$, and $\operatorname{dim}_𝔽$ is the real_dimension of the number field $𝔽$, using the map $ϕ \colon X ↦ Y$, that preserves the matrix product, so that for all $C,D ∈ 𝔽^{n×n}$,

\[ϕ(C) ϕ(D) = ϕ(CD).\]

See realify! for an in-place version, and unrealify! to compute the inverse of $ϕ$.

source
Manifolds.realify!Function
realify!(Y::AbstractMatrix{<:Real}, X::AbstractMatrix{T𝔽}, 𝔽::AbstractNumbers)

In-place version of realify.

source
realify!(Y::AbstractMatrix{<:Real}, X::AbstractMatrix{<:Complex}, ::typeof(ℂ))

Given a complex matrix $X = A + iB ∈ ℂ^{n×n}$, compute its realified matrix $Y ∈ ℝ^{2n×2n}$, written where

\[Y = \begin{pmatrix}A & -B \\ B & A \end{pmatrix}.\]

source
Manifolds.unrealify!Function
unrealify!(X::AbstractMatrix{T𝔽}, Y::AbstractMatrix{<:Real}, 𝔽::AbstractNumbers[, n])

Given a real matrix $Y ∈ ℝ^{m×m}$, where $m = n \operatorname{dim}_𝔽$, and $\operatorname{dim}_𝔽$ is the real_dimension of the number field $𝔽$, compute in-place its equivalent matrix $X ∈ 𝔽^{n×n}$. Note that this function does not check that $Y$ has a valid structure to be un-realified.

See realify! for the inverse of this function.

source
Manifolds.usincFunction
usinc(θ::Real)

Unnormalized version of sinc function, i.e. $\operatorname{usinc}(θ) = \frac{\sin(θ)}{θ}$. This is equivalent to sinc(θ/π).

Note that ForwardDiff.jl would return wrong answer at θ=0 if a simple equality was used.

source
Manifolds.usinc_from_cosFunction
usinc_from_cos(x::Real)

Unnormalized version of sinc function, i.e. $\operatorname{usinc}(θ) = \frac{\sin(θ)}{θ}$, computed from $x = cos(θ)$.

source
Manifolds.vec2skew!Function
vec2skew!(X, v, k)

Create a skew symmetric matrix in-place in X of size $k×k$ from a vector v, for example for v=[1,2,3] and k=3 this yields

[  0  1  2;
  -1  0  3;
  -2 -3  0
]
source

Types in Extensions

Manifolds.IntegratorTerminatorNearChartBoundaryMethod
(int_term::IntegratorTerminatorNearChartBoundary)(u, t, integrator)

Terminate integration when integrator goes too closely to chart boundary. Closeness is determined by ϵ value of IntegratorTerminatorNearChartBoundary int_term.

Arguments:

  • int_term: object containing keyword arguments for check_chart_switch, such as the desired maximum distance to boundary,
  • u: parameters of a point at which the integrator is solving a differential equation.
  • t: time parameter of the integrator
  • integrator: state of the integrator. Internal parameters are expected to contained the manifold on which the equation is solved, the atlas and the current chart index.
source
ManifoldsOrdinaryDiffEqDiffEqCallbacksExt.StitchedChartSolutionType
StitchedChartSolution{Prob,TM<:AbstractManifold,TA<:AbstractAtlas,TChart}

Solution of an ODE on a manifold M in charts of an AbstractAtlas A.

When StitchedChartSolution{:Exp} is used as a function with a number t as an argument, a pair (p, X) is returned such that $p\in \mathcal{M}$ is the point at time t of the geodesic and $X \in T_p \mathcal{M}$ is the velocity of the geodesic at that point. Similarly, StitchedChartSolution{:PT} called with number t returns a triple (p, X, Y) where (p, X) corresponds to the geodesic along which the vector is transported and $Y\in T_p\mathcal{M}$ is the vector transported to p.

source
Manifolds.solve_chart_exp_odeMethod
solve_chart_exp_ode(
    M::AbstractManifold, a, Xc, A::AbstractAtlas, i0;
    solver=AutoVern9(Rodas5()),
    final_time::Real=1.0,
    check_chart_switch_kwargs=NamedTuple(),
    kwargs...,
)

Solve geodesic ODE on a manifold M from point of coordinates a in chart i0 from an AbstractAtlas A in direction of coordinates Xc in the induced basis. The geodesic is solved up to time final_time (by default equal to 1).

Chart switching

If the solution exceeds the domain of chart i0 (which is detected using the check_chart_switch function with additional keyword arguments check_chart_switch_kwargs), a new chart is selected using get_chart_index on the final point in the old chart.

Returned value

The function returns an object of type StitchedChartSolution{:Exp} to represent the geodesic.

source
Manifolds.solve_chart_parallel_transport_odeMethod
solve_chart_parallel_transport_ode(
    M::AbstractManifold, a, Xc, A::AbstractAtlas, i0, Yc;
    solver=AutoVern9(Rodas5()), check_chart_switch_kwargs=NamedTuple(), final_time=1.0,
    kwargs...
)

Parallel transport vector with coordinates Yc along geodesic on a manifold M from point of coordinates a in a chart i0 from an AbstractAtlas A in direction of coordinates Xc in the induced basis.

source