From 45d8d851891d8850d2c684e2361dbb5a2efff9bb Mon Sep 17 00:00:00 2001 From: kalmarek Date: Wed, 15 Aug 2018 17:19:37 +0200 Subject: [PATCH] add perm action from the right (by inverse) on MatElems --- groups/speciallinear.jl | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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)