mirror of
https://github.com/kalmarek/Groups.jl.git
synced 2024-11-19 14:35:28 +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!(
|
function evaluate!(
|
||||||
t::NTuple{N,T},
|
t::NTuple{N,T},
|
||||||
f::FPGroupElement{<:AutomorphismGroup{<:FreeGroup}},
|
f::FPGroupElement{<:AutomorphismGroup{<:FreeGroup}},
|
||||||
|
tmp = one(first(t)),
|
||||||
) where {T<:FPGroupElement,N}
|
) where {T<:FPGroupElement,N}
|
||||||
A = alphabet(f)
|
A = alphabet(f)
|
||||||
for idx in word(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
|
end
|
||||||
return t
|
return t
|
||||||
end
|
end
|
||||||
|
@ -49,7 +49,7 @@ 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::Tuple, t::Transvection, A::Alphabet)
|
Base.@propagate_inbounds function evaluate!(v::Tuple, t::Transvection, A::Alphabet, tmp=one(first(v)))
|
||||||
i, j = indices(t)
|
i, j = indices(t)
|
||||||
@assert i ≤ length(v) && j ≤ length(v)
|
@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)
|
_setnormalform!(v[i], false)
|
||||||
_setvalidhash!(v[i], false)
|
_setvalidhash!(v[i], false)
|
||||||
end
|
end
|
||||||
|
normalform!(tmp, v[i])
|
||||||
|
copyto!(v[i], tmp)
|
||||||
|
|
||||||
return v
|
return v
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user