mirror of
https://github.com/kalmarek/Groups.jl.git
synced 2024-11-19 14:35:28 +01:00
more coverage: MatrixGroups
This commit is contained in:
parent
c9a4b00ceb
commit
6774d40d11
@ -28,8 +28,8 @@ function Base.show(
|
|||||||
::MIME"text/plain",
|
::MIME"text/plain",
|
||||||
sp::Groups.AbstractFPGroupElement{<:SymplecticGroup{N}}
|
sp::Groups.AbstractFPGroupElement{<:SymplecticGroup{N}}
|
||||||
) where {N}
|
) where {N}
|
||||||
normalform!(sp)
|
Groups.normalform!(sp)
|
||||||
print(io, "$N×$N Symplectic matrix: ")
|
print(io, "$N×$N symplectic matrix: ")
|
||||||
KnuthBendix.print_repr(io, word(sp), alphabet(sp))
|
KnuthBendix.print_repr(io, word(sp), alphabet(sp))
|
||||||
println(io)
|
println(io)
|
||||||
Base.print_array(io, matrix_repr(sp))
|
Base.print_array(io, matrix_repr(sp))
|
||||||
|
@ -22,10 +22,6 @@ Groups.rewriting(M::MatrixGroup) = alphabet(M)
|
|||||||
Base.hash(sl::MatrixGroupElement, h::UInt) =
|
Base.hash(sl::MatrixGroupElement, h::UInt) =
|
||||||
hash(matrix_repr(sl), hash(parent(sl), h))
|
hash(matrix_repr(sl), hash(parent(sl), h))
|
||||||
|
|
||||||
Base.getindex(sl::MatrixGroupElement, i, j) = matrix_repr(sl)[i,j]
|
|
||||||
# Base.iterate(sl::MatrixGroupElement) = iterate(sl.elts)
|
|
||||||
# Base.iterate(sl::MatrixGroupElement, state) = iterate(sl.elts, state)
|
|
||||||
|
|
||||||
function matrix_repr(m::MatrixGroupElement{N, T}) where {N, T}
|
function matrix_repr(m::MatrixGroupElement{N, T}) where {N, T}
|
||||||
if isone(word(m))
|
if isone(word(m))
|
||||||
return StaticArrays.SMatrix{N, N, T}(LinearAlgebra.I)
|
return StaticArrays.SMatrix{N, N, T}(LinearAlgebra.I)
|
||||||
|
@ -22,12 +22,6 @@ function Base.show(io::IO, s::ElementarySymplectic)
|
|||||||
!isone(s.val) && print(io, "^$(s.val)")
|
!isone(s.val) && print(io, "^$(s.val)")
|
||||||
end
|
end
|
||||||
|
|
||||||
function Base.show(io::IO, ::MIME"text/plain", s::ElementarySymplectic)
|
|
||||||
print(io, s)
|
|
||||||
print(io, " → corresponding root: ")
|
|
||||||
print(io, Roots.Root(s))
|
|
||||||
end
|
|
||||||
|
|
||||||
_ind(s::ElementarySymplectic{N}) where N = (s.i, s.j)
|
_ind(s::ElementarySymplectic{N}) where N = (s.i, s.j)
|
||||||
_local_ind(N_half::Integer, i::Integer) = ifelse(i<=N_half, i, i-N_half)
|
_local_ind(N_half::Integer, i::Integer) = ifelse(i<=N_half, i, i-N_half)
|
||||||
function _dual_ind(s::ElementarySymplectic{N}) where N
|
function _dual_ind(s::ElementarySymplectic{N}) where N
|
||||||
|
@ -32,6 +32,19 @@ using Groups.MatrixGroups
|
|||||||
test_GroupElement_interface(g, h)
|
test_GroupElement_interface(g, h)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
x = w*inv(w)*r
|
||||||
|
|
||||||
|
@test length(word(x)) == 5
|
||||||
|
@test size(x) == (3,3)
|
||||||
|
@test eltype(x) == Int8
|
||||||
|
|
||||||
|
@test contains(sprint(print, SL3Z), "special linear group of 3×3")
|
||||||
|
@test contains(sprint(show, MIME"text/plain"(), x), "SL{3,Int8} matrix:")
|
||||||
|
@test sprint(print, x) isa String
|
||||||
|
|
||||||
|
@test length(word(x)) == 3
|
||||||
end
|
end
|
||||||
|
|
||||||
@testset "Sp(6, ℤ)" begin
|
@testset "Sp(6, ℤ)" begin
|
||||||
@ -44,5 +57,19 @@ using Groups.MatrixGroups
|
|||||||
|
|
||||||
test_GroupElement_interface(g, h)
|
test_GroupElement_interface(g, h)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@test contains(sprint(print, Sp6), "group of 6×6 symplectic matrices")
|
||||||
|
|
||||||
|
x = gens(Sp6, 1)
|
||||||
|
x *= inv(x) * gens(Sp6, 2)
|
||||||
|
|
||||||
|
@test length(word(x)) == 3
|
||||||
|
@test size(x) == (6,6)
|
||||||
|
@test eltype(x) == Int8
|
||||||
|
|
||||||
|
@test contains(sprint(show, MIME"text/plain"(), x), "6×6 symplectic matrix:")
|
||||||
|
@test sprint(print, x) isa String
|
||||||
|
|
||||||
|
@test length(word(x)) == 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user