# Symplectic

The Symplectic manifold, denoted $\operatorname{Sp}(2n, \mathbb{F})$, is a closed, embedded, submanifold of $\mathbb{F}^{2n \times 2n}$ that represents transformations into symplectic subspaces which keep the canonical symplectic form over $\mathbb{F}^{2n \times 2n }$ invariant under the standard embedding inner product. The canonical symplectic form is a non-degenerate bilinear and skew symmetric map $\omega\colon \mathbb{F}^{2n} \times \mathbb{F}^{2n} \rightarrow \mathbb{F}$, given by $\omega(x, y) = x^T Q_{2n} y$ for elements $x, y \in \mathbb{F}^{2n}$, with

$$$Q_{2n} = \begin{bmatrix} 0_n & I_n \\ -I_n & 0_n \end{bmatrix}.$$$

That means that an element $p \in \operatorname{Sp}(2n)$ must fulfill the requirement that

$$$\omega (p x, p y) = x^T(p^TQp)y = x^TQy = \omega(x, y),$$$

leading to the requirement on $p$ that $p^TQp = Q$.

The symplectic manifold also forms a group under matrix multiplication, called the $\textit{symplectic group}$. Since all the symplectic matrices necessarily have determinant one, the symplectic group $\operatorname{Sp}(2n, \mathbb{F})$ is a subgroup of the special linear group, $\operatorname{SL}(2n, \mathbb{F})$. When the underlying field is either $\mathbb{R}$ or $\mathbb{C}$ the symplectic group with a manifold structure constitutes a Lie group, with the Lie Algebra

$$$\mathfrak{sp}(2n,F) = \{H \in \mathbb{F}^{2n \times 2n} \;|\; Q H + H^{T} Q = 0\}.$$$

This set is also known as the Hamiltonian matrices, which have the property that $(QH)^T = QH$ and are commonly used in physics.

Manifolds.ExtendedSymplecticMetricType
ExtendedSymplecticMetric <: AbstractMetric

The extension of the RealSymplecticMetric at a point p \in \operatorname{Sp}(2n) as an inner product over the embedding space $ℝ^{2n \times 2n}$, i.e.

$$$\langle x, y \rangle_{p} = \langle p^{-1}x, p^{-1}\rangle_{\operatorname{Fr}} = \operatorname{tr}(x^T(pp^T)^{-1}y), \;\forall\; x, y \in ℝ^{2n \times 2n}.$$$
source
Manifolds.RealSymplecticMetricType
RealSymplecticMetric <: RiemannianMetric

The canonical Riemannian metric on the symplectic manifold, defined pointwise for $p \in \operatorname{Sp}(2n)$ by [FioriSimone2011]

\begin{align*} & g_p \colon T_p\operatorname{Sp}(2n) \times T_p\operatorname{Sp}(2n) \rightarrow ℝ, \\ & g_p(Z_1, Z_2) = \operatorname{tr}((p^{-1}Z_1)^T (p^{-1}Z_2)). \end{align*}

This metric is also the default metric for the Symplectic manifold.

source
Manifolds.SymplecticType
Symplectic{n, 𝔽} <: AbstractEmbeddedManifold{𝔽, DefaultIsometricEmbeddingType}

The symplectic manifold consists of all $2n \times 2n$ matrices which preserve the canonical symplectic form over $𝔽^{2n × 2n} \times 𝔽^{2n × 2n}$,

$$$\omega\colon 𝔽^{2n × 2n} \times 𝔽^{2n × 2n} \rightarrow 𝔽, \quad \omega(x, y) = p^T Q_{2n} q, \; x, y \in 𝔽^{2n × 2n},$$$

where

$$$Q_{2n} = \begin{bmatrix} 0_n & I_n \\ -I_n & 0_n \end{bmatrix}.$$$

That is, the symplectic manifold consists of

$$$\operatorname{Sp}(2n, ℝ) = \bigl\{ p ∈ ℝ^{2n × 2n} \, \big| \, p^TQ_{2n}p = Q_{2n} \bigr\},$$$

with $0_n$ and $I_n$ denoting the $n × n$ zero-matrix and indentity matrix in $ℝ^{n \times n}$ respectively.

The tangent space at a point $p$ is given by [Bendokat2021]

\begin{align*} T_p\operatorname{Sp}(2n) &= \{X \in \mathbb{R}^{2n \times 2n} \;|\; p^{T}Q_{2n}X + X^{T}Q_{2n}p = 0 \}, \\ &= \{X = pQS \;|\; S ∈ R^{2n × 2n}, S^T = S \}. \end{align*}

Constructor

Symplectic(2n, field=ℝ) -> Symplectic{div(2n, 2), field}()

Generate the (real-valued) symplectic manifold of $2n \times 2n$ symplectic matrices. The constructor for the Symplectic manifold accepts the even column/row embedding dimension $2n$ for the real symplectic manifold, $ℝ^{2n × 2n}$.

source
Manifolds.SymplecticMatrixType
SymplecticMatrix{T}

A lightweight structure to represent the action of the matrix representation of the canonical symplectic form,

$$$Q_{2n}(λ) = λ \begin{bmatrix} 0_n & I_n \\ -I_n & 0_n \end{bmatrix} \quad \in ℝ^{2n \times 2n},$$$

such that the canonical symplectic form is represented by

$$$\omega_{2n}(x, y) = x^TQ_{2n}(1)y, \quad x, y \in ℝ^{2n}.$$$

The entire matrix is however not instantiated in memory, instead a scalar $λ$ of type T is stored, which is used to keep track of scaling and transpose operations applied to each SymplecticMatrix. For example, given Q = SymplecticMatrix(1.0) represented as 1.0*[0 I; -I 0], the adjoint Q' returns SymplecticMatrix(-1.0) = (-1.0)*[0 I; -I 0].

source
Base.expMethod
exp(M::Symplectic, p, X)
exp!(M::Symplectic, q, p, X)

The Exponential mapping on the Symplectic manifold with the RealSymplecticMetric Riemannian metric.

For the point $p \in \operatorname{Sp}(2n)$ the exponential mapping along the tangent vector $X \in T_p\operatorname{Sp}(2n)$ is computed as [WangRealSymplecticGroup]

$$$\operatorname{exp}_p(X) = p \operatorname{Exp}((p^{-1}X)^T) \operatorname{Exp}(p^{-1}X - (p^{-1}X)^T),$$$

where $\operatorname{Exp}(\cdot)$ denotes the matrix exponential.

source
Base.invMethod
inv(::Symplectic, A)
inv!(::Symplectic, A)

Compute the symplectic inverse $A^+$ of matrix $A ∈ ℝ^{2n × 2n}$. Given a matrix

$$$A ∈ ℝ^{2n × 2n},\quad A = \begin{bmatrix} A_{1,1} & A_{1,2} \\ A_{2,1} & A_{2, 2} \end{bmatrix}$$$

the symplectic inverse is defined as:

$$$A^{+} := Q_{2n}^T A^T Q_{2n},$$$

where

$$$Q_{2n} = \begin{bmatrix} 0_n & I_n \\ -I_n & 0_n \end{bmatrix}.$$$

The symplectic inverse of A can be expressed explicitly as:

$$$A^{+} = \begin{bmatrix} A_{2, 2}^T & -A_{1, 2}^T \\[1.2mm] -A_{2, 1}^T & A_{1, 1}^T \end{bmatrix}.$$$
source
Base.randMethod
rand(::SymplecticStiefel; vector_at=nothing,
hamiltonian_norm = (vector_at === nothing ? 1/2 : 1.0))

Generate a random point on $\operatorname{Sp}(2n)$ or a random tangent vector $X \in T_p\operatorname{Sp}(2n)$ if vector_at is set to a point $p \in \operatorname{Sp}(2n)$.

A random point on $\operatorname{Sp}(2n)$ is constructed by generating a random Hamiltonian matrix $Ω \in \mathfrak{sp}(2n,F)$ with norm hamiltonian_norm, and then transforming it to a symplectic matrix by applying the Cayley transform

$$$\operatorname{cay}\colon \mathfrak{sp}(2n,F) \rightarrow \operatorname{Sp}(2n), \; \Omega \mapsto (I - \Omega)^{-1}(I + \Omega).$$$

To generate a random tangent vector in $T_p\operatorname{Sp}(2n)$, this code employs the second tangent vector space parametrization of Symplectic. It first generates a random symmetric matrix $S$ by S = randn(2n, 2n) and then symmetrizes it as S = S + S'. Then $S$ is normalized to have Frobenius norm of hamiltonian_norm and X = pQS is returned, where Q is the SymplecticMatrix.

source
Manifolds.change_representerMethod
change_representer(::Symplectic, ::EuclideanMetric, p, X)
change_representer!(::Symplectic, Y, ::EuclideanMetric, p, X)

Compute the representation of a tangent vector $ξ ∈ T_p\operatorname{Sp}(2n, ℝ)$ s.t.

$$$g_p(c_p(ξ), η) = ⟨ξ, η⟩^{\text{Euc}} \;∀\; η ∈ T_p\operatorname{Sp}(2n, ℝ).$$$

with the conversion function

$$$c_p : T_p\operatorname{Sp}(2n, ℝ) \rightarrow T_p\operatorname{Sp}(2n, ℝ), \quad c_p(ξ) = \frac{1}{2} pp^T ξ + \frac{1}{2} pQ ξ^T pQ.$$$

Each of the terms $c_p^1(ξ) = p p^T ξ$ and $c_p^2(ξ) = pQ ξ^T pQ$ from the above definition of $c_p(η)$ are themselves metric compatible in the sense that

$$$c_p^i : T_p\operatorname{Sp}(2n, ℝ) \rightarrow \mathbb{R}^{2n \times 2n}\quad g_p^i(c_p(ξ), η) = ⟨ξ, η⟩^{\text{Euc}} \;∀\; η ∈ T_p\operatorname{Sp}(2n, ℝ),$$$

for $i \in {1, 2}$. However the range of each function alone is not confined to $T_p\operatorname{Sp}(2n, ℝ)$, but the convex combination

$$$c_p(ξ) = \frac{1}{2}c_p^1(ξ) + \frac{1}{2}c_p^2(ξ)$$$

does have the correct range $T_p\operatorname{Sp}(2n, ℝ)$.

source
Manifolds.change_representerMethod
change_representer(MetMan::MetricManifold{𝔽, Euclidean{Tuple{m, n}, 𝔽}, ExtendedSymplecticMetric},
EucMet::EuclideanMetric, p, X)
change_representer!(MetMan::MetricManifold{𝔽, Euclidean{Tuple{m, n}, 𝔽}, ExtendedSymplecticMetric},
Y, EucMet::EuclideanMetric, p, X)

Change the representation of a matrix $ξ ∈ \mathbb{R}^{2n \times 2n}$ into the inner product space $(ℝ^{2n \times 2n}, g_p)$ where the inner product is given by $g_p(ξ, η) = \langle p^{-1}ξ, p^{-1}η \rangle = \operatorname{tr}(ξ^T(pp^T)^{-1}η)$, as the extension of the RealSymplecticMetric onto the entire embedding space.

By changing the representation we mean to apply a mapping

$$$c_p : \mathbb{R}^{2n \times 2n} \rightarrow \mathbb{R}^{2n \times 2n},$$$

defined by requiring that it satisfy the metric compatibility condition

$$$g_p(c_p(ξ), η) = ⟨p^{-1}c_p(ξ), p^{-1}η⟩ = ⟨ξ, η⟩^{\text{Euc}} \;∀\; η ∈ T_p\operatorname{Sp}(2n, ℝ).$$$

In this case, we compute the mapping

$$$c_p(ξ) = pp^T ξ.$$$
source
Manifolds.gradientMethod
gradient(M::Symplectic, f, p, backend::RiemannianProjectionBackend;
extended_metric=true)
extended_metric=true)

Compute the manifold gradient $\text{grad}f(p)$ of a scalar function $f \colon \operatorname{Sp}(2n) \rightarrow ℝ$ at $p \in \operatorname{Sp}(2n)$.

The element $\text{grad}f(p)$ is found as the Riesz representer of the differential $\text{D}f(p) \colon T_p\operatorname{Sp}(2n) \rightarrow ℝ$ w.r.t. the Riemannian metric inner product at $p$ [FioriSimone2011]. That is, $\text{grad}f(p) \in T_p\operatorname{Sp}(2n)$ solves the relation

$$$g_p(\text{grad}f(p), X) = \text{D}f(p) \quad\forall\; X \in T_p\operatorname{Sp}(2n).$$$

The default behaviour is to first change the representation of the Euclidean gradient from the Euclidean metric to the RealSymplecticMetric at $p$, and then we projecting the result onto the correct tangent tangent space $T_p\operatorname{Sp}(2n, ℝ)$ w.r.t the Riemannian metric $g_p$ extended to the entire embedding space.

Arguments:

• extended_metric = true: If true, compute the gradient $\text{grad}f(p)$ by first changing the representer of the Euclidean gradient of a smooth extension of $f$, $∇f(p)$, w.r.t. the RealSymplecticMetric at $p$ extended to the entire embedding space, before projecting onto the correct tangent vector space w.r.t. the same extended metric $g_p$. If false, compute the gradient by first projecting $∇f(p)$ onto the tangent vector space, before changing the representer in the tangent vector space to comply with the RealSymplecticMetric.
source
Manifolds.project_normal!Method
project_normal!(::MetricManifold{𝔽,Euclidean,ExtendedSymplecticMetric}, Y, p, X)

Project onto the normal of the tangent space $(T_p\operatorname{Sp}(2n))^{\perp_g}$ at a point $p ∈ \operatorname{Sp}(2n)$, relative to the riemannian metric $g$ RealSymplecticMetric. That is,

$$$(T_p\operatorname{Sp}(2n))^{\perp_g} = \{Y \in \mathbb{R}^{2n \times 2n} : g_p(Y, X) = 0 \;\forall\; X \in T_p\operatorname{Sp}(2n)\}.$$$

The closed form projection operator onto the normal space is given by [Gao2021Riemannian]

$$$\operatorname{P}^{(T_p\operatorname{Sp}(2n))\perp}_{g_p}(X) = pQ\operatorname{skew}(p^TQ^TX),$$$

where $\operatorname{skew}(A) = \frac{1}{2}(A - A^T)$. This function is not exported.

source
Manifolds.symplectic_inverse_timesMethod
symplectic_inverse_times(::Symplectic, p, q)
symplectic_inverse_times!(::Symplectic, A, p, q)

Directly compute the symplectic inverse of $p \in \operatorname{Sp}(2n)$, multiplied with $q \in \operatorname{Sp}(2n)$. That is, this function efficiently computes $p^+q = (Q_{2n}p^TQ_{2n})q \in ℝ^{2n \times 2n}$, where $Q_{2n}$ is the SymplecticMatrix of size $2n \times 2n$.

source
ManifoldsBase.check_pointMethod
check_point(M::Symplectic, p; kwargs...)

Check whether p is a valid point on the Symplectic M=$\operatorname{Sp}(2n)$, i.e. that it has the right AbstractNumbers type and $p^{+}p$ is (approximately) the identity, where $A^{+} = Q_{2n}^TA^TQ_{2n}$ is the symplectic inverse, with

$$$Q_{2n} = \begin{bmatrix} 0_n & I_n \\ -I_n & 0_n \end{bmatrix}.$$$

The tolerance can be set with kwargs... (e.g. atol = 1.0e-14).

source
ManifoldsBase.check_vectorMethod
check_vector(M::Symplectic, p, X; kwargs...)

Checks whether X is a valid tangent vector at p on the Symplectic M=$\operatorname{Sp}(2n)$, i.e. the AbstractNumbers fits and it (approximately) holds that $p^{T}Q_{2n}X + X^{T}Q_{2n}p = 0$, where

$$$Q_{2n} = \begin{bmatrix} 0_n & I_n \\ -I_n & 0_n \end{bmatrix}.$$$

The tolerance can be set with kwargs... (e.g. atol = 1.0e-14).

source
ManifoldsBase.distanceMethod
distance(M::Symplectic, p, q)

Compute an approximate geodesic distance between two Symplectic matrices $p, q \in \operatorname{Sp}(2n)$, as done in [WangRealSymplecticGroup].

$$$\operatorname{dist}(p, q) ≈ ||\operatorname{Log}(p^+q)||_{\operatorname{Fr}},$$$

where the $\operatorname{Log}(\cdot)$ operator is the matrix logarithm.

This approximation is justified by first recalling the Baker-Campbell-Hausdorf formula,

$$$\operatorname{Log}(\operatorname{Exp}(A)\operatorname{Exp}(B)) = A + B + \frac{1}{2}[A, B] + \frac{1}{12}[A, [A, B]] + \frac{1}{12}[B, [B, A]] + \ldots \;.$$$

Then we write the expression for the exponential map from $p$ to $q$ as

$$$q = \operatorname{exp}_p(X) = p \operatorname{Exp}((p^{+}X)^T) \operatorname{Exp}([p^{+}X - (p^{+}X)^T]), X \in T_p\operatorname{Sp},$$$

and with the geodesic distance between $p$ and $q$ given by $\operatorname{dist}(p, q) = ||X||_p = ||p^+X||_{\operatorname{Fr}}$ we see that

\begin{align*} ||\operatorname{Log}(p^+q)||_{\operatorname{Fr}} &= ||\operatorname{Log}\left( \operatorname{Exp}((p^{+}X)^T) \operatorname{Exp}(p^{+}X - (p^{+}X)^T) \right)||_{\operatorname{Fr}} \\ &= ||p^{+}X + \frac{1}{2}[(p^{+}X)^T, p^{+}X - (p^{+}X)^T] + \ldots ||_{\operatorname{Fr}} \\ &≈ ||p^{+}X||_{\operatorname{Fr}} = \operatorname{dist}(p, q). \end{align*}
source
ManifoldsBase.inverse_retractMethod
inverse_retract(M::Symplectic, p, q, ::CayleyInverseRetraction)

Compute the Cayley Inverse Retraction $X = \mathcal{L}_p^{\operatorname{Sp}}(q)$ such that the Cayley Retraction from $p$ along $X$ lands at $q$, i.e. $\mathcal{R}_p(X) = q$ [Bendokat2021].

First, recall the definition the standard symplectic matrix

$$$Q = \begin{bmatrix} 0 & I \\ -I & 0 \end{bmatrix}$$$

as well as the symplectic inverse of a matrix $A$, $A^{+} = Q^T A^T Q$.

For $p, q ∈ \operatorname{Sp}(2n, ℝ)$ then, we can then define the inverse cayley retraction as long as the following matrices exist.

$$$U = (I + p^+ q)^{-1}, \quad V = (I + q^+ p)^{-1}.$$$

If that is the case, the inverse cayley retration at $p$ applied to $q$ is

$$$\mathcal{L}_p^{\operatorname{Sp}}(q) = 2p\bigl(V - U\bigr) + 2\bigl((p + q)U - p\bigr) ∈ T_p\operatorname{Sp}(2n).$$$
source
ManifoldsBase.manifold_dimensionMethod
manifold_dimension(::Symplectic{n})

Returns the dimension of the symplectic manifold embedded in $ℝ^{2n \times 2n}$, i.e.

$$$\operatorname{dim}(\operatorname{Sp}(2n)) = (2n + 1)n.$$$
source
ManifoldsBase.project!Method
project!(::MetricManifold{𝔽,Euclidean,ExtendedSymplecticMetric}, Y, p, X) where {𝔽}

Compute the projection of $X ∈ R^{2n × 2n}$ onto $T_p\operatorname{Sp}(2n, ℝ)$ w.r.t. the Riemannian metric $g$ RealSymplecticMetric. The closed form projection mapping is given by [Gao2021Riemannian]

$$$\operatorname{P}^{T_p\operatorname{Sp}(2n)}_{g_p}(X) = pQ\operatorname{sym}(p^TQ^TX),$$$

where $\operatorname{sym}(A) = \frac{1}{2}(A + A^T)$. This function is not exported.

source
ManifoldsBase.projectMethod
project(::Symplectic, p, A)
project!(::Symplectic, Y, p, A)

Given a point $p \in \operatorname{Sp}(2n)$, project an element $A \in \mathbb{R}^{2n \times 2n}$ onto the tangent space $T_p\operatorname{Sp}(2n)$ relative to the euclidean metric of the embedding $\mathbb{R}^{2n \times 2n}$.

That is, we find the element $X \in T_p\operatorname{SpSt}(2n, 2k)$ which solves the constrained optimization problem

$$$\operatorname{min}_{X \in \mathbb{R}^{2n \times 2n}} \frac{1}{2}||X - A||^2, \quad \text{s.t.}\; h(X) \colon= X^T Q p + p^T Q X = 0,$$$

where $h\colon\mathbb{R}^{2n \times 2n} \rightarrow \operatorname{skew}(2n)$ defines the restriction of $X$ onto the tangent space $T_p\operatorname{SpSt}(2n, 2k)$.

source
ManifoldsBase.retractMethod
retract(::Symplectic, p, X, ::CayleyRetraction)
retract!(::Symplectic, q, p, X, ::CayleyRetraction)

Compute the Cayley retraction on $p ∈ \operatorname{Sp}(2n, ℝ)$ in the direction of tangent vector $X ∈ T_p\operatorname{Sp}(2n, ℝ)$, as defined in by Birtea et al in proposition 2 [birtea2020optimization].

Using the symplectic inverse of a matrix $A \in ℝ^{2n \times 2n}$, $A^{+} := Q_{2n}^T A^T Q_{2n}$ where

$$$Q_{2n} = \begin{bmatrix} 0_n & I_n \\ -I_n & 0_n \end{bmatrix},$$$

the retraction $\mathcal{R}\colon T\operatorname{Sp}(2n) \rightarrow \operatorname{Sp}(2n)$ is defined pointwise as

\begin{align*} \mathcal{R}_p(X) &= p \operatorname{cay}\left(\frac{1}{2}p^{+}X\right), \\ &= p \operatorname{exp}_{1/1}(p^{+}X), \\ &= p (2I - p^{+}X)^{-1}(2I + p^{+}X). \end{align*}

Here $\operatorname{exp}_{1/1}(z) = (2 - z)^{-1}(2 + z)$ denotes the Padé (1, 1) approximation to $\operatorname{exp}(z)$.

source

## Literature

• WangRealSymplecticGroup

Wang, Jing and Sun, Huafei and Fiori, Simone: A Riemannian-steepest-descent approach for optimization on the real symplectic group, Mathematical Methods in the Applied Sciences, 41(11) pp. 4273-4286, 2018 doi 10.1002/mma.4890

• FioriSimone2011

Simone Fiori: Solving minimal-distance problems over the manifold of real-symplectic matrices, SIAM Journal on Matrix Analysis and Applications 32(3), pp. 938-968, 2011. doi 10.1137/100817115.

• Gao2021Riemannian

Gao, Bin and Son, Nguyen Thanh and Absil, P-A and Stykel, Tatjana: Riemannian optimization on the symplectic Stiefel manifold, SIAM Journal on Optimization 31(2), pp. 1546-1575, 2021. doi 10.1137/20M1348522

• Bendokat2021

Bendokat, Thomas and Zimmermann, Ralf: The real symplectic Stiefel and Grassmann manifolds: metrics, geodesics and applications arXiv preprint arXiv:2108.12447, 2021 (https://arxiv.org/abs/2108.12447)

• birtea2020optimization

Birtea, Petre and Ca{\c{s}}u, Ioan and Com{\u{a}}nescu, Dan: Optimization on the real symplectic group, Monatshefte f{"u}r Mathematik, Springer doi 10.1007/s00605-020-01369-9