mirror of
https://github.com/kalmarek/Groups.jl.git
synced 2024-12-25 02:05:30 +01:00
remove Alphabet arg from evaluate
This commit is contained in:
parent
156e4a2af3
commit
4014b4f7b8
@ -105,16 +105,15 @@ function evaluate!(
|
|||||||
t::NTuple{N,T},
|
t::NTuple{N,T},
|
||||||
f::AbstractFPGroupElement{<:AutomorphismGroup{<:Group}},
|
f::AbstractFPGroupElement{<:AutomorphismGroup{<:Group}},
|
||||||
tmp = one(first(t)),
|
tmp = one(first(t)),
|
||||||
) where {N, T}
|
) where {N, T<:FPGroupElement}
|
||||||
A = alphabet(f)
|
A = alphabet(f)
|
||||||
AF = alphabet(object(parent(f)))
|
|
||||||
for idx in word(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
|
end
|
||||||
return t
|
return t
|
||||||
end
|
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
|
# forward evaluate by substitution
|
||||||
|
|
||||||
@ -132,7 +131,7 @@ function LettersMap(a::FPGroupElement{<:AutomorphismGroup})
|
|||||||
|
|
||||||
# (dom[i] → img[i] is a map from domain to images)
|
# (dom[i] → img[i] is a map from domain to images)
|
||||||
# we need a map from alphabet indices → (gens, gens⁻¹) → 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)
|
# (trusting it's a set of generators that define a)
|
||||||
@assert length(dom) == length(img)
|
@assert length(dom) == length(img)
|
||||||
|
|
||||||
|
@ -195,8 +195,7 @@ end
|
|||||||
function evaluate!(
|
function evaluate!(
|
||||||
t::NTuple{N,T},
|
t::NTuple{N,T},
|
||||||
smc::SymplecticMappingClass,
|
smc::SymplecticMappingClass,
|
||||||
A::Alphabet,
|
tmp=nothing,
|
||||||
tmp = one(first(t)),
|
|
||||||
) where {N,T}
|
) where {N,T}
|
||||||
|
|
||||||
t = smc.f(t[smc.perm])[smc.invperm]
|
t = smc.f(t[smc.perm])[smc.invperm]
|
||||||
|
@ -45,9 +45,15 @@ Base.:(==)(t::Transvection, s::Transvection) =
|
|||||||
t.id === s.id && t.ij == s.ij && t.inv == s.inv
|
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.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)
|
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
|
@inbounds begin
|
||||||
if t.id === :ϱ
|
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.:(==)(p::PermRightAut, q::PermRightAut) = p.perm == q.perm
|
||||||
Base.hash(p::PermRightAut, h::UInt) = hash(p.perm, hash(PermRightAut, h))
|
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}
|
evaluate!(v::NTuple{T,N}, p::PermRightAut, tmp=nothing) where {T,N} = v[p.perm]
|
||||||
return v[p.perm]
|
|
||||||
end
|
end
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
r = Groups.Transvection(:ϱ,i,j)
|
r = Groups.Transvection(:ϱ,i,j)
|
||||||
l = 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 r(deepcopy(D)) == (a*b, b, c, d)
|
||||||
@test inv(r)(deepcopy(D)) == (a*b^-1,b, c, d)
|
@test inv(r)(deepcopy(D)) == (a*b^-1,b, c, d)
|
||||||
|
Loading…
Reference in New Issue
Block a user