| 637 | |
| 638 | def as_permutation_group(self, method =None): |
| 639 | r""" |
| 640 | EXAMPLES: |
| 641 | sage: F = GF(7); MS = MatrixSpace(F,2,2) |
| 642 | sage: gens = [MS([[0,1],[-1,0]]),MS([[1,1],[2,3]])] |
| 643 | sage: G = MatrixGroup(gens) |
| 644 | sage: G.as_permutation_group() |
| 645 | Permutation Group with generators [(1,2,4,8)(3,6,9,16)(5,10,15,25)(7,13,17,28)(11,19,26,37)(12,21,27,20)(14,24,29,18)(22,32,38,47)(23,34,39,33)(30,40,36,45)(31,42,46,41)(35,44,48,43), (1,3,7,14,4,9,17,29)(2,5,11,20,8,15,26,21)(6,12,22,33,16,27,38,34)(10,18,30,41,25,24,36,42)(13,23,35,40,28,39,48,45)(19,31,43,47,37,46,44,32)] |
| 646 | sage: G.as_permutation_group(method="smaller") |
| 647 | Permutation Group with generators [(1,2,4,8)(3,6,9,16)(5,10,15,25)(7,13,17,28)(11,19,26,37)(12,21,27,20)(14,24,29,18)(22,32,38,47)(23,34,39,33)(30,40,36,45)(31,42,46,41)(35,44,48,43), (1,3,7,14,4,9,17,29)(2,5,11,20,8,15,26,21)(6,12,22,33,16,27,38,34)(10,18,30,41,25,24,36,42)(13,23,35,40,28,39,48,45)(19,31,43,47,37,46,44,32)] |
| 648 | |
| 649 | Sometimes the "smaller" option will return an isomorphic group of lower degree. |
| 650 | """ |
| 651 | from sage.groups.perm_gps.permgroup import PermutationGroup |
| 652 | F = self.base_ring() |
| 653 | if not(F.is_finite()): |
| 654 | raise NotImplementedError, "Base ring must be finite." |
| 655 | q = F.order() |
| 656 | gens = self.gens() |
| 657 | n = self.degree() |
| 658 | MS = MatrixSpace(F,n,n) |
| 659 | mats = [] # initializing list of mats by which the gens act on self |
| 660 | W = self.matrix_space().row_space() |
| 661 | for g in gens: |
| 662 | p = MS(g.matrix()) |
| 663 | m = p.rows() |
| 664 | mats.append(m) |
| 665 | mats_str = str(gap([[list(r) for r in m] for m in mats])) |
| 666 | gap.eval("M:=GModuleByMats("+mats_str+", GF("+str(q)+"))") |
| 667 | gap.eval("iso:=IsomorphismPermGroup(Group("+mats_str+"))") |
| 668 | C = gap("Image( iso )") |
| 669 | if method == "smallest": |
| 670 | gap.eval("small:= SmallerDegreePermutationRepresentation( Image( iso ) );") |
| 671 | C = gap("Image( small )") |
| 672 | return PermutationGroup(C, from_group = True) |
| 673 | |
| 674 | def module_composition_factors(self, method=None): |
| 675 | r""" |
| 676 | Returns a list of triples consisting of [base field, dimension, irreducibility], |
| 677 | for each of the Meataxe composition factors modules. The method="verbose" option |
| 678 | returns more information, but in Meataxe notation. |
| 679 | |
| 680 | EXAMPLES: |
| 681 | sage: F = GF(7); MS = MatrixSpace(F,2,2) |
| 682 | sage: gens = [MS([[0,1],[-1,0]]),MS([[1,1],[2,3]])] |
| 683 | sage: G = MatrixGroup(gens) |
| 684 | sage: G.module_composition_factors() |
| 685 | [[Finite Field of size 7, 2, True]] |
| 686 | |
| 687 | Type "G.module_composition_factors(method='verbose')" to get |
| 688 | a more verbose version. |
| 689 | |
| 690 | For more on MeatAxe notation, see http://www.gap-system.org/Manuals/doc/htm/ref/CHAP067.htm |
| 691 | """ |
| 692 | from sage.misc.sage_eval import sage_eval |
| 693 | F = self.base_ring() |
| 694 | if not(F.is_finite()): |
| 695 | raise NotImplementedError, "Base ring must be finite." |
| 696 | q = F.order() |
| 697 | gens = self.gens() |
| 698 | n = self.degree() |
| 699 | MS = MatrixSpace(F,n,n) |
| 700 | mats = [] # initializing list of mats by which the gens act on self |
| 701 | W = self.matrix_space().row_space() |
| 702 | for g in gens: |
| 703 | p = MS(g.matrix()) |
| 704 | m = p.rows() |
| 705 | mats.append(m) |
| 706 | mats_str = str(gap([[list(r) for r in m] for m in mats])) |
| 707 | gap.eval("M:=GModuleByMats("+mats_str+", GF("+str(q)+"))") |
| 708 | gap.eval("MCFs := MTX.CompositionFactors( M )") |
| 709 | N = eval(gap.eval("Length(MCFs)")) |
| 710 | if method == "verbose": |
| 711 | print gap.eval('MCFs')+"\n" |
| 712 | L = [] |
| 713 | for i in range(1,N+1): |
| 714 | gap.eval("MCF := MCFs[%s]"%i) |
| 715 | L = L + [[sage_eval(gap.eval("MCF.field")), eval(gap.eval("MCF.dimension")), sage_eval(gap.eval("MCF.IsIrreducible"))]] |
| 716 | return L |