Symmetric positive definite matrices
Manifolds.SymmetricPositiveDefinite
— TypeSymmetricPositiveDefinite{N} <: AbstractEmbeddedManifold{ℝ,DefaultEmbeddingType}
The manifold of symmetric positive definite matrices, i.e.
Constructor
SymmetricPositiveDefinite(n)
generates the manifold $\mathcal P(n) \subset ℝ^{n × n}$
This manifold can – for example – be illustrated as ellipsoids: since the eigenvalues are all positive they can be taken as lengths of the axes of an ellipsoids while the directions are given by the eigenvectors.
The manifold can be equipped with different metrics
Common and metric independent functions
ManifoldsBase.check_manifold_point
— Methodcheck_manifold_point(M::SymmetricPositiveDefinite, p; kwargs...)
checks, whether p
is a valid point on the SymmetricPositiveDefinite
M
, i.e. is a matrix of size (N,N)
, symmetric and positive definite. The tolerance for the second to last test can be set using the kwargs...
.
ManifoldsBase.check_tangent_vector
— Methodcheck_tangent_vector(M::SymmetricPositiveDefinite, p, X; check_base_point = true, kwargs... )
Check whether X
is a tangent vector to p
on the SymmetricPositiveDefinite
M
, i.e. atfer check_manifold_point
(M,p)
, X
has to be of same dimension as p
and a symmetric matrix, i.e. this stores tangent vetors as elements of the corresponding Lie group. The optional parameter check_base_point
indicates, whether to call check_manifold_point
for p
. The tolerance for the last test can be set using the kwargs...
.
ManifoldsBase.injectivity_radius
— Methodinjectivity_radius(M::SymmetricPositiveDefinite[, p])
injectivity_radius(M::MetricManifold{SymmetricPositiveDefinite,LinearAffineMetric}[, p])
injectivity_radius(M::MetricManifold{SymmetricPositiveDefinite,LogCholeskyMetric}[, p])
Return the injectivity radius of the SymmetricPositiveDefinite
. Since M
is a Hadamard manifold with respect to the LinearAffineMetric
and the LogCholeskyMetric
, the injectivity radius is globally $∞$.
ManifoldsBase.manifold_dimension
— Methodmanifold_dimension(M::SymmetricPositiveDefinite)
returns the dimension of SymmetricPositiveDefinite
M
$=\mathcal P(n), n ∈ ℕ$, i.e.
ManifoldsBase.representation_size
— Methodrepresentation_size(M::SymmetricPositiveDefinite)
Return the size of an array representing an element on the SymmetricPositiveDefinite
manifold M
, i.e. $n × n$, the size of such a symmetric positive definite matrix on $\mathcal M = \mathcal P(n)$.
ManifoldsBase.zero_tangent_vector
— Methodzero_tangent_vector(M::SymmetricPositiveDefinite,x)
returns the zero tangent vector in the tangent space of the symmetric positive definite matrix x
on the SymmetricPositiveDefinite
manifold M
.
Default metric: the linear affine metric
Manifolds.LinearAffineMetric
— TypeLinearAffineMetric <: Metric
The linear affine metric is the metric for symmetric positive definite matrices, that employs matrix logarithms and exponentials, which yields a linear and affine metric.
This metric is also the default metric, i.e. any call of the following functions with P=SymmetricPositiveDefinite(3)
will result in MetricManifold(P,LinearAffineMetric())
and hence yield the formulae described in this seciton.
Base.exp
— Methodexp(M::SymmetricPositiveDefinite, p, X)
exp(M::MetricManifold{SymmetricPositiveDefinite{N},LinearAffineMetric}, p, X)
Compute the exponential map from p
with tangent vector X
on the SymmetricPositiveDefinite
M
with its default MetricManifold
having the LinearAffineMetric
. The formula reads
where $\operatorname{Exp}$ denotes to the matrix exponential.
Base.log
— Methodlog(M::SymmetricPositiveDefinite, p, q)
log(M::MetricManifold{SymmetricPositiveDefinite,LinearAffineMetric}, p, q)
Compute the logarithmic map from p
to q
on the SymmetricPositiveDefinite
as a MetricManifold
with LinearAffineMetric
. The formula reads
where $\operatorname{Log}$ denotes to the matrix logarithm.
ManifoldsBase.distance
— Methoddistance(M::SymmetricPositiveDefinite, p, q)
distance(M::MetricManifold{SymmetricPositiveDefinite,LinearAffineMetric}, p, q)
Compute the distance on the SymmetricPositiveDefinite
manifold between p
and q
, as a MetricManifold
with LinearAffineMetric
. The formula reads
where $\operatorname{Log}$ denotes the matrix logarithm and $\lVert\cdot\rVert_{\mathrm{F}}$ denotes the matrix Frobenius norm.
ManifoldsBase.get_basis
— Method[Ξ,κ] = get_basis(M::SymmetricPositiveDefinite, p, B::DiagonalizingOrthonormalBasis)
[Ξ,κ] = get_basis(M::MetricManifold{SymmetricPositiveDefinite{N},LinearAffineMetric}, p, B::DiagonalizingOrthonormalBasis)
Return a orthonormal basis Ξ
as a vector of tangent vectors (of length manifold_dimension
of M
) in the tangent space of p
on the MetricManifold
of SymmetricPositiveDefinite
manifold M
with LinearAffineMetric
that diagonalizes the curvature tensor $R(u,v)w$ with eigenvalues κ
and where the direction B.frame_direction
has curvature 0
.
ManifoldsBase.inner
— Methodinner(M::SymmetricPositiveDefinite, p, X, Y)
inner(M::MetricManifold{SymmetricPositiveDefinite,LinearAffineMetric}, p, X, Y)
Compute the inner product of X
, Y
in the tangent space of p
on the SymmetricPositiveDefinite
manifold M
, as a MetricManifold
with LinearAffineMetric
. The formula reads
ManifoldsBase.vector_transport_to
— Methodvector_transport_to(M::SymmetricPositiveDefinite, p, X, q, ::ParallelTransport)
vector_transport_to(M::MetricManifold{SymmetricPositiveDefinite,LinearAffineMetric}, p, X, y, ::ParallelTransport)
Compute the parallel transport of X
from the tangent space at p
to the tangent space at q
on the SymmetricPositiveDefinite
as a MetricManifold
with the LinearAffineMetric
. The formula reads
where $\operatorname{Exp}$ denotes the matrix exponential and log
the logarithmic map on SymmetricPositiveDefinite
(again with respect to the LinearAffineMetric
).
The log Euclidean metric
Manifolds.LogEuclideanMetric
— TypeLogEuclideanMetric <: Metric
The LogEuclidean Metric consists of the Euclidean metric applied to all elements after mapping them into the Lie Algebra, i.e. performing a matrix logarithm beforehand.
ManifoldsBase.distance
— Methoddistance(M::MetricManifold{SymmetricPositiveDefinite{N},LogEuclideanMetric}, p, q)
Compute the distance on the SymmetricPositiveDefinite
manifold between p
and q
as a MetricManifold
with LogEuclideanMetric
. The formula reads
where $\operatorname{Log}$ denotes the matrix logarithm and $\lVert\cdot\rVert_{\mathrm{F}}$ denotes the matrix Frobenius norm.
log Cholesky metric
Manifolds.LogCholeskyMetric
— TypeLogCholeskyMetric <: Metric
The Log-Cholesky metric imposes a metric based on the Cholesky decomposition as introduced by [Lin2019].
Base.exp
— Methodexp(M::MetricManifold{SymmetricPositiveDefinite,LogCholeskyMetric}, p, X)
Compute the exponential map on the SymmetricPositiveDefinite
M
with LogCholeskyMetric
from p
into direction X
. The formula reads
where $\exp_xW$ is the exponential map on CholeskySpace
, $y$ is the cholesky decomposition of $p$, $W = y(y^{-1}Xy^{-\mathrm{T}})_\frac{1}{2}$, and $(\cdot)_\frac{1}{2}$ denotes the lower triangular matrix with the diagonal multiplied by $\frac{1}{2}$.
Base.log
— Methodlog(M::MetricManifold{SymmetricPositiveDefinite,LogCholeskyMetric}, p, q)
Compute the logarithmic map on SymmetricPositiveDefinite
M
with respect to the LogCholeskyMetric
emanating from p
to q
. The formula can be adapted from the CholeskySpace
as
where $x$ is the cholesky factor of $p$ and $W=\log_x y$ for $y$ the cholesky factor of $q$ and the just mentioned logarithmic map is the one on CholeskySpace
.
ManifoldsBase.distance
— Methoddistance(M::MetricManifold{SymmetricPositiveDefinite,LogCholeskyMetric}, p, q)
Compute the distance on the manifold of SymmetricPositiveDefinite
nmatrices, i.e. between two symmetric positive definite matrices p
and q
with respect to the LogCholeskyMetric
. The formula reads
where $x$ and $y$ are the cholesky factors of $p$ and $q$, respectively, $⌊\cdot⌋$ denbotes the strictly lower triangular matrix of its argument, and $\lVert\cdot\rVert_{\mathrm{F}}$ the Frobenius norm.
ManifoldsBase.inner
— Methodinner(M::MetricManifold{LogCholeskyMetric,ℝ,SymmetricPositiveDefinite}, p, X, Y)
Compute the inner product of two matrices X
, Y
in the tangent space of p
on the SymmetricPositiveDefinite
manifold M
, as a MetricManifold
with LogCholeskyMetric
. The formula reads
where $⟨\cdot,\cdot⟩_x$ denotes inner product on the CholeskySpace
, $z$ is the cholesky factor of $p$, $a_z(W) = z (z^{-1}Wz^{-\mathrm{T}})_{\frac{1}{2}}$, and $(\cdot)_\frac{1}{2}$ denotes the lower triangular matrix with the diagonal multiplied by $\frac{1}{2}$
ManifoldsBase.vector_transport_to
— Methodvector_transport_to(
M::MetricManifold{SymmetricPositiveDefinite,LogCholeskyMetric},
p,
X,
q,
::ParallelTransport,
)
Parallel transport the tangent vector X
at p
along the geodesic to q
with respect to the SymmetricPositiveDefinite
manifold M
and LogCholeskyMetric
. The parallel transport is based on the parallel transport on CholeskySpace
: Let $x$ and $y$ denote the cholesky factors of p
and q
, respectively and $W = x(x^{-1}Xx^{-\mathrm{T}})_\frac{1}{2}$, where $(\cdot)_\frac{1}{2}$ denotes the lower triangular matrix with the diagonal multiplied by $\frac{1}{2}$. With $V$ the parallel transport on CholeskySpace
from $x$ to $y$. The formula hear reads
Statistics
Statistics.mean
— Methodmean(
M::SymmetricPositiveDefinite,
x::AbstractVector,
[w::AbstractWeights,]
method = GeodesicInterpolation();
kwargs...,
)
Compute the Riemannian mean
of x
using GeodesicInterpolation
.
Literature
- Lin2019
Lin, Zenhua: "Riemannian Geometry of Symmetric Positive Definite Matrices via Cholesky Decomposition", arXiv: 1908.09326.