1
0
mirror of https://github.com/kalmarek/PropertyT.jl.git synced 2024-12-25 10:20:30 +01:00

slightly faster perm action on MatElem

This commit is contained in:
kalmarek 2019-06-28 09:15:01 +02:00
parent da54d140fd
commit 8467b0d432
No known key found for this signature in database
GPG Key ID: 8BF1A3855328FC15

View File

@ -246,10 +246,17 @@ function (g::WreathProductElem{N})(A::MatElem) where N
# @assert N == size(A,1) == size(A,2) # @assert N == size(A,1) == size(A,2)
flips = ntuple(i->(g.n[i].d[1]==1 && g.n[i].d[2]==2 ? 1 : -1), N) flips = ntuple(i->(g.n[i].d[1]==1 && g.n[i].d[2]==2 ? 1 : -1), N)
result = similar(A) result = similar(A)
R = base_ring(parent(A))
tmp = R(1)
@inbounds for i = 1:size(A,1) @inbounds for i = 1:size(A,1)
for j = 1:size(A,2) for j = 1:size(A,2)
x = A[g.p[i], g.p[j]] x = A[g.p[i], g.p[j]]
result[i, j] = x*(flips[i]*flips[j]) if flips[i]*flips[j] == 1
result[i, j] = x
else
result[i, j] = -x
end
# result[i, j] = AbstractAlgebra.mul!(x, x, flips[i]*flips[j]) # result[i, j] = AbstractAlgebra.mul!(x, x, flips[i]*flips[j])
# this mul! needs to be separately defined, but is 2x faster # this mul! needs to be separately defined, but is 2x faster
end end