1
0
mirror of https://github.com/kalmarek/Groups.jl.git synced 2024-12-24 18:05:27 +01:00

remove Alphabet arg from evaluate

This commit is contained in:
Marek Kaluba 2021-08-13 13:48:25 +02:00
parent 156e4a2af3
commit 4014b4f7b8
No known key found for this signature in database
GPG Key ID: 8BF1A3855328FC15
4 changed files with 15 additions and 12 deletions

View File

@ -105,16 +105,15 @@ function evaluate!(
t::NTuple{N,T},
f::AbstractFPGroupElement{<:AutomorphismGroup{<:Group}},
tmp = one(first(t)),
) where {N, T}
) where {N, T<:FPGroupElement}
A = alphabet(f)
AF = alphabet(object(parent(f)))
for idx in word(f)
t = @inbounds evaluate!(t, A[idx], AF, tmp)::NTuple{N,T}
t = @inbounds evaluate!(t, A[idx], tmp)::NTuple{N,T}
end
return t
end
evaluate!(t::NTuple{N, T}, s::GSymbol, A, tmp=one(first(t))) where {N, T} = throw("you need to implement `evaluate!(::$(typeof(t)), ::$(typeof(s)), ::Alphabet, tmp=one(first(t)))`")
evaluate!(t::NTuple{N, T}, s::GSymbol, tmp=nothing) where {N, T} = throw("you need to implement `evaluate!(::$(typeof(t)), ::$(typeof(s)), ::Alphabet, tmp=one(first(t)))`")
# forward evaluate by substitution
@ -132,7 +131,7 @@ function LettersMap(a::FPGroupElement{<:AutomorphismGroup})
# (dom[i] → img[i] is a map from domain to images)
# we need a map from alphabet indices → (gens, gens⁻¹) → images
# here we do it for elements of the domai
# here we do it for elements of the domain
# (trusting it's a set of generators that define a)
@assert length(dom) == length(img)

View File

@ -195,8 +195,7 @@ end
function evaluate!(
t::NTuple{N,T},
smc::SymplecticMappingClass,
A::Alphabet,
tmp = one(first(t)),
tmp=nothing,
) where {N,T}
t = smc.f(t[smc.perm])[smc.invperm]

View File

@ -45,9 +45,15 @@ Base.:(==)(t::Transvection, s::Transvection) =
t.id === s.id && t.ij == s.ij && t.inv == s.inv
Base.hash(t::Transvection, h::UInt) = hash(t.id, hash(t.ij, hash(t.inv, h)))
Base.@propagate_inbounds function evaluate!(v::NTuple{T, N}, t::Transvection, A::Alphabet, tmp=one(first(v))) where {T, N}
Base.@propagate_inbounds @inline function evaluate!(
v::NTuple{T, N},
t::Transvection,
tmp=one(first(v))
) where {T, N}
i, j = indices(t)
@assert i length(v) && j length(v)
@assert 1 i length(v) && 1 j length(v)
A = alphabet(parent(first(v)))
@inbounds begin
if t.id === :ϱ
@ -101,6 +107,5 @@ Base.inv(p::PermRightAut) = PermRightAut(invperm(p.perm))
Base.:(==)(p::PermRightAut, q::PermRightAut) = p.perm == q.perm
Base.hash(p::PermRightAut, h::UInt) = hash(p.perm, hash(PermRightAut, h))
function evaluate!(v::NTuple{T, N}, p::PermRightAut, ::Alphabet, tmp=one(first(v))) where {T, N}
return v[p.perm]
evaluate!(v::NTuple{T,N}, p::PermRightAut, tmp=nothing) where {T,N} = v[p.perm]
end

View File

@ -47,7 +47,7 @@
r = Groups.Transvection(:ϱ,i,j)
l = Groups.Transvection(,i,j)
(t::Groups.Transvection)(v::Tuple) = Groups.evaluate!(v, t, A4)
(t::Groups.Transvection)(v::Tuple) = Groups.evaluate!(v, t)
@test r(deepcopy(D)) == (a*b, b, c, d)
@test inv(r)(deepcopy(D)) == (a*b^-1,b, c, d)