Hamiltonian matrices
Manifolds.Hamiltonian โ TypeHamiltonian{T,S<:AbstractMatrix{<:T}} <: AbstractMatrix{T}A type to store a Hamiltonian matrix, that is a square matrix for which $A^+ = -A$ where
\[A^+ = J_{2n}A^{\mathrm{T}}J_{2n}, \qquad J_{2n} \begin{pmatrix} 0 & I_n\\-I_n & 0 \end{pmatrix},\]
and $I_n$ denotes the $nรn$
Manifolds.HamiltonianMatrices โ TypeHamiltonianMatrices{๐ฝ, T} <: AbstractDecoratorManifold{๐ฝ}The AbstractManifold consisting of (real-valued) hamiltonian matrices of size $nรn$, i.e. the set
\[\mathfrak{sp}(2n,๐ฝ) = \bigl\{p โ ๐ฝ^{2nร2n}\ \big|\ p^+ = p \bigr\},\]
where $โ
^{+}$ denotes the symplectic_inverse, and $๐ฝ โ \{ โ, โ\}$.
Though it is slightly redundant, usually the matrices are stored as $2nร2n$ arrays.
The symbol $\mathfak{sp}$ refers to the main usage within Manifolds.jl that is the Lie algebra to the SymplecticMatrices interpreted as a Lie group with the matrix multiplication as group operation.
Constructor
HamiltonianMatrices(2n::Int, field::AbstractNumbers=โ)Generate the manifold of $2nร2n$ Hamiltonian matrices.
Base.:^ โ Method^(A::Hamiltonian, ::typeof(+))Compute the symplectic_inverse of a Hamiltonian (A)
Base.rand โ MethodpX = rand(M::HamiltonianMatrices; ฯ::Real=1.0, vector_at=nothing)
rand!(M::HamiltonianMatrices, pX; ฯ::Real=1.0, vector_at=nothing)Generate a random Hamiltonian matrix. Since these are a submanifold of $โ^{2nร2n}$, the same method applies for points and tangent vectors. This can also be done in-place of pX.
The construction is based on generating one normally-distributed $nรn$ matrix $A$ and two symmetric $nรn$ matrices $B, C$ which are then stacked:
\[p = \begin{pmatrix} A & B\\ C & -A^{\mathrm{T}} \end{pmatrix}\]
Manifolds.is_hamiltonian โ Methodis_hamiltonian(A::AbstractMatrix; kwargs...)Test whether a matrix A is hamiltonian. The test consists of verifying whether
\[A^+ = -A\]
where $A^+$ denotes the symplectic_inverse of A.
The passed keyword arguments are passed on to isapprox check within
ManifoldsBase.check_point โ Methodcheck_point(M::HamiltonianMatrices, p; kwargs...)Check whether p is a valid manifold point on the HamiltonianMatrices M, i.e. whether p is_hamiltonian.
The tolerance for the test of p can be set using kwargs....
ManifoldsBase.check_vector โ Methodcheck_vector(M::HamiltonianMatrices, p, X; kwargs... )Check whether X is a tangent vector to manifold point p on the HamiltonianMatrices M, i.e. X has to be a Hamiltonian matrix The tolerance for is_hamiltonian X can be set using kwargs....
ManifoldsBase.is_flat โ Methodis_flat(::HamiltonianMatrices)Return true. HamiltonianMatrices is a flat manifold.