mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-12-25 02:15:29 +01:00
faster permutation actions on GroupElements
This commit is contained in:
parent
7a8b21db3c
commit
4cef591dfa
@ -178,18 +178,45 @@ end
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
function (p::perm)(A::GroupRingElem)
|
||||
RG = parent(A)
|
||||
result = zero(RG, eltype(A.coeffs))
|
||||
function (g::perm)(y::GroupRingElem)
|
||||
RG = parent(y)
|
||||
result = zero(RG, eltype(y.coeffs))
|
||||
|
||||
for (idx, c) in enumerate(A.coeffs)
|
||||
if c!= zero(eltype(A.coeffs))
|
||||
result[p(RG.basis[idx])] = c
|
||||
for (idx, c) in enumerate(y.coeffs)
|
||||
if c!= zero(eltype(y.coeffs))
|
||||
result[g(RG.basis[idx])] = c
|
||||
end
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
function (g::perm)(y::GroupRingElem{T, <:SparseVector}) where T
|
||||
RG = parent(y)
|
||||
index = [RG.basis_dict[g(RG.basis[idx])] for idx in y.coeffs.nzind]
|
||||
|
||||
result = GroupRingElem(sparsevec(index, y.coeffs.nzval, y.coeffs.n), RG)
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
function (g::GroupRingElem)(y::GroupRingElem)
|
||||
res = parent(y)()
|
||||
for elt in GroupRings.supp(g)
|
||||
res += g[elt]*elt(y)
|
||||
end
|
||||
return res
|
||||
end
|
||||
|
||||
function (p::perm)(A::MatElem)
|
||||
length(p.d) == size(A, 1) == size(A,2) || throw("Can't act via $p on matrix of size $(size(A))")
|
||||
result = similar(A)
|
||||
@inbounds for i in 1:size(A, 1)
|
||||
for j in 1:size(A, 2)
|
||||
result[i, j] = A[p[i], p[j]] # action by permuting rows and colums/conjugation
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Action of WreathProductElems on Nemo.MatElem
|
||||
|
Loading…
Reference in New Issue
Block a user