o
    oh                     @   s6   d dl mZ d dlmZ d dlmZ ejZdd ZdS )    )PermutationGroup)Permutation)uniqc                     s  g }g }d}d}| D ]}|j  t|j}|  | 7 }|| ||7 }q
g }t|D ]}|tt| q-d}	d tt|D ]7}t|	|	||  D ]}
| | j|
|	  j} fdd|D ||
   ||  < qN|	|| 7 }	 || 7  qCttdd |D }t|ddS )a8  
    Returns the direct product of several groups as a permutation group.

    Explanation
    ===========

    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
    ========

    sympy.combinatorics.perm_groups.PermutationGroup.__mul__

    r   c                    s   g | ]}|  qS  r   ).0xcurrent_degr   x/var/www/html/construction_image-detection-poc/venv/lib/python3.10/site-packages/sympy/combinatorics/group_constructs.py
<listcomp>9   s    z!DirectProduct.<locals>.<listcomp>c                 S   s   g | ]}t t|qS r   )_af_newlist)r   ar   r   r
   r   <   s    F)dups)	degreelen
generatorsappendranger   
array_formr   r   )groupsdegrees
gens_counttotal_degree
total_gensgroupcurrent_num_gens
array_gensicurrent_genjgen	perm_gensr   r   r
   DirectProduct   s2   



r#   N)sympy.combinatorics.perm_groupsr    sympy.combinatorics.permutationsr   sympy.utilities.iterablesr   r   r#   r   r   r   r
   <module>   s
    