# Hamiltonian matrices

Manifolds.Hamiltonian โ Type
Hamiltonian{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$

source
Manifolds.HamiltonianMatrices โ Type
HamiltonianMatrices{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.

source
Base.rand โ Method
pX = 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}$$$
source
Manifolds.is_hamiltonian โ Method
is_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

source