From 8467b0d43280403f4ef154ec39481b64a73f5d0b Mon Sep 17 00:00:00 2001 From: kalmarek Date: Fri, 28 Jun 2019 09:15:01 +0200 Subject: [PATCH] slightly faster perm action on MatElem --- src/orbitdata.jl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/orbitdata.jl b/src/orbitdata.jl index 13fe2da..815b049 100644 --- a/src/orbitdata.jl +++ b/src/orbitdata.jl @@ -246,10 +246,17 @@ function (g::WreathProductElem{N})(A::MatElem) where N # @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) result = similar(A) + R = base_ring(parent(A)) + tmp = R(1) + @inbounds for i = 1:size(A,1) for j = 1:size(A,2) 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]) # this mul! needs to be separately defined, but is 2x faster end