mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-12-25 18:25:30 +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)
|
function (g::perm)(y::GroupRingElem)
|
||||||
RG = parent(A)
|
RG = parent(y)
|
||||||
result = zero(RG, eltype(A.coeffs))
|
result = zero(RG, eltype(y.coeffs))
|
||||||
|
|
||||||
for (idx, c) in enumerate(A.coeffs)
|
for (idx, c) in enumerate(y.coeffs)
|
||||||
if c!= zero(eltype(A.coeffs))
|
if c!= zero(eltype(y.coeffs))
|
||||||
result[p(RG.basis[idx])] = c
|
result[g(RG.basis[idx])] = c
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return result
|
return result
|
||||||
end
|
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
|
# Action of WreathProductElems on Nemo.MatElem
|
||||||
|
Loading…
Reference in New Issue
Block a user