add perm action from the right (by inverse) on MatElems

This commit is contained in:
kalmarek 2018-08-15 17:19:37 +02:00
parent 7257c02820
commit 45d8d85189
1 changed files with 18 additions and 0 deletions

View File

@ -87,6 +87,24 @@ function (g::WreathProductElem)(A::MatElem)
return Nemo.mul!(res, M(G), res)
end
import Base.*
doc"""
*(x::AbstractAlgebra.MatElem, P::Generic.perm)
> Apply the pemutation $P$ to the rows of the matrix $x$ and return the result.
"""
function *(x::AbstractAlgebra.MatElem, P::Generic.perm)
z = similar(x)
m = rows(x)
n = cols(x)
for i = 1:m
for j = 1:n
z[i, j] = x[i, P[j]]
end
end
return z
end
function (p::perm)(A::MatElem)
length(p.d) == A.r == A.c || throw("Can't act via $p on matrix of size ($(A.r), $(A.c))")
return p*A*inv(p)