diff --git a/src/autgroups.jl b/src/autgroups.jl index 7c30686..6ac0165 100644 --- a/src/autgroups.jl +++ b/src/autgroups.jl @@ -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) diff --git a/src/groups/symplectic_twists.jl b/src/groups/symplectic_twists.jl index 6951e19..140216c 100644 --- a/src/groups/symplectic_twists.jl +++ b/src/groups/symplectic_twists.jl @@ -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] diff --git a/src/groups/transvections.jl b/src/groups/transvections.jl index 1b9a358..dc56f2f 100644 --- a/src/groups/transvections.jl +++ b/src/groups/transvections.jl @@ -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 diff --git a/test/AutFn.jl b/test/AutFn.jl index a269163..b8a3f1d 100644 --- a/test/AutFn.jl +++ b/test/AutFn.jl @@ -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)