� ɍ�Xc @ s� d d l Te d � Z e d � Z d d l Td d l Td d l Td d l Te e d � Z d e f d � � YZ d e f d � � YZ d e f d � � YZ y0 d d l m Z m Z d e f d � � YZ Wn n Xd S( i����( t *i i c C s= t | t t t f � r. | t k r. | j � Sd } y | j � } | | k rS | SWn t k rm d } n X| t k r� | j � | | d | �Sd } | d k r� | j | � } | d k r� | j | � } q� n y | j � | | d | �SWnD | d k r9y | | � SWq5| j � | | d | �SXq9n Xd S( s� This function provides an adaption of the method __call__ of PermutationGroup_generic in order to make conversion_maps to groups whose class is inherited from PermutationGroup_generic callable by name. This function should be used for overloading the __call__ - method of such derived classes If you don't see this well formatted type sage: print _call_with_conversion_.__doc__ EXAMPLE: see the applications of this function for PermutationGroup_subgroup and IrreducibleComplexReflectionGroup: sage: print local_PermutationGroup_subgroup.__call__.__doc__ sage: print IrreducibleComplexReflectionGroup.__call__.__doc__ AUTHOR - Sebastian Oehms, Sept. 2016 t checkN( t isinstancet intt longt Integert _sage_const_1t identityt Nonet parentt AttributeErrort Falset _element_classt coerce_map_fromt convert_map_from( t PermGroupt xR t try_conv_mapt GroupFromt conv_map( ( s lib/local_permgroup.pyt _call_with_conversion_1 s0 $ t local_PermutationGroup_subgroupc B s/ e Z d Z e e d � Z d � Z d � Z RS( s� Since the Method __call__ of PermutationGroup_subgroup(PermutationGroup_generic) does not support coerce_maps between groups it is overloaded by this class to fill in the lack. Overloaded methods are: - __call__ If you don't see this well formatted type sage: print local_PermutationGroup_subgroup.__doc__ To see the docomentation of the original class type sage: print PermutationGroup_subgroup.__doc__ AUTHOR - Sebastian Oehms, Okt. 2016 c C s t | | d | d | �S( s� This method overloads the __call__-method of the original class since the method __call__ of PermutationGroup_subgroup(PermutationGroup_generic) does not support coerce_maps between groups Here is an improvement concerning this lack. If you don't see this well formatted type sage: print local_PermutationGroup_subgroup.__call__.__doc__ To see the docomentation of the original method type sage: print PermutationGroup_subgroup.__call__.__doc__ EXAMPLE: try to establish the natural projection from the general unitary group onto the projective unitary group. first try without using the local_PermutationGroup_subgroup class sage: GU4 = GU(4,2); GU4 General Unitary Group of degree 4 over Finite Field in a of size 2^2 sage: PGU4ambient = PGU(4,2); PGU4ambient The projective general unitary group of degree 4 over Finite Field of size 2 sage: PGU4 = PGU4ambient.subgroup(PGU4ambient.gens()); PGU4 Subgroup of (The projective general unitary group of degree 4 over Finite Field of size 2) generated by [(3,4,5) (7,8,9)(11,12,13)(15,16,17)(19,20,21)(26,34,30)(27,35,31)(28,36,32)(29,37,33)(38,70,54)(39,71,55)(40,72,56) (41,73,57)(42,82,62)(43,83,63)(44,84,64)(45,85,65)(46,74,66)(47,75,67)(48,76,68)(49,77,69)(50,78,58)(51,79,59) (52,80,60)(53,81,61), (1,6,22,26,43,3)(2,7,38)(4,8,54,30,60,48)(5,9,70,34,77,53)(10,39)(11,23,42) (12,71,82,68,63,49)(13,55,62,81,83,52)(14,56,78,51,20,41)(15,72,50)(16,24,58,64,33,44)(17,40,18,73,66,47) (19,57,46)(21,25,74,85,36,45)(28,75,37,29,59,32)(31,76,69)(35,61,80)(67,79)] sage: isinstance( PGU4, PermutationGroup_subgroup ) True sage: isinstance( PGU4, local_PermutationGroup_subgroup ) --------------------------------------------------------------------------- NameError Traceback (most recent call last) <ipython-input-10-0dce512ea45e> in <module>() ----> 1 isinstance( PGU4, local_PermutationGroup_subgroup ) NameError: name 'local_PermutationGroup_subgroup' is not defined sage: GU4_gap = GU4.gap() sage: PGU4_gap = gap(PGU4) sage: natProj_gap = GU4_gap.GroupHomomorphismByImagesNC( PGU4_gap, GU4_gap.GeneratorsOfGroup(), PGU4_gap.GeneratorsOfGroup()) sage: def natProj_map( elem ): res = natProj_gap.ImageElm( elem.gap() ) return res.sage() ....: sage: natProj_hom = Hom( GU4, PGU(natProj_map) sage: PGU4.register_conversion( natProj_hom ) sage: g1, g2 = GU4.gens() sage: g = g1**3*g2; g [1 0 1 0] [1 0 0 0] [0 1 0 1] [0 1 0 0] sage: PGU4(g) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-11-c93f0a431112> in <module>() ----> 1 PGU4(g) ....................................... TypeError: 'UnitaryMatrixGroup_gap_with_category.element_class' object is not iterable sage: natProj_hom(g) (1,6,22,26,43,3)(2,7,38)(4,8,54,30,60,48)(5,9,70,34,77,53)(10,39)(11,23,42)(12,71,82,68,63,49)(13,55,62,81,83,52) (14,56,78,51,20,41)(15,72,50)(16,24,58,64,33,44)(17,40,18,73,66,47)(19,57,46)(21,25,74,85,36,45) (28,75,37,29,59,32)(31,76,69)(35,61,80)(67,79) sage: now trying the same using the class local_PermutationGroup_subgroup sage: from lib.local_permgroup import * sage: GU4 = GU(4,2); GU4 General Unitary Group of degree 4 over Finite Field in a of size 2^2 sage: PGU4ambient = PGU(4,2); PGU4ambient The projective general unitary group of degree 4 over Finite Field of size 2 sage: PGU4 = PGU4ambient.subgroup(PGU4ambient.gens()); PGU4 Subgroup of (The projective general unitary group of degree 4 over Finite Field of size 2) generated by [(3,4,5) (7,8,9)(11,12,13)(15,16,17)(19,20,21)(26,34,30)(27,35,31)(28,36,32)(29,37,33)(38,70,54)(39,71,55)(40,72,56) (41,73,57)(42,82,62)(43,83,63)(44,84,64)(45,85,65)(46,74,66)(47,75,67)(48,76,68)(49,77,69)(50,78,58)(51,79,59) (52,80,60)(53,81,61), (1,6,22,26,43,3)(2,7,38)(4,8,54,30,60,48)(5,9,70,34,77,53)(10,39)(11,23,42) (12,71,82,68,63,49)(13,55,62,81,83,52)(14,56,78,51,20,41)(15,72,50)(16,24,58,64,33,44)(17,40,18,73,66,47) (19,57,46)(21,25,74,85,36,45)(28,75,37,29,59,32)(31,76,69)(35,61,80)(67,79)] sage: isinstance( PGU4, PermutationGroup_subgroup ) True sage: isinstance( PGU4, local_PermutationGroup_subgroup ) True sage: GU4_gap = GU4.gap() sage: PGU4_gap = gap(PGU4) sage: natProj_gap = GU4_gap.GroupHomomorphismByImagesNC( PGU4_gap, GU4_gap.GeneratorsOfGroup(), PGU4_gap.GeneratorsOfGroup()) sage: def natProj_map( elem ): res = natProj_gap.ImageElm( elem.gap() ) return res.sage() ....: sage: natProj_hom = Hom(GU4, PGU4)(natProj_map) sage: PGU4.register_conversion(natProj_hom) sage: g1, g2 = GU4.gens() sage: g = g1**3*g2; g [1 0 1 0] [1 0 0 0] [0 1 0 1] [0 1 0 0] sage: PGU4(g) (1,6,22,26,43,3)(2,7,38)(4,8,54,30,60,48)(5,9,70,34,77,53)(10,39)(11,23,42)(12,71,82,68,63,49)(13,55,62,81,83,52) (14,56,78,51,20,41)(15,72,50)(16,24,58,64,33,44)(17,40,18,73,66,47)(19,57,46)(21,25,74,85,36,45) (28,75,37,29,59,32)(31,76,69)(35,61,80)(67,79) sage: TESTS: sage: from lib.local_permgroup import * sage: sage.groups.perm_gps.permgroup.PermutationGroup_subgroup = local_PermutationGroup_subgroup sage: GU4 = GU(4,2) sage: PGU4ambient = PGU(4,2) sage: PGU4 = PGU4ambient.subgroup(PGU4ambient.gens()) sage: TestSuite(PGU4).run() AUTHOR: - Sebastian Oehms, Okt. 2016 R R ( R ( t selfR R R ( ( s lib/local_permgroup.pyt __call__� s {c C s5 y | | d t d t �} Wn t k r0 t SXt S( sT Returns boolean value of ``item in self``. This method from PermutationGroup_generic has been overwritten here to avoid recursion loops. This method uses the __call__ method which has been extended here. But to check if an element is in the group the original version of __call__ must be applied. If you don't see this well formatted type sage: print local_PermutationGroup_subgroup.__contains__.__doc__ To see the docomentation of the original method type sage: print PermutationGroup_subgroup.__contains__.__doc__ R R ( t TrueR t Exception( R t item( ( s lib/local_permgroup.pyt __contains__ s c C s t | � S( sK Making the gap conversion accessible via the .gap -method ( t gap( R ( ( s lib/local_permgroup.pyR s ( t __name__t __module__t __doc__R R R R ( ( ( s lib/local_permgroup.pyR n s ~ t PGUc B s e Z d Z e e j j j _ RS( sz Since the Method __call__ of PermutationGroup_subgroup(PermutationGroup_generic) does not support coerce_maps it is overwritten by this class to fill in the lack. This is done by overwriting the class name PermutationGroup_subgroup by local_PermutationGroup_subgroup which contains the extended version of the __call__ methos If you don't see this well formatted type sage: print PGU.__doc__ To see the docomentation of the original class type sage: print sage.groups.perm_gps.permgroup_named.PGU.__init__.__doc__ AUTHOR: - Sebastian Oehms, Okt. 2016 ( R R R R t saget groupst perm_gpst permgroupt PermutationGroup_subgroup( ( ( s lib/local_permgroup.pyR " s t PSpc B s e Z d Z e e j j j _ RS( sx Since the Method __call__ of PermutationGroup_subgroup(PermutationGroup_generic) does not support coerce_maps it is overwritten by this class to fill in the lack. This is done by overwriting the class name PermutationGroup_subgroup by local_PermutationGroup_subgroup which contains the extended version of the __call__ methos If you don't see this well formatted type sage: print PSp.__doc__ To see the docomentation of the original class type sage: print sage.groups.perm_gps.permgroup_named.PSp.__init__.__doc__ AUTHOR: - Sebastian Oehms, Okt. 2016 ( R R R R R! R"