ó
¡Œ\c           @  sl   d  d l  m Z m Z d  d l m Z d  d l m Z d  d l m Z d  d l	 m
 Z
 e j Z d   Z d S(   iÿÿÿÿ(   t   print_functiont   division(   t   PermutationGroup(   t   Permutation(   t   range(   t   uniqc          G  s  g  } g  } d } d } xT |  D]L } | j  } t | j  } | j |  | | 7} | j |  | | 7} q Wg  } x- t |  D] }	 | j t t |    q Wd }
 d } x  t t |   D] }	 xg t |
 |
 | |	  D]N } |  |	 j | |
 j } g  | D] } | | ^ q| | | | | |	 +qâ W|
 | |	 7}
 | | |	 7} qÄ Wt t g  | D] } t t |   ^ qa  } t	 | d t
 S(   sæ  
    Returns the direct product of several groups as a permutation group.

    This is implemented much like the __mul__ procedure for taking the direct
    product of two permutation groups, but the idea of shifting the
    generators is realized in the case of an arbitrary number of groups.
    A call to DirectProduct(G1, G2, ..., Gn) is generally expected to be faster
    than a call to G1*G2*...*Gn (and thus the need for this algorithm).

    Examples
    ========

    >>> from sympy.combinatorics.group_constructs import DirectProduct
    >>> from sympy.combinatorics.named_groups import CyclicGroup
    >>> C = CyclicGroup(4)
    >>> G = DirectProduct(C, C, C)
    >>> G.order()
    64

    See Also
    ========

    __mul__

    i    t   dups(   t   degreet   lent
   generatorst   appendR   t   listt
   array_formR   t   _af_newR   t   False(   t   groupst   degreest
   gens_countt   total_degreet
   total_genst   groupt   current_degt   current_num_genst
   array_genst   it   current_gent   jt   gent   xt   at	   perm_gens(    (    sC   lib/python2.7/site-packages/sympy/combinatorics/group_constructs.pyt   DirectProduct   s0    	
41N(   t
   __future__R    R   t   sympy.combinatorics.perm_groupsR   t    sympy.combinatorics.permutationsR   t   sympy.core.compatibilityR   t   sympy.utilities.iterablesR   R   R   (    (    (    sC   lib/python2.7/site-packages/sympy/combinatorics/group_constructs.pyt   <module>   s   	