diff --git a/groups/speciallinear.jl b/groups/speciallinear.jl index 5a444c1..4062ae8 100644 --- a/groups/speciallinear.jl +++ b/groups/speciallinear.jl @@ -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)