1
0
mirror of https://github.com/kalmarek/Groups.jl.git synced 2024-11-19 14:35:28 +01:00

freely reduce words upon *

This commit is contained in:
Marek Kaluba 2023-03-22 21:44:09 +01:00
parent a1bc334fb2
commit c69eff1540
No known key found for this signature in database
GPG Key ID: 8BF1A3855328FC15
2 changed files with 21 additions and 12 deletions

View File

@ -144,7 +144,18 @@ end
function Base.:(*)(g::GEl, h::GEl) where {GEl<:AbstractFPGroupElement}
@boundscheck @assert parent(g) === parent(h)
return GEl(word(g) * word(h), parent(g))
A = alphabet(parent(g))
k = 0
while k + 1 min(length(word(g)), length(word(h)))
if inv(word(g)[end-k], A) == word(h)[k+1]
k += 1
else
break
end
end
w = @view(word(g)[1:end-k]) * @view(word(h)[k+1:end])
res = GEl(w, parent(g))
return res
end
function GroupsCore.isfiniteorder(g::AbstractFPGroupElement)

View File

@ -22,8 +22,6 @@ using Groups.MatrixGroups
S = unique([S; inv.(S)])
_, sizes = Groups.wlmetric_ball(S; radius = 4)
@test sizes == [7, 33, 141, 561]
_, sizes = Groups.wlmetric_ball_serial(S; radius = 4)
@test sizes == [7, 33, 141, 561]
Logging.with_logger(Logging.NullLogger()) do
@testset "GroupsCore conformance" begin
@ -35,9 +33,9 @@ using Groups.MatrixGroups
end
end
x = w * inv(w) * r
x = w * inv(SL3Z(word(w)[end:end])) * r
@test length(word(x)) == 5
@test length(word(x)) == length(word(r))
@test size(x) == (3, 3)
@test eltype(x) == Int8
@ -65,10 +63,10 @@ using Groups.MatrixGroups
end
end
x = gens(Sp6, 1)
x *= inv(x) * gens(Sp6, 2)
x = gens(Sp6, 1) * gens(Sp6, 2)^2
x *= inv(gens(Sp6, 2)^2) * gens(Sp6, 3)
@test length(word(x)) == 3
@test length(word(x)) == 2
@test size(x) == (6, 6)
@test eltype(x) == Int8
@ -80,7 +78,7 @@ using Groups.MatrixGroups
@test contains(sprint(show, MIME"text/plain"(), x), "∈ Sp{6,Int8}")
@test sprint(print, x) isa String
@test length(word(x)) == 1
@test length(word(x)) == 2
for g in gens(Sp6)
@test MatrixGroups.issymplectic(MatrixGroups.matrix(g))
@ -101,10 +99,10 @@ using Groups.MatrixGroups
end
end
x = gens(G, 1)
x *= inv(x) * gens(G, 2)
x = gens(G, 1) * gens(G, 2)^3
x *= gens(G, 2)^-3
@test length(word(x)) == 3
@test length(word(x)) == 1
@test size(x) == (6, 6)
@test eltype(x) == Int16