1
0
mirror of https://github.com/kalmarek/Groups.jl.git synced 2024-12-25 02:05:30 +01:00

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

View File

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