fix and test issymplectic

This commit is contained in:
Marek Kaluba 2022-04-03 18:40:02 +02:00
parent 6774d40d11
commit 53773efac7
No known key found for this signature in database
GPG Key ID: 8BF1A3855328FC15
2 changed files with 8 additions and 5 deletions

View File

@ -58,14 +58,13 @@ function _std_symplectic_form(m::AbstractMatrix)
iseven(r) || return false
n = r÷2
Ω = zero(m)
for i in 1:n
Ω[2i-1:2i, 2i-1:2i] .= [0 -1; 1 0]
end
𝕆 = zeros(eltype(m), n, n)
𝕀 = one(eltype(m))*LinearAlgebra.I
Ω = [𝕆 -𝕀
𝕀 𝕆]
return Ω
end
function issymplectic(mat::M, Ω = _std_symplectic_form(mat)) where M <: AbstractMatrix
r, c = size(mat)
return Ω == transpose(mat) * Ω * mat
end

View File

@ -71,5 +71,9 @@ using Groups.MatrixGroups
@test sprint(print, x) isa String
@test length(word(x)) == 1
for g in gens(Sp6)
@test MatrixGroups.issymplectic(MatrixGroups.matrix_repr(g))
end
end
end