Hermitian positive definite matrices

Manifolds.HermitianPositiveDefinite β€” Type
HermitianPositiveDefinite{𝔽,T} <: AbstractDecoratorManifold{𝔽}

The manifold of Hermitian positive definite matrices

\[\mathcal H(n) := \bigl\{ p ∈ 𝔽^{nΓ—n}\ \big|\ p = p^{\mathrm{H}} \text{ and } a^{\mathrm{H}}pa > 0 \text{ for all } a ∈ 𝔽^{n}\backslash\{0\} \bigr\}\]

over the field $𝔽 ∈ \{ℝ, β„‚\}$, where usually $𝔽=β„‚$. For the case $𝔽=ℝ$ this manifold is the manifold of symmetric positive definite matrices, see SymmetricPositiveDefinite.

The tangent space at $p∈\mathcal H(n)$ reads

\[ T_p\mathcal H(n) = \bigl\{ X \in 𝔽^{nΓ—n} \big|\ X=X^\mathrm{H} \bigr\},\]

i.e. the set of Hermitian matrices, which are the symmetric matrices for $𝔽=ℝ$.

The default metric is the AffineInvariantMetric.

Constructor

HermitianPositiveDefinite(n, 𝔽=β„‚; parameter::Symbol=:type)

generates the manifold of Hermitian positive definite matrices $\mathcal H(n) \subset 𝔽^{nΓ—n}$.

source

For the real case see the symmetric positive definite matrices.

Functions

Base.rand β€” Method
rand(M::HermitianPositiveDefinite{β„‚}; vector_at=nothing, tangent_distr=:Gaussian, Οƒ::Real=1/sqrt(n))

Generate a random Hermitian positive definite matrix on the complex HermitianPositiveDefinite manifold M, or, if vector_at is a point $p$, a random tangent vector at $p$. The parameter Οƒ has no effect on a point.

For tangent_distr = :Gaussian the coordinates of the tangent vector in the DefaultOrthonormalBasis of $T_p\mathcal H(n)$ are independent and normally distributed with standard deviation Οƒ. For tangent_distr = :Rician the tangent vector is $RR^{\mathrm{H}}$ with $R = L + \sqrt{Οƒ}U$, where $L$ is the lower triangular Cholesky factor of $p$ and $U$ is upper triangular with independent complex standard normal entries; here Οƒ defaults to $1/\lVert p\rVert_{\mathrm{F}}$ instead.

source
ManifoldsBase.check_point β€” Method
check_point(M::HermitianPositiveDefinite, p; kwargs...)

checks, whether p is a valid point on the HermitianPositiveDefinite M, i.e. is a matrix $p ∈ 𝔽^{nΓ—n}$ over the field $𝔽 ∈ \{ℝ,β„‚\}$ of M, is Hermitian ($p^{\mathrm{H}} = p$, which is symmetric, $p^{\mathrm{T}} = p$, for $𝔽=ℝ$) and positive definite, that is $a^{\mathrm{H}}pa > 0$ for all $a ∈ 𝔽^{n}\backslash\{0\}$. The tolerance for the second to last test can be set using the kwargs....

source
ManifoldsBase.check_vector β€” Method
check_vector(M::HermitianPositiveDefinite, p, X; kwargs... )

Check whether X is a tangent vector to p on the HermitianPositiveDefinite M. After check_point(M,p), X has to be of the same dimension as p and a Hermitian matrix $X ∈ 𝔽^{nΓ—n}$, $X^{\mathrm{H}} = X$ (a symmetric matrix, $X^{\mathrm{T}} = X$, for $𝔽=ℝ$), i.e. this stores tangent vectors as elements of the corresponding Lie group. The tolerance for the last test can be set using the kwargs....

source

The affine invariant metric

HermitianPositiveDefinite is equipped with the AffineInvariantMetric, so any call of the following functions with H=HermitianPositiveDefinite(3) yields the same as with MetricManifold(H,AffineInvariantMetric()). The curvature tensor, the basis diagonalizing it, the minimal sectional curvature and the volume density are only available for the real case, see the symmetric positive definite matrices.

Base.exp β€” Method
exp(M::HermitianPositiveDefinite, p, X)
exp(M::MetricManifold{<:HermitianPositiveDefinite,AffineInvariantMetric}, p, X)

Compute the exponential map from p with tangent vector X on the HermitianPositiveDefinite M with its default MetricManifold having the AffineInvariantMetric. The formula reads

\[\exp_p X = p^{\frac{1}{2}}\operatorname{Exp}(p^{-\frac{1}{2}} X p^{-\frac{1}{2}})p^{\frac{1}{2}},\]

where $\operatorname{Exp}$ denotes the matrix exponential, see [Smi05], Eq. (67).

source
Base.log β€” Method
log(M::HermitianPositiveDefinite, p, q)
log(M::MetricManifold{HermitianPositiveDefinite,AffineInvariantMetric}, p, q)

Compute the logarithmic map from p to q on the HermitianPositiveDefinite as a MetricManifold with AffineInvariantMetric. The formula reads

\[\log_p q = p^{\frac{1}{2}}\operatorname{Log}(p^{-\frac{1}{2}}qp^{-\frac{1}{2}})p^{\frac{1}{2}},\]

where $\operatorname{Log}$ denotes the matrix logarithm, see [Smi05], Eq. (69); it is the inverse of the exponential map.

source
ManifoldDiff.riemannian_Hessian β€” Method
riemannian_Hessian(M::HermitianPositiveDefinite, p, G, H, X)

The Riemannian Hessian can be computed as stated in Eq. (7.3) [Ngu23], which covers the real and the complex case. Let $\nabla f(p)$ denote the Euclidean gradient G, $\nabla^2 f(p)[X]$ the Euclidean Hessian H, and $\operatorname{sym}(X) = \frac{1}{2}\bigl(X^{\mathrm{H}}+X\bigr)$ the Hermitian part of $X$, which is its symmetric part for $𝔽=ℝ$. Then the formula reads

\[ \operatorname{Hess}f(p)[X] = p\operatorname{sym}(βˆ‡^2 f(p)[X])p + \operatorname{sym}\bigl( X\operatorname{sym}\bigl(βˆ‡ f(p)\bigr)p)\]

source
ManifoldsBase.change_metric β€” Method
change_metric(M::HermitianPositiveDefinite, E::EuclideanMetric, p, X)

Given a tangent vector $X ∈ T_p\mathcal H(n)$ with respect to the EuclideanMetric g_E, this function changes into the AffineInvariantMetric (default) metric on the HermitianPositiveDefinite M.

To be precise we are looking for $c\colon T_p\mathcal H(n) β†’ T_p\mathcal H(n)$ such that for all $Y,Z ∈ T_p\mathcal H(n)$ it holds

\[⟨Y,Z⟩ = \operatorname{Re}\operatorname{tr}(Y^{\mathrm{H}}Z) = \operatorname{tr}(YZ) = \operatorname{tr}(p^{-1}c(Y)p^{-1}c(Z)) = g_p(c(Y),c(Z)).\]

Since $g_p(Y,Z) = \operatorname{tr}(p^{-1}Yp^{-1}Z) = \operatorname{tr}\bigl((p^{-\frac{1}{2}}Yp^{-\frac{1}{2}})(p^{-\frac{1}{2}}Zp^{-\frac{1}{2}})\bigr)$ by the cyclic property of the trace is the Frobenius inner product of $p^{-\frac{1}{2}}Yp^{-\frac{1}{2}}$ and $p^{-\frac{1}{2}}Zp^{-\frac{1}{2}}$, see [BH06], Eq. (5), the map $c(X) = p^{\frac{1}{2}}Xp^{\frac{1}{2}}$ is computed, which is Hermitian whenever $X$ is.

source
ManifoldsBase.change_representer β€” Method
change_representer(M::HermitianPositiveDefinite, E::EuclideanMetric, p, X)

Compute the representer of the linear function given by $X ∈ T_p\mathcal M$ with respect to the (default) AffineInvariantMetric on the HermitianPositiveDefinite M. Here X represents the linear function on the tangent space at p with respect to the EuclideanMetric g_E.

To be precise we are looking for $Z∈T_p\mathcal H(n)$ such that for all $Y∈T_p\mathcal H(n)$ it holds

\[⟨X,Y⟩ = \operatorname{Re}\operatorname{tr}(X^{\mathrm{H}}Y) = \operatorname{tr}(XY) = \operatorname{tr}(p^{-1}Zp^{-1}Y) = g_p(Z,Y)\]

and hence $Z = pXp$.

source
ManifoldsBase.distance β€” Method
distance(M::HermitianPositiveDefinite, p, q)
distance(M::MetricManifold{HermitianPositiveDefinite,AffineInvariantMetric}, p, q)

Compute the distance on the HermitianPositiveDefinite manifold between p and q, as a MetricManifold with AffineInvariantMetric. The formula reads

\[d_{\mathcal H(n)}(p,q) = \lVert \operatorname{Log}(p^{-\frac{1}{2}}qp^{-\frac{1}{2}})\rVert_{\mathrm{F}},\]

where $\operatorname{Log}$ denotes the matrix logarithm and $\lVertβ‹…\rVert_{\mathrm{F}}$ denotes the matrix Frobenius norm, see [BH06], Proposition 3, Eq. (17).

source
ManifoldsBase.get_basis β€” Method
[Ξ,ΞΊ] = get_basis(M::HermitianPositiveDefinite{β„‚}, p, B::DefaultOrthonormalBasis)
[Ξ,ΞΊ] = get_basis(M::MetricManifold{β„‚,<:HermitianPositiveDefinite{β„‚},AffineInvariantMetric}, p, B::DefaultOrthonormalBasis)

Return a default ONB for the tangent space $T_p\mathcal H(n)$ of the complex HermitianPositiveDefinite with respect to the AffineInvariantMetric.

\[ g_p(X,Y) = \operatorname{tr}(p^{-1} X p^{-1} Y) = \operatorname{Re}\operatorname{tr}\bigl( (p^{-\frac{1}{2}} X p^{-\frac{1}{2}})^{\mathrm{H}} (p^{-\frac{1}{2}} Y p^{-\frac{1}{2}}) \bigr),\]

that is, the Frobenius inner product of $p^{-\frac{1}{2}} X p^{-\frac{1}{2}}$ and $p^{-\frac{1}{2}} Y p^{-\frac{1}{2}}$, since the trace is cyclic and both are Hermitian. The basis constructed here is hence based on the following ONB for the Hermitian matrices with respect to the Frobenius inner product. Let

\[\Delta_{i,j} = (a_{k,l})_{k,l=1}^n \quad \text{ with } a_{k,l} = \begin{cases} 1 & \mbox{ for } k=l \text{ if } i=j\\ \frac{1}{\sqrt{2}} & \mbox{ for } k=i, l=j \text{ or } k=j, l=i\\ 0 & \text{ else,} \end{cases} \qquad i=1,\ldots,n, j=i,\ldots,n,\]

and

\[\Delta^{\mathrm{i}}_{i,j} = (b_{k,l})_{k,l=1}^n \quad \text{ with } b_{k,l} = \begin{cases} \frac{\mathrm{i}}{\sqrt{2}} & \mbox{ for } k=i, l=j\\ -\frac{\mathrm{i}}{\sqrt{2}} & \mbox{ for } k=j, l=i\\ 0 & \text{ else,} \end{cases} \qquad i=1,\ldots,n, j=i+1,\ldots,n,\]

where $\Delta^{\mathrm{i}}_{i,j}$ directly follows $\Delta_{i,j}$ in the ordering of the basis.

We then form the ONB by

\[ \Xi_{i,j} = p^{\frac{1}{2}}\Delta_{i,j}p^{\frac{1}{2}} \qquad\text{ and }\qquad \Xi^{\mathrm{i}}_{i,j} = p^{\frac{1}{2}}\Delta^{\mathrm{i}}_{i,j}p^{\frac{1}{2}}.\]

source
ManifoldsBase.get_coordinates β€” Method
get_coordinates(::HermitianPositiveDefinite{β„‚}, p, X, ::DefaultOrthonormalBasis)

Using the basis from get_basis the coordinates with respect to this ONB are the inner products with its basis vectors $\Xi_{i,j}$ and $\Xi^{\mathrm{i}}_{i,j}$,

\[ c_k = g_p(X, \Xi_{i,j}) = \operatorname{tr}(p^{-1} X p^{-1} \Xi_{i,j}), \qquad c_{k+1} = g_p(X, \Xi^{\mathrm{i}}_{i,j}) = \operatorname{tr}(p^{-1} X p^{-1} \Xi^{\mathrm{i}}_{i,j}),\]

where $k$ is the linearized index of the $i=1,\ldots,n, j=i,\ldots,n$ in the ordering of the basis, and the second coordinate only exists for $i<j$.

source
ManifoldsBase.get_vector β€” Method
get_vector(::HermitianPositiveDefinite{β„‚}, p, c, ::DefaultOrthonormalBasis)

Using the basis from get_basis the vector reconstruction with respect to this ONB can be simplified to

\[ X = p^{\frac{1}{2}} \Biggl( \sum_{i=1,j=i}^n c_k \Delta_{i,j} + \sum_{i=1,j=i+1}^n c_{k+1} \Delta^{\mathrm{i}}_{i,j} \Biggr) p^{\frac{1}{2}}\]

where $k$ is the linearized index of the $i=1,\ldots,n, j=i,\ldots,n$ in the ordering of the basis.

source
ManifoldsBase.inner β€” Method
inner(M::HermitianPositiveDefinite, p, X, Y)
inner(M::MetricManifold{HermitianPositiveDefinite,AffineInvariantMetric}, p, X, Y)

Compute the inner product of X, Y in the tangent space of p on the HermitianPositiveDefinite manifold M, as a MetricManifold with AffineInvariantMetric. The formula reads

\[g_p(X,Y) = \operatorname{tr}(p^{-1} X p^{-1} Y),\]

see [Smi05], Eq. (4). The trace is real for Hermitian $X$ and $Y$, since by the cyclic property of the trace it equals $\operatorname{tr}\bigl((p^{-\frac{1}{2}}Xp^{-\frac{1}{2}})(p^{-\frac{1}{2}}Yp^{-\frac{1}{2}})\bigr)$, the trace of a product of two Hermitian matrices.

source
ManifoldsBase.parallel_transport_to β€” Method
parallel_transport_to(M::HermitianPositiveDefinite, p, X, q)
parallel_transport_to(M::MetricManifold{HermitianPositiveDefinite,AffineInvariantMetric}, p, X, y)

Compute the parallel transport of X from the tangent space at p to the tangent space at q on the HermitianPositiveDefinite as a MetricManifold with the AffineInvariantMetric. The formula reads

\[\mathcal P_{q←p}X = p^{\frac{1}{2}} \operatorname{Exp}\bigl( \frac{1}{2}p^{-\frac{1}{2}}\log_p(q)p^{-\frac{1}{2}} \bigr) p^{-\frac{1}{2}}X p^{-\frac{1}{2}} \operatorname{Exp}\bigl( \frac{1}{2}p^{-\frac{1}{2}}\log_p(q)p^{-\frac{1}{2}} \bigr) p^{\frac{1}{2}},\]

where $\operatorname{Exp}$ denotes the matrix exponential and log the logarithmic map on HermitianPositiveDefinite (again with respect to the AffineInvariantMetric), see [Smi05], Eq. (104), the parallel translation along the geodesic from $p$ in direction $D$, evaluated at $t = 1$ with $D = \log_p q$.

source

Statistics

Efficient representation

When a point p is used in several occasions, it might be beneficial to store the eigenvalues and vectors of p and optionally its square root and the inverse of the square root. The MatrixSqrtManifoldPoint can be used for exactly that.

Manifolds.MatrixSqrtManifoldPoint β€” Type
MatrixSqrtManifoldPoint{P,Q,R,E} <: AbstractManifoldPoint

A point represented by a matrix $p$ together with its eigenvalue decomposition.

The matrix $p ∈ 𝔽^{nΓ—n}$ is over a field $𝔽 ∈ \{ℝ,β„‚\}$; besides its eigenvalue decomposition the point optionally stores $p$ itself, its matrix square root $p^{\frac{1}{2}}$ and the inverse $p^{-\frac{1}{2}}$ of the square root, to avoid their repeated computation.

This is for example used on the HermitianPositiveDefinite manifold.

Fields

  • p::P the matrix representation of the point or missing
  • eigen::E the eigenvalue decomposition eigen(Hermitian(p)) of p
  • sqrt::Q the matrix square root of p or missing
  • sqrt_inv::R the inverse of the matrix square root of p or missing

Only the field eigen is always stored. Each of the other three fields can be set to missing (its field type is then Missing) to indicate that it is not stored; it is then computed from eigen when required, but still not stored.

Constructor

MatrixSqrtManifoldPoint(p::AbstractMatrix; store_p=true, store_sqrt=true, store_sqrt_inv=true)

Create a MatrixSqrtManifoldPoint from the Hermitian positive definite matrix p, where you can optionally store p, sqrt and sqrt_inv.

source

and there are three internal functions to be able to use MatrixSqrtManifoldPoint interchangeably with the default representation as a matrix.

Manifolds.hpd_sqrt_and_sqrt_inv β€” Function
hpd_sqrt_and_sqrt_inv(p::AbstractMatrix)
hpd_sqrt_and_sqrt_inv(p::MatrixSqrtManifoldPoint)

Return $p^{\frac{1}{2}}$ and $p^{-\frac{1}{2}}$ by either computing them (if they are missing or for the AbstractMatrix) or returning their stored value from within the MatrixSqrtManifoldPoint.

Compared to calling single methods hpd_sqrt and hpd_sqrt_inv this method only computes the eigenvectors once for the case of the AbstractMatrix or if both are missing.

This method assumes that p represents a Hermitian positive definite matrix.

source

Literature

[BH06]
R.Β Bhatia and J.Β Holbrook. Riemannian geometry and matrix geometric means. LinearΒ AlgebraΒ andΒ itsΒ Applications 413, 594–618 (2006).
[Ngu23]
D.Β Nguyen. Operator-Valued Formulas for Riemannian Gradient and Hessian and Families of Tractable Metrics in Riemannian Optimization. JournalΒ ofΒ OptimizationΒ TheoryΒ andΒ Applications 198, 135–164 (2023), arXiv:2009.10159.
[Smi05]
S.Β T.Β Smith. Covariance, Subspace, and Intrinsic CramΓ©r–Rao Bounds. IEEEΒ TransactionsΒ onΒ SignalΒ Processing 53, 1610–1630 (2005).