mirror of
https://github.com/kalmarek/Groups.jl.git
synced 2024-11-19 06:30:29 +01:00
optimize evaluation with tmp storage
This commit is contained in:
parent
812b2e15a1
commit
e424bdc575
@ -110,10 +110,11 @@ evaluate(f::FPGroupElement{<:AutomorphismGroup{<:FreeGroup}}) = evaluate!(domain
|
||||
function evaluate!(
|
||||
t::NTuple{N,T},
|
||||
f::FPGroupElement{<:AutomorphismGroup{<:FreeGroup}},
|
||||
tmp = one(first(t)),
|
||||
) where {T<:FPGroupElement,N}
|
||||
A = alphabet(f)
|
||||
for idx in word(f)
|
||||
t = @inbounds evaluate!(t, A[idx], alphabet(object(parent(f))))::NTuple{N,T}
|
||||
t = @inbounds evaluate!(t, A[idx], alphabet(object(parent(f))), tmp)::NTuple{N,T}
|
||||
end
|
||||
return t
|
||||
end
|
||||
|
@ -49,7 +49,7 @@ 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::Tuple, t::Transvection, A::Alphabet)
|
||||
Base.@propagate_inbounds function evaluate!(v::Tuple, t::Transvection, A::Alphabet, tmp=one(first(v)))
|
||||
i, j = indices(t)
|
||||
@assert i ≤ length(v) && j ≤ length(v)
|
||||
|
||||
@ -80,6 +80,8 @@ Base.@propagate_inbounds function evaluate!(v::Tuple, t::Transvection, A::Alphab
|
||||
_setnormalform!(v[i], false)
|
||||
_setvalidhash!(v[i], false)
|
||||
end
|
||||
normalform!(tmp, v[i])
|
||||
copyto!(v[i], tmp)
|
||||
|
||||
return v
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user