Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1495 from amakelov/week10
Centralizers, improved normal closure & applications
- Loading branch information
Showing
14 changed files
with
1,117 additions
and
238 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.. _combinatorics-group_constructs: | ||
|
||
Group constructors | ||
================== | ||
|
||
.. module:: sympy.combinatorics.group_constructs | ||
|
||
.. autofunction:: DirectProduct |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,5 @@ Contents | |
graycode.rst | ||
named_groups.rst | ||
util.rst | ||
group_constructs.rst | ||
testutil.rst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,5 +20,3 @@ Utilities | |
.. autofunction:: _strip | ||
|
||
.. autofunction:: _strong_gens_from_distr | ||
|
||
.. autofunction:: _verify_bsgs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.