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_safe
โ Functioneigen_safe(x)
Compute the eigendecomposition of x
. If x
is a StaticMatrix
, it is converted to a Matrix
before the decomposition.
Manifolds.isnormal
โ Functionisnormal(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.
Manifolds.log_safe
โ Functionlog_safe(x)
Compute the matrix logarithm of x
. If x
is a StaticMatrix
, it is converted to a Matrix
before computing the log.
Manifolds.log_safe!
โ Functionlog_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.
Manifolds.mul!_safe
โ Functionmul!_safe(Y, A, B) -> Y
Call mul!
safely, that is, A
and/or B
are permitted to alias with Y
.
Manifolds.nzsign
โ Functionnzsign(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}\]
Manifolds.realify
โ Functionrealify(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 $ฯ$.
Manifolds.realify!
โ Functionrealify!(Y::AbstractMatrix{<:Real}, X::AbstractMatrix{T๐ฝ}, ๐ฝ::AbstractNumbers)
In-place version of realify
.
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}.\]
Manifolds.select_from_tuple
โ Functionselect_from_tuple(t::NTuple{N, Any}, positions::Val{P})
Selects elements of tuple t
at positions specified by the second argument. For example select_from_tuple(("a", "b", "c"), Val((3, 1, 1)))
returns ("c", "a", "a")
.
Manifolds.symmetrize
โ Functionsymmetrize(X)
Given a quare matrix X
compute 1/2 .* (X' + X)
.
Manifolds.symmetrize!
โ Functionsymmetrize!(Y, X)
Given a quare matrix X
compute 1/2 .* (X' + X)
in place of Y
Manifolds.unrealify!
โ Functionunrealify!(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.
Manifolds.usinc
โ Functionusinc(ฮธ::Real)
Unnormalized version of sinc
function, i.e. $\operatorname{usinc}(ฮธ) = \frac{\sin(ฮธ)}{ฮธ}$. This is equivalent to sinc(ฮธ/ฯ)
.
Manifolds.usinc_from_cos
โ Functionusinc_from_cos(x::Real)
Unnormalized version of sinc
function, i.e. $\operatorname{usinc}(ฮธ) = \frac{\sin(ฮธ)}{ฮธ}$, computed from $x = cos(ฮธ)$.
Manifolds.vec2skew!
โ Functionvec2skew!(X, v, k)
create a skew symmetric matrix inplace in X
of size $k\times 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
]
Manifolds.ziptuples
โ Functionziptuples(a, b[, c[, d[, e]]])
Zips tuples a
, b
, and remaining in a fast, type-stable way. If they have different lengths, the result is trimmed to the length of the shorter tuple.