Skip to content

Commit

Permalink
Merge pull request #1495 from amakelov/week10
Browse files Browse the repository at this point in the history
Centralizers, improved normal closure & applications
  • Loading branch information
asmeurer committed Aug 20, 2012
2 parents 5569bb2 + 0bcb3ac commit 00abb2f
Show file tree
Hide file tree
Showing 14 changed files with 1,117 additions and 238 deletions.
8 changes: 8 additions & 0 deletions doc/src/modules/combinatorics/group_constructs.rst
@@ -0,0 +1,8 @@
.. _combinatorics-group_constructs:

Group constructors
==================

.. module:: sympy.combinatorics.group_constructs

.. autofunction:: DirectProduct
2 changes: 2 additions & 0 deletions doc/src/modules/combinatorics/index.rst
Expand Up @@ -17,3 +17,5 @@ Contents
graycode.rst
named_groups.rst
util.rst
group_constructs.rst
testutil.rst
16 changes: 16 additions & 0 deletions doc/src/modules/combinatorics/testutil.rst
@@ -0,0 +1,16 @@
.. _combinatorics-testutil:

Test Utilities
==============

.. module:: sympy.combinatorics.testutil

.. autofunction:: _cmp_perm_lists

.. autofunction:: _naive_list_centralizer

.. autofunction:: _verify_bsgs

.. autofunction:: _verify_centralizer

.. autofunction:: _verify_normal_closure
2 changes: 0 additions & 2 deletions doc/src/modules/combinatorics/util.rst
Expand Up @@ -20,5 +20,3 @@ Utilities
.. autofunction:: _strip

.. autofunction:: _strong_gens_from_distr

.. autofunction:: _verify_bsgs
53 changes: 53 additions & 0 deletions sympy/combinatorics/group_constructs.py
@@ -0,0 +1,53 @@
from sympy.combinatorics.perm_groups import PermutationGroup
from sympy.combinatorics.permutations import _new_from_array_form

def DirectProduct(*groups):
"""
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__
"""
degrees = []
gens_count = []
total_degree = 0
total_gens = 0
for group in groups:
current_deg = group.degree
current_num_gens = len(group.generators)
degrees.append(current_deg)
total_degree += current_deg
gens_count.append(current_num_gens)
total_gens += current_num_gens
array_gens = []
for i in range(total_gens):
array_gens.append(range(total_degree))
current_gen = 0
current_deg = 0
for i in xrange(len(gens_count)):
for j in xrange(current_gen, current_gen + gens_count[i]):
gen = ((groups[i].generators)[j - current_gen]).array_form
array_gens[j][current_deg:current_deg + degrees[i]] =\
[ x + current_deg for x in gen]
current_gen += gens_count[i]
current_deg += degrees[i]
perm_gens = [_new_from_array_form(array) for array in array_gens]
return PermutationGroup(perm_gens)
3 changes: 2 additions & 1 deletion sympy/combinatorics/named_groups.py
@@ -1,4 +1,5 @@
from sympy.combinatorics.perm_groups import PermutationGroup, DirectProduct
from sympy.combinatorics.perm_groups import PermutationGroup
from sympy.combinatorics.group_constructs import DirectProduct
from sympy.combinatorics.permutations import Permutation, _new_from_array_form

def AbelianGroup(*cyclic_orders):
Expand Down

0 comments on commit 00abb2f

Please sign in to comment.