�
ɍ�Xc@s�ddlTed�Zed�Zed�Zed�Zed�Zed�Zed�Zed	�Z	ed
�Z
ed�Zed�Zed
�Z
ed�Zed�Zed�Zed�Zed�Zed�ZddlmZmZddlmZmZddlTddlTddlTddlTddlTddlTdefd��YZ defd��YZ!e"dde#d�Z$e"de#d�Z%e"de#d �Z&d!S("i����(t*iiiiiiiiidii iii�i�_iii0(tFinitelyPresentedGrouptFinitelyPresentedGroupElement(toptionstrename_keywordtCubicBraidElementcBsPeZdZd�Zd�Zdddedd�Zdddedd�ZRS(sS
    This class models elements of cubic factor groups of the braid group. It is the element class of 
    the CubicBraidGroup_class

    If you don't see this well formatted type 

    sage: print CubicBraidElement.__doc__

    It is realized as a particular case of elements of a finitely presented group (inherited from 
    FinitelyPresentedGroupElement)

    EXAMPLES:

        sage: C4.<c1,c2,c3> = CubicBraidGroup(4)
        sage: C4
        Cubic Braid group on 4 strands
        sage: ele1 = c1*c2*c3^-1*c2^-1; type(ele1)
        <class 'lib.cubic_braid.CubicBraidGroup_class_with_category.element_class'>
        sage: ele2 = C4((1, 2, -3, -2))
        sage: ele1 == ele2
        True

    For more information see the parent class typing

    sage:  print CubicBraidGroup_class.__doc__

    AUTHOR

      - Sebastian Oehms, Sept. 2016

    cCs"|j�j�}||�}|S(sz
        Return the canonical braid preimage of self as Object of the class Braid,

        If you don't see this well formatted type 

        sage: print CubicBraidElement.braid.__doc__

        OUTPUT:

            the preimage of self as instance of the Braid class which is the element class of the BraidGroup_class

        EXAMPLES::

            sage: C3.<c1, c2> = CubicBraidGroup(3)
            sage: c1.parent()
            Cubic Braid group on 3 strands 
            sage: c1.braid().parent()
            Braid group on 3 strands

        For information type

        sage:  print CubicBraidGroup_class.__doc__


        (tparenttpre_image_braid_group(tselftpre_image_braid_grptpre_image_braid((scubic_braid.pytbraidvscCs|j�j�}|tS(s
        Return the exponent_sum of the preimage braid modulo 3

        If you don't see this well formatted type 

        sage: print CubicBraidElement.cubic_writhe.__doc__

        OUTPUT:

            Integer 0, 1, 2 giving the exponent_sum modulo 3 in a word in the braid generators representig self

        EXAMPLES::

            sage: S4.<s1,s2,s3>=AssionGroupS(4)
            sage: s=s1*s2*s3*s2
            sage: s.cubic_writhe()
            1
            sage: 

        AUTHOR:

          - Sebastian Oehms, Sept. 2016

        (Rtexponent_sumt
_sage_const_3(Rtexp_sum((scubic_braid.pytcubic_writhe�stdefaultcs}|j�}|jddd|d|���j�}�dkr�t�t�r��dkr�|dkr{�jt��q��jt��q�q�n�dkrPt	d�}|dkr�|t
|tt}	n|t|t}	�dkrR|dkrt
}nyt|�}Wntd��nX|t
krQ|j�rQtd��n|t
kr�|dkrxtt�}
q�tt�}
nt|�}
|
||	�}	|	j�}t|�t
kr�|	jd	d���jd�\}�||	�}	n|
�|	j�}[email protected]|D]:}
|
t
t
kr-qn|
t
�|
ttkrPqqWq;|dkrm�j�}n!|�j�kr�td��n�||	�}	|	j�}t|�t
kr�d
G|	GH|	jd	d���jd�\}�||	�}	n|	j�}x0|D]:}
|
t
t
kr+qn|
t
�|
ttkrPqqWn��dkrk�j��n|dkr��j�}n!|�j�kr�td��nt�kr�td��n|dkr��t
�tt�}|t
kr;td��q;n3��t�t�}|t
kr;td��n��fd��t|t
|t��fd��}|�fS(s�
        Return the Burau matrix of the cubic braid coset. 

        If you don't see this well formatted type 

        sage: print CubicBraidElement._burau_matrix_.__doc_

        This is the internal version of the "burau_matrix" method which returns more information than the main method

        for more information on the main method "burau_matrix" type

        sage: print CubicBraidElement.burau_matrix.__doc_

        The only difference to that method is this:

        OUTPUT:

            a pair consisting of

            - The Burau matrix of the cubic braid coset with entries in the domain given by the options
 
            - the value of rootBur which is used. If the keyword rootBur has been set, this value is identical to this. 
              Otherwise, the value which has been calculated from the other parameters is returned

        EXAMPLES:

         sage: S3.<s1,s2>=AssionGroupS(3)
         sage: s2.burau_matrix( characteristic=2, version='unitary' )
         [     1      0]
         [rI + 1     rI]
         sage: s2._burau_matrix_( characteristic=2, version='unitary' )
         (
         [     1      0]        
         [rI + 1     rI], rI + 1
         )
         sage: 

        AUTHOR:

          - Sebastian Oehms, Sept. 2016

        tvarttttreducedtversiontunitaryttTs!characteristic must be in integerscharacteristic must be a primetnamestrIis<characteristic of Domain does not match given characteristics.Warning: Domain extended to splitting field ofs,rootBur must belong to a domain containing 1s"rootBur must vanish on x**4-x**2+1srootBur must vanish on x**2-x+1cs`|j�}�d}|jd�\}||t�}�|t}|jd��|}|S(NRi(tpolynomial_constructiont_first_ngenst
_sage_const_0t
_sage_const_1t
substitute(tLaurPoltPolConsttRRtp1tp2terg(tDomaintrootBur(scubic_braid.pytconv2Domain=s
cs��||f�S(N((titj(tBurauOriR&(scubic_braid.pyt<lambda>EsN(R(R(Rtburau_matrixt
dimensionstNonet
isinstancetUniversalCyclotomicFieldtgent_sage_const_12t
_sage_const_6Rt
_sage_const_4t
_sage_const_2RRtIntegert
ValueErrortis_primetCyclotomicFieldR
tGFtrootstlentsplitting_fieldRtcharacteristicRtmatrix(RR%R$R=RRR
tdRt
minPolRootBurtPDomaintrootListRtrootttestRootBurtBurauMat((R)R$R&R%scubic_braid.pyt_burau_matrix_�s�,	

	

&cCs2|jd|d|d|d|d|�t}|S(s&
        Return the Burau matrix of the cubic braid coset. 

        If you don't see this well formatted type 

        sage: print CubicBraidElement.burau_matrix.__doc_

        This method uses the same method belonging to the Braid class, but reduces the parameter to a primitive six 
        root of unity, respectivly an element vanishing on the polynomial $x^2-x+1$

        INPUT: (all parameters are optional by keyword )

        - "rootBur": six root of unity in some field (default six root of unity over $\QQ$)
        - "Domain":  base_ring for the burau matrix (default is Cyclotomic Field of order 3 and degree 2, resp. the 
                     domain of rootBur if given)
        - "reduced": boolean (default: False); whether to return the reduced or unreduced Burau representation 
                     (see Braid class )
        - "characteristic": integer giving the characteristic of the domain (default is 0 or the characteristic of 
                     the doamain if given) 
        - "version":  values: 
                      'unitary': gives the unitary form according to Squier (see Braid._unitary_burau_matrix_() )
                      'default': the method behaves like the original one of the Braid -class
                      any value else: gives the reduced form given on wikipedia
     

        OUTPUT:

            The Burau matrix of the cubic braid coset with entries in the domain given by the options
         
            If you need the values of the reconstructed keywords "rootBur", "Domain" or "characteristic" use the internal 
            version _burau_matrix_ of this method

        RAISE:

           - ValueError: 'characteristic must be in integer'

           - ValueError: 'characteristic must be a prime'

           - ValueError: 'characteristic of Domain does not match given characteristic'

           - ValueError: 'rootBur must belong to a domain containing 1'

           - ValueError: 'rootBur must vanish on $x^2-x+1$ default case        

           - ValueError: 'rootBur must vanish on $x^4-x^2+1$ in case of call with version = 'unitary'
        


        EXAMPLES::

            sage: C3.<c1, c2> = CubicBraidGroup(3)
            sage: ele1 = c1*c2*c1
            sage: BurauTest = ele1.burau_matrix(); print BurauTest
            [   -zeta3         1     zeta3]
            [   -zeta3 zeta3 + 1         0]
            [        1         0         0]
            sage: BurauTest.base_ring()
            Cyclotomic Field of order 3 and degree 2
            sage:
            sage: BurauTest = ele1.burau_matrix( characteristic = 0 ); print BurauTest
            [   -zeta3         1     zeta3]
            [   -zeta3 zeta3 + 1         0]
            [        1         0         0]
            sage: BurauTest.base_ring()
            Cyclotomic Field of order 3 and degree 2
            sage:
            sage: BurauTest = ele1.burau_matrix( Domain = QQ ); print BurauTest
            Warning: Domain extended to splitting field of tT^2 - tT + 1
            [-rI + 1       1  rI - 1]
            [-rI + 1      rI       0]
            [      1       0       0]
            sage: BurauTest.base_ring()
            Number Field in rI with defining polynomial tT^2 - tT + 1
            sage:
            sage: BurauTest = ele1.burau_matrix( Domain = QQ[I, sqrt(3)] ); print BurauTest
            [ 1/2*sqrt3*I + 1/2                  1 -1/2*sqrt3*I - 1/2]
            [ 1/2*sqrt3*I + 1/2 -1/2*sqrt3*I + 1/2                  0]
            [                 1                  0                  0]
            sage: BurauTest.base_ring()
            Number Field in I with defining polynomial x^2 + 1 over its base field
            sage:
            sage: BurauTest = ele1.burau_matrix( characteristic = 7 ); print BurauTest
            [3 1 4]
            [3 5 0]
            [1 0 0]
            sage: BurauTest.base_ring()
            Finite Field of size 7
            sage:
            sage: BurauTest = ele1.burau_matrix( characteristic = 2 ); print BurauTest
            [rI + 1      1 rI + 1]
            [rI + 1     rI      0]
            [     1      0      0]
            sage: BurauTest.base_ring()
            Finite Field in rI of size 2^2
            sage:
            sage: 
            sage: F4.<r64> = GF(4)
            sage: BurauTest = ele1.burau_matrix( rootBur=r64 ); print BurauTest
            [r64 + 1       1 r64 + 1]
            [r64 + 1     r64       0]
            [      1       0       0]
            sage: BurauTest.base_ring()
            Finite Field in r64 of size 2^2
            sage: 
            sage: BurauTest = ele1.burau_matrix( Domain = GF(5) ); print BurauTest
            Warning: Domain extended to splitting field of tT^2 + 4*tT + 1
            [2*rI + 2        1 3*rI + 3]
            [2*rI + 2 3*rI + 4        0]
            [       1        0        0]
            sage: BurauTest.base_ring()
            Finite Field in rI of size 5^2
            sage:
            sage: BurauTest = ele1.burau_matrix( version = 'unitary' ); print BurauTest
            [        0 -zeta12^3]
            [-zeta12^3         0]
            sage: BurauTest.base_ring()
            Cyclotomic Field of order 12 and degree 4
            sage: 
            sage: BurauTest = ele1.burau_matrix( Domain = QQ[I, sqrt(3)], version = 'unitary' ); print BurauTest
            [ 0 -I]
            [-I  0]
            sage: BurauTest.base_ring()
            Number Field in I with defining polynomial x^2 + 1 over its base field

        AUTHOR:

          - Sebastian Oehms, Sept. 2016


        REFERENCES:

           - :wikipedia: "Burau_representation"


        for more inormation type
        sage: print Braid.burau_matrix.__doc__
        sage: print local_Braid.burau_matrix.__doc__
        sage: print local_Braid.__burau_matrix_wikipedia__.__doc__
        sage: print local_Braid.__burau_matrix_unitary__.__doc__

        R%R$R=RR(RFR(RR%R$R=RRtres((scubic_braid.pyR+Os�!
N(	t__name__t
__module__t__doc__RRR-tFalseRFR+(((scubic_braid.pyRSs
	!	 �tCubicBraidGroup_classcBs�eZdZeZded�Zd�Zd�Zd�Z	d�Z
d�Zd�Ze
eed	�Zd
�Ze
e
e
edeed�Zed
�Zed�Zed�Zed�Zed�Ze
d�Zd�ZRS(s�#
    Class to handel cubic factors of braid group on n strands

    If you don't see this well formatted type 

    sage: print CubicBraidGroup_class.__doc__

    This class implements quotient groups of the braid group mapping their generators to elements of order 3 
    (see the module header for more informations on these groups)

    These groups are implemented as a particular case of finitely presented groups similar to the BraidGroup class 

    A cubic braid group can be created by giving the number of strands, and the name of the generators in a similar 
    way as it works for the BraidGroup class. 
 
    INPUT (to the constructor):
    
    - "names": (see the BraidGroup_class docomentation)

    - "AdditionalRelation": (keyword, explantaion see below)

    - "verbose": (keyword, explantaion see below)


    RAISE (on init):

      - ValueError: "the number of strands must be an integer larger than one"


    Setting the keyword 'AdditionalRelation' to one on the values 'S' or 'U' the additional relations due to 
    Assion are added:

     'S': $s_3 s_1 t_2 s_1 t_2^{-1} t_3 t_2 s_1 t_2^{-1} t_3^{-1) = 1$ for $m >= 5$  
     'U': $t_1 t_3 = 1$                                                for $m >= 5$  


    where $t_i = (s_i s_{i+1})^3$. If AdditionalRelation='C' (default) only the cubic relation on the generators is 
    active (Coxeters case of investigation). Note that for n=2,3,4 the groups do not differ between the three possible
    values of AdditionalRelation (as finitely presented groups). But anyway, the classes for 'C', 'S' and 'U' are 
    different, since they have different classical realizations implemented .

    Setting the keyword verbose it is possible to print time stamp messages in order to do a performance or 
    call stack debugging. This keyword uses the timeStampControl class. For more information on this type

                     print setupTimeStamp.__doc__
                     print timeStampControl.__doc__
                     print timeStampControl.print_timestamp.__doc__
                     print print_time_tb.__doc__
    

    The creation of instances of this class can also be done more easy by help of the functions CubicBraidGroup, 
    AssionGroupS and AssionGroupU (similar to the function BraidGroup with respect to the BraidGroup_class)


    EXAMPLES:

        sage: from cubic_braid import *
        sage: U3 = CubicBraidGroup(3, AdditionalRelation = 'U'); U3
        Assion group on 3 strands of type U
        sage: U3.gens()
        (c0, c1)

     alternate possibilities defining U3:

        sage: U3 = AssionGroupU(3); U3
        Assion group on 3 strands of type U
        sage: U3.gens()
        (u0, u1)

        sage: U3.<u1,u2> = AssionGroupU(3); U3
        Assion group on 3 strands of type U
        sage: U3.gens()
        (u1, u2)

    alternates naming the generators:

        sage: U3 = AssionGroupU(3, 'a, b'); U3
        Assion group on 3 strands of type U
        sage: U3.gens()
        (a, b)

        sage: C3 = CubicBraidGroup(3, 't'); C3
        Cubic Braid group on 3 strands
        sage: C3.gens()
        (t0, t1)

        sage: U3.is_isomorphic( C3 )
        True
        sage: U3.as_classical_group()
        Subgroup of (The projective general unitary group of degree 3 over Finite Field of size 2) generated by
        [(1,7,6) (3,19,14)(4,15,10)(5,11,18)(12,16,20), (1,12,13)(2,15,19)(4,9,14)(5,18,8)(6,21,16)]
        sage: C3.as_classical_group()
        Subgroup of General Unitary Group of degree 2 over Universal Cyclotomic Field with respect to hermitian form 
        [-E(12)^7 + E(12)^11                  -1]
        [                 -1 -E(12)^7 + E(12)^11] 
        generated by (
        [    E(3) E(12)^11]
        [       0        1], 
        [       1        0]
        [E(12)^11     E(3)])


    using verbose mode:

        sage: C3.<c1,c2> = CubicBraidGroup(3, verbose=True); C3
        L: StackInfo    Elapse:     0, Total:   0 Ident: C3 In: __init__ Line: 403
        L: StackInfo    Elapse:   197, Total:   0 Begin In: __create_classical_realization__ Line: 910
        L: StackInfo    Elapse:     8, Total:   0 Begin In: as_matrix_group Line: 1031
        L: Body         Elapse:    92, Total:   0 genList prepared In: as_matrix_group Line: 1038
        L: Body         Elapse:    52, Total:   0 MatGroup defined In: as_matrix_group Line: 1054
        L: StackInfo    Elapse:   356, Total:   0 Begin In: gap_hom Line: 143
        L: Debug        Elapse:     8, Total:   0 GroupHomomorphis In: gap_hom Line: 188
        L: Debug        Elapse:    17, Total:   0 checked if groupMap works In: gap_hom Line: 199
        L: StackInfo    Elapse:     8, Total:   0 End In: gap_hom Line: 226
        L: StackInfo    Elapse:    44, Total:   0 Begin In: __check_homomorphism__ Line: 60
        L: StackInfo    Elapse:    52, Total:   0 End In: __check_homomorphism__ Line: 625
        L: Body         Elapse:     3, Total:   0 Hom from self defined In: as_matrix_group Line: 1064
        L: StackInfo    Elapse:    62, Total:   0 Begin In: gap_hom Line: 143
        L: Debug        Elapse:     4, Total:   0 GroupHomomorphis In: gap_hom Line: 188
        L: Debug        Elapse:    20, Total:   0 checked if groupMap works In: gap_hom Line: 199
        L: StackInfo    Elapse:     4, Total:   0 End In: gap_hom Line: 226
        L: Body         Elapse:    35, Total:   0 Section to self defined In: as_matrix_group Line: 1077
        L: StackInfo    Elapse:     3, Total:   0 Ende In: as_matrix_group Line: 1102
        L: StackInfo    Elapse:     3, Total:   0 End In: __create_classical_realization__ Line: 975
        L: StackInfo    Elapse:    12, Total:   0 Ident: C3 In: __init__ Line: 472
        Cubic Braid group on 3 strands
        sage: 
        sage: 
        sage: C3.<c1,c2> = CubicBraidGroup(3, verbose=30); C3
        L: StackInfo    Elapse:    62, Total:   0 (truncated   1) Begin In: __create_classical_realization__ Line: 910
            ---> __init__ In: lib/cubic_braid.py Line: 471
            ---> __classcall__ In: /opt/sage/sage-6.9-i686-Linux/local/lib/python2.7/site-packages/sage/structure
        /unique_representation.py Line: 1021
            ---> CubicBraidGroup In: lib/cubic_braid.py Line: 1231
        L: StackInfo    Elapse:   405, Total:   0 Begin In: as_matrix_group Line: 1031
            ---> __create_classical_realization__ In: lib/cubic_braid.py Line: 968
            ---> __init__ In: lib/cubic_braid.py Line: 471
            ---> __classcall__ In: /opt/sage/sage-6.9-i686-Linux/local/lib/python2.7/site-packages/sage/structure
        /unique_representation.py Line: 1021
        L: Body         Elapse:   145, Total:   0 genList prepared In: as_matrix_group Line: 1038
            ---> __create_classical_realization__ In: lib/cubic_braid.py Line: 968
            ---> __init__ In: lib/cubic_braid.py Line: 471
            ---> __classcall__ In: /opt/sage/sage-6.9-i686-Linux/local/lib/python2.7/site-packages/sage/structure
        /unique_representation.py Line: 1021
        Cubic Braid group on 3 strands
        sage: 
    

    TESTS:

        sage: C4 = CubicBraidGroup(4)
        sage: TestSuite(C4).run()
        sage: C5 = CubicBraidGroup(5)
        sage: TestSuite(C5).run()
        sage: C6 = CubicBraidGroup(6)
        sage: TestSuite(C6).run()
        sage: S3 = AssionGroupS(3)
        sage: TestSuite(S3).run()
        sage: S4 = AssionGroupS(4)
        sage: TestSuite(S5).run()
        sage: U3 = AssionGroupU(3)
        sage: TestSuite(U3).run()
        sage: U4 = AssionGroupU(4)
        sage: TestSuite(U4).run()
        sage: U5 = AssionGroupU(5)
        sage: TestSuite(U5).run()

    METHODS (implemented / overwriten here):

        - as_classical_group(): type 
                   sage: print CubicBraidGroup_class.as_classical_group.__doc__
        - as_matrix_group(): type 
                   sage: print CubicBraidGroup_class.as_matrix_group.__doc__
        - as_refection_group(): type 
                   sage: print CubicBraidGroup_class.as_refection_group.__doc__
        - as_permutation_group(): type 
                   sage: print CubicBraidGroup_class.as_permutation_group.__doc__
        - pre_image_braid_group: type
                   sage: print CubicBraidGroup_class.pre_image_braid_group.__doc__
        - cubic_braid_subgroup(): type 
                   sage: print CubicBraidGroup_class.cubic_braid_subgroup.__doc__
        - centralizing_element(): type 
                   sage: print CubicBraidGroup_class.centralizing_element.__doc__
        - order(): type 
                   sage: print CubicBraidGroup_class.order.__doc__
        - character_table(): type 
                   sage: print CubicBraidGroup_class.character_table.__doc__

    AUTHOR

      - Sebastian Oehms, Sept. 2016

    REFERENCES:

    - Coxeter, H.S.M: "Factor groups of the braid groups, Proceedings of the Fourth Candian Mathematical Congress
      (Vancover      1957), pp. 95-122".
    
    - J. Assion: "Einige endliche Faktorgruppen der Zopfgruppen" (Math. Z., 163 (1978), 291-302) 
    tCcCs||_||_tt|��}|t|_|j|jj�|_td|dt	dt
�|_td|dtdt
�|_|j
d|jtj�g}g}g}g}ttjj_t|�|_|tkr�td��nt|�}	ttt	}
itd6td6td6td	6}|j|j�krZt||j|
�nx�t t|t�D]�}|j!|	|g��|j!|	|g��||krn|	||tg�t"}
|j!|
�|	||tg�t"}
|j!|
�qnqnWt#|jj$��}x,t t%|�D]}|j!||t"�q)W|t"kr)x�t t%|t"�D]�}|d
kr�|j!||||t	t"�qh|dkrh|j!||t	||||t||||t||t	||t||||t||t	�qhqhWnt&j'||	t(|��|t|_|j|jj�|_||_)||_*||_+||_,|	|_-g|_.d|_0d|_1d|_2d|_3d|_4d|_5d|_6|j7�|j
d|jtj�dS(
s�
        Python constructor.

        for more information type

        sage: print CubicBraidGroup_class.__doc__ 
    

        AUTHOR

          - Sebastian Oehms, Sept. 2016

        tverbosetOffsettShowDateTimes	Ident: %ss8the number of strands must be an integer larger than onetC5tC6tU6tS6tUtSN(8t_AdditionalRelation_t	_verbose_R5R;Rt
_nstrands_tstrt_ident_tsetupTimeStampR4RKt_TimeStamp_t_TimeStampSub_t__print_timestamp__tTsLevelt	StackInfotlocal_BraidGroup_classtsagetgroupsRtBraidGroup_classt
BraidGroupt_pre_image_braid_group_R6t	FreeGroupt_sage_const_100t_sage_const_1024t
_sage_const_5t_sage_const_48t_sage_const_24tkeystgap_extend_workspacetrangetappendR
tlistt	relationsRRt__init__ttuplet_b_t_bi_t_t_t_ti_t_free_group_t_checked_homomorphism_R-t_classical_group_t_classical_group_gens_t_classical_base_group_t_classical_base_group_gens_t_centralizing_matrix_t_centralizing_element_t_classical_embedding_t __create_classical_realization__(RRtAdditionalRelationRNtntbtbittttit
free_grouptoneHundertMBtwork_space_neededR'Rtrels((scubic_braid.pyRt�sr		
"
$
													
cCst|j�|j|jffS(s�
        Checks or unity

        If you don't see this well formatted type 

        sage: print CubicBraidGroup_class.__recuce__.__doc__

        TESTS:

            sage: C3=CubicBraidGroup(3)
            sage: C3.__reduce__()
            (<class 'lib.cubic_braid.CubicBraidGroup_class'>, (('c0', 'c1'), 'C', False))
            sage: U3.<u1,u2>=AssionGroupU(3, verbose=100)
            sage: U3.__reduce__()
            (<class 'lib.cubic_braid.CubicBraidGroup_class'>, (('u1', 'u2'), 'U', 100))

        (RLtvariable_namesRWRX(R((scubic_braid.pyt
__reduce__!scCs2|jdkrd|jSd|j|jfSdS(s\
        Return a string representation

        If you don't see this well formatted type 

        sage: print CubicBraidGroup_class._repr_.__doc__

        OUTPUT:

        String decribing self

        TESTS:

            sage: C5 = CubicBraidGroup(5)
            sage: C5 # indirect doctest
            CubicBraid group on 5 strands 
        RMsCubic Braid group on %s strandss%Assion group on %s strands of type %sN(RWRY(R((scubic_braid.pyt_repr_7scs.�jdtj��j�}|j��}�j��}|j|dk��j��}�jdtj�|j�j	|�t
k��jdtj��j|�}�j��}|j|dk��jdtj�|j�t}�|�}	||	�}
�j��}|j|
|k��jdtj��j
�}�j
dt�}
�j��}|j||
k�tt�}|t�}ttdd�}|jd	�\}�jd
tj���fd�}�jdtj�y�j�}Wn
d}nX|dkr5||||	�n�jd
tj��j�}||||	��jdtj��jtkr��jdt
�}||||	�n�jdtj��j�}||||	��jdtj��jdks�jtkr0�jd|�}||||	�n�jdtj��jdksa�jtkr��jd|�}||||	�n�jdtj��jtks��jdkr�jdt�}||||	��jdtj��jdtt��}||||	�n�jdtj�dS(s�
        Method called by TestSuite

        If you don't see this well formatted type 

        sage: print CubicBraidGroup_class._test_constructions.__doc__

        the following is checked:
           - construction of classical group was faithfull
           - construction of permutation groups attached to self is faithful
           - coercion maps to and from classical group exist and are inverse to each other
           - coercion maps to and from permutatiobn group exist and are inverse to each other
           - existence of some examples of matrix representations and commutativity between coercion maps

        AUTHOR

          - Sebastian Oehms, Sept. 2016

        tBeginsCheck hom to classicalsSection from classicalsTesting inverses
Testing ordert
by_formulaRtr64is$Testing permutation and matrix groupcs��jdtj�||�}�jdtj�||�}�jdtj��j��}|j||k��jdtj�dS(s5
            local function in CubicBraidGroup_class._test_constructions.__doc__

            it tests conversion maps from self and the classical group to the given attached Group which must have 
            been defined using the as_matrix_group or as_ermutation_group methods

            INPUT:

             - "AttGroup": attached group (matrix group or permutation group) to be tested
             - "EleSelf":  element of self used to perform the test
             - "EleClass":  element of the classical group of self used to perform the test

            R�t
rightHandSidetleftHandSidetEndN(R_R`RatBodySub1t_testertassert_(tAttGrouptEleClasstEleSelft
AttEleSelftAttEleClasst	AttComute(RR(scubic_braid.pyttest_attached_group�ssreflection groupspermutation groupsnative permutation grouptnativesDefault MatrixGroupsMatrixGroup over GF(3)RUR%sMatrixGroup over GF(4)RVsMatrixGroup over GF(5)RMR=sMatrixGroup over GF(7)R$R�N(R�(R_R`Ratas_classical_grouptcoerce_map_fromR�R�R-tBodyt__check_homomorphism__tTruetgensRtorderRKR9R
R4R3RR�tas_reflection_grouptas_permutation_groupRYtas_matrix_groupRWRkt
_sage_const_7(RRtClt
homToClassthomToClassNotNonethomToClassCheckt
sectFromClasstsectFromClassNotNonetClgen1tClgen1Braidt
Clgen1BackttestClgen1Backt	orderFormt	orderCalct	testOrdertF3tr63tF4R�R�tRefltPermtPermNtMatDEFtMatF3tMatF4tMatF5tMatF7((RRscubic_braid.pyt_test_constructionsSs~
cCs|jjd|d|�dS(s�
        Method to print time stamped logging messages

        If you don't see this well formatted type 

        sage: print CubicBraidGroup_class.__print_timestamp__.__doc__

        This method uses the timeStampControl class. For more information on this type

        print timeStampControl.__doc__
        print timeStampControl.print_timestamp.__doc__
        print print_time_tb.__doc__

        INPUT:
 
            - "Text":  Text to be printed in the log message
            - "Level": indicates the level (importance) of the message. The following values are posible
               0 TsLevel.Silent    to be pinted independent on any verbose mode
               1 TsLevel.StackInfo classifies messages on entry and exit of subroutines
               2 TsLevel.Body      to be used in the body of a function
               3 TsLevel.BodySub1  subordinary message to TsLevel.Body
               4 TsLevel.BodySub2  subordinary message to TsLevel.Body1
               5 TsLevel.Debug     to print debug information 

        Note, that the higher levels include the for comming lower ones. 

        AUTHOR

          - Sebastian Oehms, Sept. 2016

        tTexttLevelN(R]tprint_timestamp(RR�R�((scubic_braid.pyR_�s cCs:|jdtj�t}t|j�}|d	krL||krLt}qLn|tkr\tS|jdtj�xut|j	��D]a}|jd|tj
�||�}|jdtj
�|j�tkr�d||fGHtSq�W|jdtj�|j|�|jdtj�||_|jdtj�tS(
sK
        Method to check if the given map is well defined with respect to the relations of self

        If you don't see this well formatted type 

        sage: print CubicBraidGroup_class.__check_homomorphism__.__doc__

        INPUT:

            - "test_map": the map from self to another group to be tested

        OUTPUT:

            boolean True if test_map vanishes on all relations of self, else false

        WARNINGS:

            "Warning: homomorphism not well defined for relation %s giving: %s" n case the result is False

        EXAMPLES:
        
           sage: S4.<s1,s2,s3>=AssionGroupS(4);  S4
           Assion group on 4 strands of type S
           sage: S4Cl = S4.as_classical_group()
           sage: f = S4Cl.convert_map_from( S4 )
           sage: S4.__check_homomorphism__(f)
           True

         Note, the following may be an irritation: The generators of S4 and S4Cl are the same as set but in different order

           sage: ClassGens=S4Cl.gens(); ClassGens
           [(5,8,11)(6,9,12)(7,10,13)(23,26,29)(24,27,30)(25,28,31)(32,38,35)(33,39,36)(34,40,37),
            (2,11,8)(3,13,9)(4,12,10)(17,35,26)(18,36,27)(19,37,28)(20,29,38)(21,30,39)(22,31,40),
            (1,25,24)(2,29,26)(3,27,31)(6,16,33)(7,34,15)(8,20,35)(9,36,22)(11,38,17)(13,18,40)]

           sage: S4Cl(s1)
           (2,11,8)(3,13,9)(4,12,10)(17,35,26)(18,36,27)(19,37,28)(20,29,38)(21,30,39)(22,31,40)
           sage: S4Cl(s2)
           (5,8,11)(6,9,12)(7,10,13)(23,26,29)(24,27,30)(25,28,31)(32,38,35)(33,39,36)(34,40,37)

        AUTHOR

          - Sebastian Oehms, Sept. 2016

        R�tcheck_neededsrelation %ssrelation testedsAWarning: homomorphism not well defined for relation %s giving: %stcheck_oktcheck_registerdR�N(
R_R`RaR�RrR{R-RKR�RstDebugtis_oneRq(Rttest_mapR�tchecked_homomorphismtrelationtrelVal((scubic_braid.pyR�s,/
	c
	sd���fd���fd�}�fd�}|jdtj�|j}|t}|tkr�ttg�}||_|j�|_||_	|j�|_
nY|tkr|jdkrtt
g�}||_|j�|_||_	|j�|_
n�|t}|t}|ttkr4|}n|t
tkrM|}n|jdkrl|||�n�|jdkr�|||�nxt�}|jtt�}	|jd	|	d
|ddd
t�}||_|j�|_||_	|j�|_
||_|jdtj�dS(sn
        internal method to create the classical groups attached to self

        If you don't see this well formatted type 

        sage: print CubicBraidGroup_class.__create_classical_realization__.__doc__

        INPUT:

           no

        OUTPUT:

           no

        this methods sets the following global parameters of self: 

         - self._classical_group_            This is the classical group returned by as_classical_group method
         - self._classical_group_gens_       generators of the former group 
         - self._classical_base_group_       this only differs in special cases for AssionGroup from the former
         - self._classical_base_group_gens_  generators of the former group
         - self._centralizing_matrix_        for AssionGroup: element in classical base group commuting with self
         - self._centralizing_element_       image under natural map of the former one in the projective classical group
         - self._classical_embedding_        as subgroup of classical base group (if different from class. group) 

        AUTHOR

          - Sebastian Oehms, Sept. 2016

        cSs�|jdtj�|t|krDt||d|d|j�}nl|tj�}t||d|d|j�}|}|j|�r�|j|�}||}|j	|�n|jdtj�|S(s�
            internal method to create the homomorphism from self to classical group

            this is a local function in CubicBraidGroup_class.__create_classical_realization__ using
            gap_hom

            see also:
            sage: print gap_hom.__doc__
           
            INPUT:

              - "Group": target of the map
              - "ImList": list of the images of the braid generators

            OUTPUT:

              the created homomorphism. 

            The created homomorphism is registered as coercion and conversion map for Group

            AUTHOR

              - Sebastian Oehms, Sept. 2016

            R�tGensToRNR�(
R_R`RaRtgap_homR^Rthas_coerce_map_fromR�tregister_coercion(RtGrouptImListt
homToGroupt
GroupImaget
homToImagetincl((scubic_braid.pytcreate_hom_to_classical�s!
csV|jdtj�|||dt��}d}	t||d|j�}
g}|
|�}	t}g}
x�|D]z}|t}||kr�Pn||�}|
j||��||kr�|
|�}|j|�qn|j||��qnW|}||krE|j	|�}x5|D]*}||	|	|krdG|G|	GHqqWnd}||kr��|||�t||d|d|j�nz|j	|
�}�|||��|||
�y t||d|d|j�WndGHnXt||d|
d|j�||_
||_||_|
|_
||_|	|_||_|jdtj�dS(	s

            internal method to create classical group for Assion groups

            this is a local function in CubicBraidGroup_class.__create_classical_realization__ 

            It handels the common part of symplectic and unitary version and creates all conversion map using gap_hom

            see also:
            sage: print gap_hom.__doc__

            INPUT:

             - "BaseGroup": The symplectic or unitary groups Sp(m,3) resp. GU(m,2)
             - "ProjGroup": The projeective imaged of these group
             - "centralizing_vector": The centralizing vector described by Assion
             - "transvec2mat": Function to create the transection map from transvection vector
             - "transvecList": List of transvection vectors

            OUTPUT:
            
            the function sets the global parameters of self decribed under

            sage: print CubicBraidGroup_class.__create_classical_realization__.__doc__

            AUTHOR

              - Sebastian Oehms, Sept. 2016

            R�tfactRNs0Internal Error! centralzier property failed for:tGensFroms8Warning: no map back from classical group (gap overflow)R�N(R_R`RaRR-R�R^RRqtsubgroupR|R}R~t_classical_base_group_gensR�R�R�(RtmR�t	BaseGroupt	ProjGrouptcentralizing_vectorttransvec2matttransvecListtcentralizing_matrixtcentralizing_elementtnatHomt	ClGenListtanz_tvt
BaseClGenListtvttransvecMattprojTransvecMattClassicalGroupR0t	Embedding(R�(scubic_braid.pytSetUpClassicalGroup�sZ 


 								c	s�|jdtj�t|t�}t|t�}|j�}|j}|j�j	�}|t
tkru|t
}n|tt
}g}g}	xBt
|�D]4}
|j|||
t�|	j|||
�q�W|tg}xFt
|t�D]4}
|j|	|
�|j||
||
t�q�W|j|	|t�||td�}||t}
�||||||
||�|jdtj�dS(s(
            internal method to create classical group for symplectic Assion groups (type 'S' )

            this is a local function in CubicBraidGroup_class.__create_classical_realization__

            INPUT

             - m  the dimension of the classical groups vectorspace of operation

            The routine calculates the central vector and the transvections as vector as given by Assion and then uses
            SetUpClassicalGroup to complete the construction

            AUTHOR

              - Sebastian Oehms, Sept. 2016

            R�cSsQg}x/|D]'}|j||||||�q
Wt|j�|�}|S(N(RqR>t	base_ring(R�tbastbformR�R�txtMt((scubic_braid.pyR�ms

%R�N(R_R`RatSpR
tPSptinvariant_formRYtcolumn_spacetbasisR4RRRpRq(RR�R�R�R�R�R�tmhalftxbastybasR'R�R�tcentral_vector(R�(scubic_braid.pytcreate_transvecListSympl1s0	

!
c	s�|jdtj�t�t�}t�t�}|j�j��|j}t����fd��}|j	�j
�}|j�}|j�}�t
tkr��tt
}	n+�t
tkr��tt
}	n
�t
}	g}
xkt��D]]}t|�tkr!|
j||�q�|
j||||j�|�t|�q�W|
tg}�tkr�|j|
t|
t|
t�nx�t|	�D]�}
t
|
tt}|j|
|t�|t�kr|j|
|t|
||
|t�n|t
�kr�|j|
|t|
|t|
|t
�q�q�W|||d�}|
�t|
�t}�|�||||||�|jdtj�dS(s%
            internal method to create classical group for unitary Assion groups (type 'U' )

            this is a local function in CubicBraidGroup_class.__create_classical_realization__

            INPUT

             - m  the dimension of the classical groups vectorspace of operation

            The routine calculates the central vector and the transvections as vector as given by Assion and then uses
            SetUpClassicalGroup to complete the construction

            AUTHOR

              - Sebastian Oehms, Sept. 2016

            R�cs�|�t|fS(N(R(R'R((R�toneMat(scubic_braid.pyR*�scSs`d�}g}x5|D]-}|j||||||�|�qWt|j�|�}|S(NcSsGt|�}x.tt|��D]}||j�||<qWt|�S(N(RrRpR;t	frobeniustvector(tvecR#R'((scubic_braid.pytconjVec�s(RqR>R�(R�R�R�R�RR�R�R�((scubic_braid.pyR��s	
+R�N(R_R`RatGUR4tPGUtoneR>RYR�R�R�R0R
RRpRqRR(RR�R�R�R�R�R�tBasRtvAtmthirdR�R'R�R(tposR�R(R�(R�Rscubic_braid.pytcreate_transvecListUnitar�sD	
3
$,4R�RMRVRUR%R$RRtcheckR�N(R_R`RaRYRtAbelianGroupR|R�R}R~RR4RWR
RR/R0R1t_sage_const_11R�RKR�(
RRRR�tanz_genR�tdim_sympl_grouptdim_unitary_grouptUCFt
z12inverse((R�R�scubic_braid.pyR�isN*	/oSo	
				

			$			cCsp|dkr|j}n|tkrN||_td|dtd|�|_ntd|dtd|�|_dS(s�
        Changes the options for timestamp debug log messages

        If you don't see this well formatted type 

        sage: print CubicBraidGroup_class.change_debug_options.__doc__

        The verbose -mode which has been set in the constructor can be modified here. It is possible set the mode
        separately for main routines (this module) and routines from external modules.

        Furthermore the printing of the datetime-string in the messages can be turned on

        INPUT (all optional keywords):

           - "verbose"       (default = unchanged) the new verbose mode to be set. For more informati9on on the possible 
                             values type sage: print CubicBraidGroup_class.__doc__
           - "for_subroutine" boolean (default = False): decides wether to apply the setting to log messages of this module 
                             (False) or to subroutines from external modules (True) such as lib.utils_gap_interface
           - "ShowDateTime"   boolean (default = False): decides wether to print a datetime-string in the msages 

        EXAMPLES:

          sage: from cubic_braid import *
          sage: C3 = CubicBraidGroup(3)
          sage: C3.change_debug_options(verbose=True)
          sage: C5c5= C3.as_matrix_group( characteristic=5)
          L: StackInfo   :  Elapse:  4711, Total:   4 Begin In: as_matrix_group Line: 1789
          L: Body        :  Elapse:   685, Total:   5 genList prepared In: as_matrix_group Line: 1805
          L: Body        :  Elapse:   147, Total:   5 MatGroup defined In: as_matrix_group Line: 1830
          L: StackInfo   :  Elapse:    38, Total:   5 Begin In: __check_homomorphism__ Line: 1058
          L: Body        :  Elapse:     2, Total:   5 check_needed In: __check_homomorphism__ Line: 1069
          L: Debug       :  Elapse:     2, Total:   5 relation c0*c1*c0*c1^-1*c0^-1*c1^-1 In: __check_homomorphism__ Line: 
                                                      1072
          L: Debug       :  Elapse:     6, Total:   5 relation tested In: __check_homomorphism__ Line: 1074
          L: Debug       :  Elapse:     6, Total:   5 relation c0^3 In: __check_homomorphism__ Line: 1072
          L: Debug       :  Elapse:     5, Total:   5 relation tested In: __check_homomorphism__ Line: 1074
          L: Debug       :  Elapse:     6, Total:   5 relation c1^3 In: __check_homomorphism__ Line: 1072
          L: Debug       :  Elapse:     6, Total:   5 relation tested In: __check_homomorphism__ Line: 1074
          L: Body        :  Elapse:     8, Total:   5 check_ok In: __check_homomorphism__ Line: 1079
          L: Body        :  Elapse:     3, Total:   5 check_registerd In: __check_homomorphism__ Line: 1083
          L: StackInfo   :  Elapse:     5, Total:   5 End In: __check_homomorphism__ Line: 1086
          L: Body        :  Elapse:     2, Total:   5 Hom from self defined In: as_matrix_group Line: 1840
          L: Body        :  Elapse:   904, Total:   6 Section to self defined In: as_matrix_group Line: 1853
          L: Body        :  Elapse:     4, Total:   6 section to classical group defined In: as_matrix_group Line: 1873
          L: StackInfo   :  Elapse:   367, Total:   6 Ende In: as_matrix_group Line: 1893
          sage: 
          sage: C3.change_debug_options(ShowDateTime = True)
          sage: C5c5= C3.as_matrix_group( characteristic=5)
          L: StackInfo   : 2017-01-26 18:01:50.782780 Elapse:  2986, Total:   2 Begin In: as_matrix_group Line: 1789
          L: Body        : 2017-01-26 18:01:50.859565 Elapse:    77, Total:   3 genList prepared In: as_matrix_group Line: 
                                                                                1805
          L: Body        : 2017-01-26 18:01:50.889521 Elapse:    29, Total:   3 MatGroup defined In: as_matrix_group Line: 
                                                                                1830
          L: StackInfo   : 2017-01-26 18:01:50.908706 Elapse:    19, Total:   3 Begin In: __check_homomorphism__ Line: 1058
          ..........................................
          L: Body        : 2017-01-26 18:01:51.370860 Elapse:     3, Total:   3 section to classical group defined In: 
                                                                                as_matrix_group Line: 1873
          L: StackInfo   : 2017-01-26 18:01:51.373498 Elapse:     2, Total:   3 Ende In: as_matrix_group Line: 1893
          sage: 

        AUTHOR

          - Sebastian Oehms, Jan. 2017

        RNRORPN(R-RXRKR\R4R]RR^(RRNtfor_subroutineRP((scubic_braid.pyt[email protected]sC	!cCs|jS(s\
        Return an Objekt of the class BraidGroup with identical generators, such that there exists an epimorhism to self

        If you don't see this well formatted type 

        sage: print CubicBraidGroup_class.pre_image_braid_group.__doc__

        OUTPUT: 

          Instance of the class BraidGroup having conversion maps to and from self (which is just a section in the 
          latter case)

        EXAMPLES:

            sage: from cubic_braid import *
            sage: U5=AssionGroupU(5); U5
            Assion group on 5 strands of type U
            sage: B5=U5.pre_image_braid_group(); B5
            Braid group on 5 strands
            sage: b=B5([4,3,2,-4,1])
            sage: u=U5([4,3,2,-4,1])
            sage: u == b
            False
            sage: b.burau_matrix()
            [ 1 - t      t      0      0      0]
            [ 1 - t      0      t      0      0]
            [ 1 - t      0      0      0      t]
            [ 1 - t      0      0      1 -1 + t]
            [     1      0      0      0      0]
            sage: u.burau_matrix()
            [   -zeta3 zeta3 + 1         0         0         0]
            [   -zeta3         0 zeta3 + 1         0         0]
            [   -zeta3         0         0         0 zeta3 + 1]
            [   -zeta3         0         0         1     zeta3]
            [        1         0         0         0         0]
            sage: bU = U5(b)
            sage: uB = B5(u)
            sage: 
            sage: bU == u
            True
            sage: uB == b
            True

        AUTHOR

          - Sebastian Oehms, Sept. 2016

        (Rg(R((scubic_braid.pyR�s1Rcs�|jdtj��d!kr��d!kr�|d!kr�|jdkrOt}n|jdkrgt}nt}|jd|tj�ng}x�t	|j
��D]�}	|	jd�d�d|d|d	|�}
�d!kr�|
t�n�d!kr�j
��n|d!kr�j�}n|j|
t�q�W|jd
tj�t}|j�tkrht}n|dkrX|j�j���j�t}�j�j��t||����fd��}
t��r|
j�tkr�d
|
GHnt|�d�j�d|
�}nt|�d|
�}|jd|tj�|j|�}nt|�}|jdtj�t ||d|j!�}|tkr�|j"|�tkr�t#d|j$���q�n|jdtj�d!}|tkrdG|j�GHn�|tkrZy/t ||d|j!�}|jdtj�Wq�dG|j�GHq�XnNy5t ||dtd|j!�}|jdtj�WndG|j�GHnX|j%}|d!kr)|d!kr)|j&|�}|d!kr|j'||�|jdtj�q&dGH|j�GdG|GHq)n|j(}|d!kr�||kr�|d!kr�|j&|�}|d!kr�|j'||�|jdtj�q�dGH|j�GdGt)GHq�n|jd tj�|S("s
        creates an epimorphic image of self as a matrix group by use of the burau representation

        If you don't see this well formatted type 

        sage: print CubicBraidGroup_class.as_matrix_group.__doc__
 
        INPUT: (all parameters are optional by keyword )

        - "rootBur": six root of unity in some field (default six root of unity over QQ)
        - "Domain":  base_ring for the burau matrix (default is Cyclotomic Field of order 3 and degree 2, resp. the 
                     domain of rootBur if given)
        - "characteristic": integer giving the characteristic of the domain (default is 0 or the characteristic of 
                     the doamain if given). If none of the keywords "rootBur", "Domain" and "characteristic" is given
                     the default characteristic is 3 (resp. 2) if self is of Assion type 'S' (resp. 'U')   
        - "reduced": boolean (default: False); whether to return the reduced or unreduced Burau representation (see 
                     Braid class )
        - "version":  values: 
                      'unitary': gives the unitary form according to Squier (see Braid._unitary_burau_matrix_() )
                      'default': the method behaves like the original one of the Braid -class
                      - any value else gives the reduced form given on wikipedia
        - "section"; boolean (default: True) Setting this to False creates a map back to self only in the case of
                     isomorphism. By default the map is created as a section in any case.

               compare the INPUT of
 
               sage: print CubicBraidElement.burau_matrix.__doc_

        OUTPUT:

        an instance of the class FinitelyGeneratedMatrixGroup_gap according to the Input parameters together with a map 
        from an to self and the classical group the map backwards (in both cases) is given if the the matrix group is
        isomorphic to self or if the keyword section = True (default)

        RAISE:

           - ValueError: "matrix group fails to be an epimorphic image of %s" if the burau map does not vanish on the 
                         relation of self see example with U5 below

        EXAMPLES:

            sage: from cubic_braid import *
            sage: C5=CubicBraidGroup(5)
            sage: 
            sage: M5ch5 = C5.as_matrix_group(characteristic=5); M5ch5
            Matrix group over Finite Field in rI of size 5^2 with 4 generators (
            [2*rI + 2 3*rI + 4        0        0        0]
            [       1        0        0        0        0]
            [       0        0        1        0        0]
            [       0        0        0        1        0]
            [       0        0        0        0        1],

            [       1        0        0        0        0]
            [       0 2*rI + 2 3*rI + 4        0        0]
            [       0        1        0        0        0]
            [       0        0        0        1        0]
            [       0        0        0        0        1],

            [       1        0        0        0        0]
            [       0        1        0        0        0]
            [       0        0 2*rI + 2 3*rI + 4        0]
            [       0        0        1        0        0]
            [       0        0        0        0        1],

            [       1        0        0        0        0]
            [       0        1        0        0        0]
            [       0        0        1        0        0]
            [       0        0        0 2*rI + 2 3*rI + 4]
            [       0        0        0        1        0]
            )
            sage: 
            sage: c=C5([3,4,-2,-3,1]); c
            c2*c1^-1*c0*c3*c2^-1
            sage: 
            sage: cM=M5ch5(c); cM
            [2*rI + 2 3*rI + 4        0        0        0]
            [       0        0        0        1        0]
            [2*rI + 1        0 2*rI + 2     3*rI 3*rI + 3]
            [2*rI + 2        0        0 3*rI + 4        0]
            [       0        0 2*rI + 2 3*rI + 4        0]
            sage: 
            sage: mC=C5(cM)
            sage: mC == c
            True

            sage: C5Cl=C5.as_classical_group()
            sage: 
            sage: mCl=C5Cl(cM); mCL
            [                 E(3)              E(12)^11                     0                     0]
            [            -E(12)^11                     1                 -E(4)               -E(3)^2]
            [                 E(3)              E(12)^11                E(3)^2 -2*E(12)^7 - E(12)^11]
            [                    0                     1               E(12)^7               -E(3)^2]
            sage: 
            sage: cCl=C5Cl(c)
            sage: mCl == cCl
            True
            sage: 
            sage: cClM=M5ch5(cCl)
            sage: cClM == cM
            True

            sage: U5=AssionGroupU(5); U5
            Assion group on 5 strands of type U
            sage: M5ch3 = U5.as_matrix_group(characteristic=3)
            Warning: homomorphism not well defined for relation ((u0*u1)^3*(u2*u3)^3)^3 giving: [1 1 2 1 2]
            [2 0 2 1 2]
            [2 1 1 1 2]
            [2 1 2 0 2]
            [2 1 2 1 1]
            ---------------------------------------------------------------------------
            ValueError                                Traceback (most recent call last)
            ......................
            ValueError: matrix group fails to be an epimorphic image of Assion group on 5 strands of type U
            sage: 


        AUTHOR

          - Sebastian Oehms, Sept. 2016

        R�RVRUs default characteristic set to %dR%R$R=RRsgenList preparedRcs$��||fji��6��S(N(tsubs(R'R((R$t
hermFormBraidR%ts(scubic_braid.pyR*tss)Warning: hermitian form %s is degeneratedRthermitian_formsBase Group %s definedsMatGroup definedRNs2matrix group fails to be an epimorphic image of %ssHom from self defineds>Warning: no section back from matrix group over (gap overflow)sSection to self defineds/Warning: no section back from matrix group overRsHomomorphism to self defineds4Warning: no homomorphism back from matrix group overs"section to classical group defineds&Warning: no map from matrix group oversto classical groups&section to classical embedding definedsto classical embedded rouptEndeN(*R_R`RaR-RWR
R4RR�RrR�RFRRR=RqR�RKR�tinfinityR�Rt__unitary_form__R,R�R0R>tis_FiniteFieldtdeterminantRR�tMatrixGroupR�R^R�R6R�R|R�R�R�tClassicalEmbeding(RR%R$R=RRtsectionRtgenListtbraidGentburMattavoid_gap_worspace_errorR?thermFormR�tMatGroupthomToMatt
homFromMatR�R�tClassicalEmbeddingthomToEmb((R$RR%Rscubic_braid.pyR��s�$		!	
	$$		cCs|jdtj�|j�}d}|j|�}|j|�}d}d}d}d}	d}
d}d}d}
|tks�|jtkr�t	|d|j
�}|j|�}|j|�}g|j�D]}||�^q�}n�t|t
�r+|}t||�j�}t||�j�}	n3t	|d|j
�}|j|�}|j|�}	g|j�D]}|||��^qk}tt|j���}|j|�}|j|�}|j|�}|jd|tj�d}d}|dkr"|dkr"|dkr"||}n|dkr_t|||d|j
�}|jdtj�n|
dkr�|dkr�|dkr�||}
n|
dkr�t|||
d|j
�}|jdtj�n|dkr5|dkr5||}|tkr|}nt|||d|j
�}|jdtj�n|
dkr�|dkr�||}
t|||
d|j
�}|jdtj�n|dkr�dGHn|dkr�d	GHn|jd
tj�d}d}|
dkr|	dkr|dkr|	|}
n|
dkr=t|||
d|j
�}|jdtj�n|dkrn|dkrn|dkrn||}n|dkr�t|||d|j
�}|jdtj�n|
dkr�|dkr�||}
t|||
d|j
�}|jd
tj�n|dkrQ|dkrQ||}t|||d|j
�}|jdtj�n|dkredGHn|dkrydGHn|jdtj�|dkr�|jdtj�|j|�tkr�td|j���n|jdtj�n|jdtj�|S(s+

        This method returns the permutation group corresponding to self together with conversion maps to and from
        self and the classical realization of self

        INPUT:

            - "native" boolean as optional keyword, default = False. If you set this True the permutation group is 
                       calculated with repsect to self as finitely presented group. By default the  permutation group is 
                       taken from the classical group realization.

               CAUTION: setting native = True may cause a segmentation fault if you use the sage coercion functionality 
                        afterwards (in other context, even though the coercions for the permutation group work fine).
                        The reason for this is not clear!

        OUTPUT: 

            instance of a subgroup of the symmetric group (PermutationGroup_subgroup) together with conversion maps to
            and from self and the classical groups.

        RAISE:

           - ValueError: "permutation group fails to be an epimorphic image of %s"

        EXAMPLE:

            sage: C3=CubicBraidGroup(3)
            sage: 
            sage: PC3=C3.as_permutation_group(); PC3
            Subgroup of (Symmetric group of order 8! as a permutation group) generated by [(2,3,5)(4,6,8), (1,2,4)(5,7,6)]
            sage: 
            sage: PC3n=C3.as_permutation_group(native=True); PC3n
            Subgroup of (Symmetric group of order 24! as a permutation group) generated by [(1,2,3)(4,10,11)(5,12,13)
            (6,14,15)(7,16,17)(8,18,19)(9,20,21)(22,23,24), 
            (1,4,5)(2,6,7)(3,8,9)(10,14,18)(11,22,20)(12,15,23)(13,17,21)(16,19,24)]
            sage: C3Cl = C3.as_classical_group()
            sage: c=C3([2,1-2]); c
            c1*c0^-1
            sage: lc=C3Cl(c); lc
            [  E(3)^2 -E(12)^7]
            [ E(12)^7  -E(3)^2]
            sage: pc=PC3(c); pc
            (1,5,7,4)(2,8,6,3)
            sage: pcn=PC3n(c); pcn
            (1,11,24,7)(2,15,22,9)(3,19,23,5)(4,13,16,18)(6,17,20,10)(8,21,12,14)
            sage:
            sage: clc  = C3(lc);    clc  == c
            True
            sage: cpc  = C3(pc);    cpc  == c
            True
            sage: cpcn = C3(pcn);   cpcn == c
            True
            sage: lpc  = C3Cl(pc);  lpc  == lc
            True
            sage: lpcn = C3Cl(pcn); lpcn == lc
            True
            sage: plc  = PC3(lc);   plc  == pc
            True
            sage: plcn = PC3n(lc);  plcn == pcn
            True


        AUTHOR

          - Sebastian Oehms, Sept. 2016
           
        R�RNssubgroup of %ssc2p_hom defined pos 1ss2p_hom defined pos 1sc2p_hom defined pos 2ss2p_hom defined pos 2s6Warning: no map from self to permutation group definedsAWarning: no map from classical group to permutation group definedshomToPerm definedsp2c_hom defined pos 1sp2s_hom defined pos 1sp2c_hom defined pos 2sp2s_hom defined pos 2s6Warning: no map from permutation group to self definedsAWarning: no map from permutation group to classical group definedshomFromPerm definedschecking homToPerms7permutation group fails to be an epimorphic image of %sscheck homToPerm finishedR�N(R_R`RaR�R-tconvert_map_fromR�RYR
tgap_as_permutation_groupR^R�R.tPermutationGroup_generictHomtidentitytSymmetricGroupR;tdomainR�R�tregister_homR�R�RKR6R�(RR�R�R$tc2sts2cts2potpo2stc2potpo2cts2ptp2stc2ptp2ctPermGroupOriR0tSortGenListt	PermGrouptpo2ptp2pots2p_homtc2p_homtp2s_homtp2c_hom((scubic_braid.pyR��s�G(+$
$

	
$
$


cCs~|tks-|jdks-|j|jkrU|jdkrKtd��qz|jSn%|jdkrstd��n|jSdS(s�
        creates an isomorphic image of self as a classical group according to the construction given by Coxeter resp. Assion

        If you don't see this well formatted type 

        sage: print CubicBraidGroup_class.as_classical_group.__doc__

        INPUT: (optional as keyword)

          - "embedded": boolean (default = False). This boolean does effect the cases of AssionGroups where they are 
                        realized as projective groups, only. More precisely: if self is of type 'S' (for example) and the 
                        number of strands n is even, than its classical group is a subgroup of PSp(n,3) (being 
                        centralized by the element self.centralizing_element( projective = True)). By default this group 
                        will be given. Setting embedded = True the classical realization is given as subgroup of its 
                        classical enlargement with one more stand (in this case as subgroup of Sp(n-1,3)) 

        OUTPUT: 

            depending on the type of self and the number of strands an instance of Sp(n-1,3), GU(n-1,2), Subgroup of 
            PSp(n,3), PGU(n,2) or a subgroup of GU(n-1, UCF) (type 'C' ) with respect to a certain hermitian form 
            attached to the burau representation (used by Coxeter and Squier). Here UCF stands for the universal 
            cyclotomic field. 

        RAISE:

          - ValueError: "no classical group defined" if the construction was not possible

          - ValueError: "no classical embedding defined" if the construction was not possible

        EXAMPLES:

           sage: from cubic_braid import *
           sage: U3 = AssionGroupU(3)
           sage: U3Cl = U3.as_classical_group(); U3Cl
           Subgroup of (The projective general unitary group of degree 3 over Finite Field of size 2) generated by 
           [(1,7,6)(3,19,14)(4,15,10)(5,11,18)(12,16,20),
            (1,12,13)(2,15,19)(4,9,14)(5,18,8)(6,21,16)]

           sage: U3Clemb = U3.as_classical_group(embedded=True); U3Clemb
           Matrix group over Finite Field in a of size 2^2 with 2 generators (
           [0 0 a]  [a + 1     a     a]
           [0 1 0]  [    a a + 1     a]
           [a 0 a], [    a     a a + 1]
           )
           sage: u = U3([-2,1,-2,1]); u
           (u1^-1*u0)^2
           sage: uCl = U3Cl(u); uCl
           (1,16)(2,9)(3,10)(4,19)(6,12)(7,20)(13,21)(14,15)
           sage: 
           sage: uCle = U3Clemb(u); uCle
           [a + 1 a + 1     1]
           [a + 1     0     a]
           [    1     a     a]
           sage:
           sage: U3(uCl) == u
           True
           sage: U3(uCle) == u
           True
           sage: U4 = AssionGroupU(4)
           sage: U4Cl = U4.as_classical_group(); U4Cl
           General Unitary Group of degree 3 over Finite Field in a of size 2^2 with respect to hermitian form [0 0 1]
           [0 1 0]
           [1 0 0]
           sage: uCle in U4Cl
           True
           sage: C4 = CubicBraidGroup(4)
           sage: C4Cl = C4.as_classical_group(); C4Cl
           Subgroup of General Unitary Group of degree 3 over Universal Cyclotomic Field with respect to hermitian form 
           [-E(12)^7 + E(12)^11                  -1                   0]
           [                 -1 -E(12)^7 + E(12)^11                  -1]
           [                  0                  -1 -E(12)^7 + E(12)^11] 
           generated by (
           [    E(3) E(12)^11        0]
           [       0        1        0]
           [       0        0        1], 
           [       1        0        0]
           [E(12)^11     E(3) E(12)^11]
           [       0        0        1], 
           [       1        0        0]
           [       0        1        0]
           [       0 E(12)^11     E(3)])
           sage: type(C4Cl)
           <class 'lib.local_matrix_group.MatrixGroup_subgroup_with_category'>



        AUTHOR

          - Sebastian Oehms, Sept. 2016
           

        sno classical group definedsno classical embedding definedN(RKR�R-R|R6(Rtembedded((scubic_braid.pyR��sb-
	c
sc|jdks-|jtks-|jtkr<td��n|jdtj�d}ddl	m
��fd�}|jtkr�|tttg�}nZ|jtkr�|t
�}n<|jt
kr�|t�}n|jtkr�|t�}n|jd|tj�t||d|j�}|tkra|j|�tkratd	|j���qan|jd
tj�y/t||d|j�}|jdtj�WndGHnX|j�}|j|�}|j|�}||}	t|||	d|j�}
|jd
tj�||}t|||d|j�}|jdtj�|jdtj�|S(s�
        creates an isomorphic image of self as irreducible complex reflection group. This is possible only for the finite 
        cubic braid groups of type 'C'

        If you don't see this well formatted type 

        sage: print CubicBraidGroup_class.as_classical_group.__doc__

        This method uses the sage implementation of reflection group via the gap3 CHEVIE package. To use this methode
        you must have sage from version 7.2 up and gap3 with CHEVIE installed

        INPUT (optional):

          -check :  boolean (default false): can be set to force a check of well definiteness of the morphism from self

        OUTPUT: 

          an object of the class IrreducibleComplexReflectionGroup (from sage.combinat.root_system.reflection_group_complex)
          together with isomorphism to and from self and self.as_classical_group()

        RAISE:

          - ValueError:   "no refection group defined" if the construction was not possible
          - ImportError:  "cannot import name IrreducibleComplexReflectionGroup" means:Sage Version 7.2 up is needed for 
                          this functionality"


        EXAMPLES:

          sage: from lib.cubic_braid import *
          sage: C3.<c1,c2> = CubicBraidGroup(3)
          sage: R3 = C3.as_reflection_group(); R3
          Irreducible complex reflection group of rank 2 and type ST4
          sage: type(R3)
          <class 'lib.local_permgroup.IrreducibleComplexReflectionGroup_with_category'>
          sage: 
          sage: R3.cartan_matrix()
          [-2*E(3) - E(3)^2           E(3)^2]
          [         -E(3)^2 -2*E(3) - E(3)^2]
          sage: R3.simple_roots()
          Finite family {1: (0, -2*E(3) - E(3)^2), 2: (2*E(3)^2, E(3)^2)}
          sage: R3.simple_coroots()
          Finite family {1: (0, 1), 2: (1/3*E(3) - 1/3*E(3)^2, 1/3*E(3) - 1/3*E(3)^2)}
          sage: 

        Conversion maps:

          sage: 
          sage: C3Cl = C3.as_classical_group()
          sage: ele = c1*c2**2; ele
          c1*c2^2
          sage: rele = R3(ele); rele
          (1,14,12,18)(2,15,24,16)(3,22,19,4)(5,6,17,20)(7,10,23,21)(8,11,9,13)
          sage: rele.matrix()
          [-1/3*E(3) + 1/3*E(3)^2  1/3*E(3) + 2/3*E(3)^2]
          [-4/3*E(3) - 2/3*E(3)^2  1/3*E(3) - 1/3*E(3)^2]
          sage: clele = C3Cl(ele); clele
          [ -E(3)^2  E(12)^7]
          [-E(12)^7   E(3)^2]
          sage: clrele = C3Cl(rele); clrele
          [ -E(3)^2  E(12)^7]
          [-E(12)^7   E(3)^2]
          sage: C3(rele)
          c1*c2^-1

       The refelection groups can also be viewed as subgroups of unitary groups over the universal cyclotomic field. This 
       functionality is availlable just in the context of cubic braid groups in addition to the basic functionality of the 
       IrreducibleComplexReflectionGroup_class. Note that the unitary group corresponding to the reflection group is 
       isomorphic but diferent from the classical group due to different hermitian forms for the unitary groups they live in.

         sage: C4=CubicBraidGroup(4)
         sage: R4=C4.as_reflection_group()
         sage: R4Cl=R4.as_unitary_group(); R4Cl
         Subgroup of General Unitary Group of degree 3 over Universal Cyclotomic Field generated by:
         ([   1    0    0]
          [   0    1    0]
          [   0    0 E(3)], 
          [-1/3*E(3) - 2/3*E(3)^2  2/3*E(3) + 1/3*E(3)^2  2/3*E(3) + 1/3*E(3)^2]
          [ 2/3*E(3) + 1/3*E(3)^2 -1/3*E(3) - 2/3*E(3)^2  2/3*E(3) + 1/3*E(3)^2]
          [ 2/3*E(3) + 1/3*E(3)^2  2/3*E(3) + 1/3*E(3)^2 -1/3*E(3) - 2/3*E(3)^2], 
          [   1    0    0]
          [   0 E(3)    0]
          [   0    0    1])
         sage: C4Cl=C4.as_classical_group(); C4Cl
         Subgroup of Unitary Group of degree 3 over Universal Cyclotomic Field with respect to hermitian form
         [-E(12)^7 + E(12)^11                  -1                   0]
         [                 -1 -E(12)^7 + E(12)^11                  -1]
         [                  0                  -1 -E(12)^7 + E(12)^11] generated by:
         ([    E(3) E(12)^11        0]
          [       0        1        0]
          [       0        0        1], 
          [       1        0        0]
          [E(12)^11     E(3) E(12)^11]
          [       0        0        1], 
          [       1        0        0]
          [       0        1        0]
          [       0 E(12)^11     E(3)])
          sage: C4ClAmbient = C4Cl.ambient(); C4ClAmbient
          Unitary Group of degree 3 over Universal Cyclotomic Field with respect to hermitian form
          [-E(12)^7 + E(12)^11                  -1                   0]
          [                 -1 -E(12)^7 + E(12)^11                  -1]
          [                  0                  -1 -E(12)^7 + E(12)^11]
          sage: R4ClAmbient = R4Cl.ambient(); R4ClAmbient
          General Unitary Group of degree 3 over Universal Cyclotomic Field
          sage: C4ClAmbient == R4ClAmbient
          False


        AUTHOR:

          - Sebastian Oehms, Mar. 2017
           

        RMsno reflection group definedR�i����(t!IrreducibleComplexReflectionGroupc
sL�t|�d|jdd�d|jdd�d|jdd��}|S(s�
            This local Function overloads the corresponding function of sage.combinat.root_system.reflection_group_real 
            in order to make "call by name conversion" availlable via the local_permgroup module 
            t	index_setthyperplane_index_settreflection_index_setN(RutgetR-(targstkwdstRefGroup(RK(scubic_braid.pytReflectionGroup�	s
sReflectGroup %s definedRNs5refection group fails to be an epimorphic image of %ssHom from self definedsHom to self defineds.Warning: no section back from reflection groupsr2c_hom definedsc2r_hom definedR�N(RWRYRkR4R6R_R`RaR-tlib.local_permgroupRKRR
R3t_sage_const_25t_sage_const_32R�R�R^R�R�RKR�R�R/R6R�(
RRtReflectGroupRSt	homToReflthomFromReflR�R7R8tr2ctr2c_homtc2rtc2r_hom((RKscubic_braid.pyR�0	sH~-	

cCs<|jdkrtd��n|tkr1|jS|jSdS(s
        returns the centralizing element defined in the work of Assion (Hilfssatz 1.1.3 and 1.2.3)

        If you don't see this well formatted type 

        sage: print CubicBraidGroup_class.centralizing_element.__doc__

        INPUT: (optional as keyword)

          - "projective": boolean (default = False). This boolean does effect the cases of AssionGroups where they are
                          realized as projective groups, only. More precisely: if self is of type 'S' (for example) and 
                          the number of strands n is even, than its classical group is a subgroup of 
                          PSp(n,3) (being centralized by this element). By default this group will be given.
                          Setting embedded = True the classical realization is given as subgroup of its classical 
                          enlargement with one more stand (in this case as subgroup of Sp(n,3)) 

        OUTPUT:

          depending on the optional keyword a permutation as an element of PSp(n,3) (type S) or PGU(n,2) (type U) if
          projective = True  and n == 0 mod 2 (type S) reps. n == 0 mod 3 (type U) is returned. Elsewise the 
          centralizing element is a matrix belonging to Sp(n,3) reps. GU(n,2). 

        RAISE:

          - ValueError: "no centralizing element defined"


        EXAMPLES:

          sage: U3=AssionGroupU(3);  U3
          Assion group on 3 strands of type U
          sage: 
          sage: U3Cl = U3.as_classical_group(); U3Cl
          Subgroup of (The projective general unitary group of degree 3 over Finite Field of size 2) generated by 
          [(1,7,6) (3,19,14)(4,15,10)(5,11,18)(12,16,20), (1,12,13)(2,15,19)(4,9,14)(5,18,8)(6,21,16)]
          sage: 
          sage: U3Clem = U3.as_classical_group(embedded=True); U3Clem
          Matrix group over Finite Field in a of size 2^2 with 2 generators (
          [0 0 a]  [a + 1     a     a]
          [0 1 0]  [    a a + 1     a]
          [a 0 a], [    a     a a + 1]
          )
          sage: 
          sage: u3cent = U3.centralizing_element(); u3cent
          [a + 1 a + 1     1]
          [a + 1     0     a]
          [    1     a     a]
          sage: u3cent in U3Cl
          False
          sage: u3centP in U3Cl
          True
          sage: u3cent in U3Clem
          True
          sage: u3centP in U3Clem
          False

        considering u3cent as element in AssionGroupU(4)

          sage: U4=AssionGroupU(4);  U4
          Assion group on 4 strands of type U
          sage: 
          sage: U4Cl = U4.as_classical_group(); U4Cl
          General Unitary Group of degree 3 over Finite Field in a of size 2^2 with respect to hermitian form [0 0 1]
          [0 1 0]
          [1 0 0]
          sage: u3cent in U4Cl
          True
          sage: U4(u3cent)
          (u0*u1^-1)^2
          sage:
          sage: # calculating the centralizer of u3cent in U4Cl via GAP functions in order to
          sage: # check if U3Clem is a subgroup of the centralizer of u3cent in U4Cl
          sage:
          sage: CentU4u3cent = gap_centralizer( U4Cl, u3cent ); CentU4u3cent
          Matrix group over Finite Field in a of size 2^2 with 4 generators (
          [a + 1 a + 1     1]  [a + 1     0     0]  [    1     1 a + 1]  [1 0 1]
          [a + 1     0     a]  [    0 a + 1     0]  [    0     a     a]  [0 a 0]
          [    1     a     a], [    0     0 a + 1], [    0     0     1], [1 0 0]
          )
          sage: 
          sage: CentU4u3cent.gens()[0] in U3Clem
          True
          sage: CentU4u3cent.gens()[1] in U3Clem
          False
          sage: CentU4u3cent.gens()[2] in U3Clem
          True
          sage: CentU4u3cent.gens()[3] in U3Clem
          False
          sage: 
          sage: CentU4u3cent.order()
          72
          sage: U3Clem.order()
          24

        check that U3Clem is a subgroup of index 3 in CentU4u3cent 

          sage: U3Clem.gens()[0] in CentU4u3cent
          True
          sage: U3Clem.gens()[1] in CentU4u3cent
          True


        AUTHOR

          - Sebastian Oehms, Sept. 2016

        sno centralizing element definedN(R�R-R6R�R�(Rt
projective((scubic_braid.pyR��	s
pcCs|j}|tkrO|jdkr9|tkr9t}n|j�j�}|S|t}t}|tkrtt}n?|t	kr�t
}n*|t
kr�t}n|tkr�t
}n|jdkr1t
}|t	tkr�|t	}t}x.t|�D] }||t	|tt}q�W|||t	}q�n�|jdkr�t	}|t
tkr�t}x7t|t�D]%}|||t	t|t	}qmW||t|||tt	}q�n<|jdkr�|tkr�q�|tkr�t}q�t}n|tkr|j�j�}n|S(s(
        to avoid long waittime on calculations the order will be obtained by formular resp. direct value

        If you don't see this well formatted type 

        sage: print CubicBraidGroup_class.order.__doc__

        INPUT:
 
          - "by_formula": (optional keyword) boolean (default = True). In the default case the order is calculated from
             formulas for simple group of Lie typ. If set to false the order is calculated by native function with 
             respect to the classical group (in the cases where this is finite). 

        OUTPUT: 

            size of the group as Integer ore infinity

        EXAMPLES:

          sage: S6=AssionGroupS(6)
          sage: S6.order()
          12597120
          sage: S6.order(by_formula=False)
          12597120
          sage: 
          sage: C6=CubicBraidGroup(6)
          sage: C6.order()
          +Infinity


        AUTHOR

          - Sebastian Oehms, Sept. 2016

        REFERENCES:

         - Carter, R.W.: "Simple groups of Lie type", John Wiley & Sons (London 1989)

        RMRVRU(RYRKRWRkRR�R�RRR4R
RmR3t_sage_const_648Rpt_sage_const_155520(RR�R�R�R�tqtlR'((scubic_braid.pyR�x
sP)		
				
	#(		cs�|dkr�jt}n�j}yt|�}Wntd��nX||ksc|tkrytd�j��n�j�}tgt	|t�D]}||^q��}t
d|d�jd�j�}�fd�}t
|�|d�j�|S(s
        creates a CubicBraidGroup as subgroup of self on the first "n_strands" strands

        If you don't see this well formatted type 

        sage: print CubicBraidGroup_class.order.__doc__

        INPUT:

          - "nstrands": Integer > 0 and < self._nstrands_ giving the number of strand for the subgroup.
            the default is one strand less than self  

        OUTPUT: 

           an instance of the this class realizing the subgroup

        EXAMPLES:



        AUTHOR

          - Sebastian Oehms, Sept. 2016

        snstrands must be an integers*nstrands must be positive and less than %sRR�RNcs�|j��S(N(tTietze(tele(R(scubic_braid.pytembedsN(R-RYRR5t	TypeErrorRR6R�RuRptCubicBraidGroupRWRXR6R^(RtnstrandsR�tGensR'tGensRedtSGrpRe((Rscubic_braid.pytcubic_braid_subgroup�
s	-!cCs|j�}|j�}|S(s 
        calculates the character_table of the cubic braid group via the gap interface

        OUTPUT: 
  
           Character table as matrix (instance of sage.matrix.matrix_cyclo_dense.Matrix_cyclo_dense)

        EXAMPLE:

          sage: U3=AssionGroupU(3);  U3
          Assion group on 3 strands of type U
          sage: U3ct=U3.character_table(); U3ct
          [         1          1          1          1          1          1          1]
          [         1 -zeta3 - 1      zeta3          1      zeta3 -zeta3 - 1          1]
          [         1      zeta3 -zeta3 - 1          1 -zeta3 - 1      zeta3          1]
          [         2         -1         -1          0          1          1         -2]
          [         2     -zeta3  zeta3 + 1          0 -zeta3 - 1      zeta3         -2]
          [         2  zeta3 + 1     -zeta3          0      zeta3 -zeta3 - 1         -2]
          [         3          0          0         -1          0          0          3]
  



        AUTHOR

          - Sebastian Oehms, Sept. 2016

        (R�tcharacter_table(RRCtCharTab((scubic_braid.pyRm's(RHRIRJRtElementRKRtR�R�R�R_R�R�R-RRR�R�R�R�R�R�R�RlRm(((scubic_braid.pyRL�s,�f			�	(	O	��T	9��|�|p?tcRMcCs�|dk	rCyt|�t}WqCtk
r?|}d}qCXn|dkr�t|tj�ryt|jd��}q�t	|�}t|�}nyddl
m}Wnddlm}nXt
|||��}t|||�S(s|
    Constructs cubic quotients of braid groups as instance of the CubicBraidGroup_class 

    If you don't see this well formatted type 

    sage: print CubicBraidGroup.__doc__

    for more information about the CubicBraidGroup_class type

    sage: print CubicBraidGroup_class.__doc__

    INPUT:

     - "n": integer or None (default). The number of strands. If not specified the "names" are counted and the group is 
           assumed to have one more strand than generators.

     - "names": string or list/tuple/iterable of strings (default:'c'). The generator names or name prefix.

           The entry can be either a string with the names of the generators, or the number of generators and the prefix 
           of the names to be given. The default prefix is 'c'

     - "AdditionalRelation":  (optional keyword, default = 'C') is passed to the corresponding keyword parameter of
           the constructor of the CubicBraidGroup_class. For more information type 
           sage: print CubicBraidGroup_class.__doc__

     - "verbose":  (optional keyword, default = False) is passed to the corresponding keyword parameter of
           the constructor of the CubicBraidGroup_class. For more information type 
           sage: print CubicBraidGroup_class.__doc__



    This function is adapted from the BraidGroup function!

    EXAMPLES:

        sage: C3=CubicBraidGroup(3); C3.generators()
        (c0, c1)
        sage: CubicBraidGroup(3, 'g').generators()
        (g0, g1)
        sage: U3.<u1,u2>=CubicBraidGroup(3, AdditionalRelation = 'U'); U3.generators()
        (u1, u2)


        AUTHOR

          - Sebastian Oehms, Sept. 2016

    t,i����(tnormalize_namesN(R-R5RRfR.tsixtstring_typesR;tsplitRrtsage.structure.category_objectRrtsage.structure.parentRuRL(R�RR�RNRr((scubic_braid.pyRg\s"2

Rc	Cstd|d|ddd|�S(s
    Constructs cubic quotients of braid groups as instance of the CubicBraidGroup_class which have been investigated
    by J.Assion under the notation S(m)  

    If you don't see this well formatted type 

    sage: print AssionGroupS.__doc__

    for more information about the CubicBraidGroup_class type

    sage: print CubicBraidGroup_class.__doc__

    This function is a short hand cut for the CubicBraidGroup function setting AdditionalRelation ='S' and 
    default names='s'

    INPUT:

     - "n": integer or None (default). The number of strands. This parameter is passed to the corresponding parameter 
           of the CubicBraidGroup function For more information type 
           sage: print CubicBraidGroup.__doc__

     - "names": string or list/tuple/iterable of strings (default:'s'). This parameter is passed to the corresponding 
           parameter of the CubicBraidGroup function For more information type 
           sage: print CubicBraidGroup.__doc__

     - "verbose":  (optional keyword, default = False) is passed to the corresponding keyword parameter of
           the constructor of the CubicBraidGroup_class. For more information type 
           sage: print CubicBraidGroup_class.__doc__

    EXAMPLES:

        sage: S3=AssionGroupS(3);  S3
        Assion group on 3 strands of type S
        sage: S3x=CubicBraidGroup(3, names='s', AdditionalRelation = 'S'); S3x
        Assion group on 3 strands of type S
        sage: S3 == S3x
        True

        AUTHOR

          - Sebastian Oehms, Sept. 2016

    R�RR�RVRN(Rg(R�RRN((scubic_braid.pytAssionGroupS�s-tuc	Cstd|d|ddd|�S(s
    Constructs cubic quotients of braid groups as instance of the CubicBraidGroup_class which have been investigated
    by J.Assion under the notation U(m)  

    If you don't see this well formatted type 

    sage: print AssionGroupU.__doc__

    for more information about the CubicBraidGroup_class type

    sage: print CubicBraidGroup_class.__doc__

    This function is a short hand cut for the CubicBraidGroup function setting AdditionalRelation ='U' and 
    default names='u'

    INPUT:

     - "n": integer or None (default). The number of strands. This parameter is passed to the corresponding parameter 
           of the CubicBraidGroup function For more information type 
           sage: print CubicBraidGroup.__doc__

     - "names": string or list/tuple/iterable of strings (default:'u'). This parameter is passed to the corresponding 
           parameter of the CubicBraidGroup function For more information type 
           sage: print CubicBraidGroup.__doc__

     - "verbose":  (optional keyword, default = False) is passed to the corresponding keyword parameter of
           the constructor of the CubicBraidGroup_class. For more information type 
           sage: print CubicBraidGroup_class.__doc__

    EXAMPLES:

        sage: U3=AssionGroupU(3);  U3
        Assion group on 3 strands of type U
        sage: U3x=CubicBraidGroup(3, names='u', AdditionalRelation = 'U'); U3x
        Assion group on 3 strands of type U
        sage: U3 == U3x
        True

        AUTHOR

          - Sebastian Oehms, Sept. 2016

    R�RR�RURN(Rg(R�RRN((scubic_braid.pytAssionGroupU�s-N('tsage.all_cmdlineR5R
R4RRR�R2RkR3RiRjRVR1RR_R`RURmRltsage.groups.finitely_presentedRRtsage.misc.decoratorsRRtsage.groups.braidt
lib.utils_systlib.utils_gap_interfaceRTtlib.local_braidtlib.local_matrix_groupRRLR-RKRgRxRz(((scubic_braid.pyt<module>sR
@





	�����������zM/