Redberry计算机代数系统(可从Maven Central获取)中的 Java实现PermutationGroup
和相关算法。它包括在计算机中表示置换群的基本算法(基于基础和强生成集以及Schreier-Sims 算法)和某些类型的子群(集合稳定器、集中器等)的回溯搜索算法。该实现提供了所有要求的功能:枚举组元素、成员资格测试、组顺序计算(排列总数)等等。cc.redberry.core
以下来自 Redbery JavaDoc 页面的示例突出显示了一些PermutationGroup
功能:
//permutation in cycle notation
Permutation p1 = Permutations.createPermutation(new int[][]{{0, 9, 3}, {5, 8, 6}, {7, 11, 12}});
//permutation in one-line notation
Permutation p2 = Permutations.createPermutation(2, 0, 1, 8, 3, 5, 7, 11, 4, 12, 9, 6, 10);
//Construct permutation group
PermutationGroup pg = PermutationGroup.createPermutationGroup(p1, p2);
//this group is transitive
assert pg.isTransitive();
//its order = 5616
System.out.println(pg.order());
//Create alternating group Alt(13)
PermutationGroup alt13 = PermutationGroup.alternatingGroup(13);
//its order = 3113510400
System.out.println(alt13.order());
assert alt13.containsSubgroup(pg);
//Direct product of two groups
PermutationGroup pp = pg.directProduct(PermutationGroup.symmetricGroup(8));
//Setwise stabilizer
PermutationGroup sw = pp.setwiseStabilizer(1, 2, 3, 9, 10, 11, 12, 3, 14, 15, 16, 17, 18);
assert pp.containsSubgroup(sw);
//its order = 17280
System.out.println(sw.order());
//Center of this stabilizer
PermutationGroup center = sw.center();
//it is abelian group
assert center.isAbelian();
//generators of center
//[+{}, +{{19, 20}}, +{{2, 10}, {3, 9}, {6, 8}, {11, 12}}]
System.out.println(center.generators());
有关PermutationGroup
功能的更多信息,请参见Redberry JavaDoc 页面。
Java 类还有一个很好的 Groovy 接口,可以在此处找到示例。