(* ::Package:: *)
(************************************************************************)
(* This file was generated automatically by the Mathematica front end. *)
(* It contains Initialization cells from a Notebook file, which *)
(* typically will have the same name as this file except ending in *)
(* ".nb" instead of ".m". *)
(* *)
(* This file is intended to be loaded into the Mathematica kernel using *)
(* the package loading commands Get or Needs. Doing so is equivalent *)
(* to using the Evaluate Initialization Cells menu command in the front *)
(* end. *)
(* *)
(* DO NOT EDIT THIS FILE. This entire file is regenerated *)
(* automatically each time the parent Notebook file is saved in the *)
(* Mathematica front end. Any changes you make to this file will be *)
(* overwritten. *)
(************************************************************************)
BeginPackage["Permutations`"]
Permutation::usage = "Permutation[i1,i2,...] represents a permutation mapping 1->i1, 2->i2, ...";
Begin["`Private`"]
Permutation /: PermutationProduct[a_Permutation, b_Permutation, rest___Permutation] := PermutationProduct[b[[List@@a]], rest];
Permutation /: InversePermutation[a_Permutation] := (t=a; Do[t[[a[[i]]]]=i, {i,Length@a}]; t)
Permutation /: PermutationSupport[a_Permutation] := List@@Select[a, #!=a[[#]]&]
Permutation /: PermutationReplace[expr_,a_Permutation] := expr /. Table[i->a[[i]], {i,a}]
End[]; EndPackage[]