コード例 #1
0
def test_AlternatingGroup():
    G = AlternatingGroup(5)
    elements = list(G.generate())
    assert len(elements) == 60
    assert [perm.is_even for perm in elements] == [True] * 60
    H = AlternatingGroup(1)
    assert H.order() == 1
    L = AlternatingGroup(2)
    assert L.order() == 1
コード例 #2
0
def test_AlternatingGroup():
    G = AlternatingGroup(5)
    elements = list(G.generate())
    assert len(elements) == 60
    assert [perm.is_even for perm in elements] == [True]*60
    H = AlternatingGroup(1)
    assert H.order() == 1
    L = AlternatingGroup(2)
    assert L.order() == 1
コード例 #3
0
def test_handle_precomputed_bsgs():
    A = AlternatingGroup(5)
    A.schreier_sims()
    base = A.base
    strong_gens = A.strong_gens
    result = _handle_precomputed_bsgs(base, strong_gens)
    strong_gens_distr = _distribute_gens_by_base(base, strong_gens)
    assert strong_gens_distr == result[2]
    transversals = result[0]
    orbits = result[1]
    base_len = len(base)
    for i in range(base_len):
        for el in orbits[i]:
            assert transversals[i][el](base[i]) == el
            for j in range(i):
                assert transversals[i][el](base[j]) == base[j]
    order = 1
    for i in range(base_len):
        order *= len(orbits[i])
    assert A.order() == order

    _, transversals = _orbits_transversals_from_bsgs(base, strong_gens_distr)
    assert transversals == _handle_precomputed_bsgs(base, strong_gens,
                                                    transversals)[0]
    assert transversals == _handle_precomputed_bsgs(
        base,
        strong_gens,
        transversals,
        basic_orbits=transversals,
        strong_gens_distr=strong_gens_distr)[0]
コード例 #4
0
ファイル: test_util.py プロジェクト: skirpichev/diofant
def test_handle_precomputed_bsgs():
    A = AlternatingGroup(5)
    A.schreier_sims()
    base = A.base
    strong_gens = A.strong_gens
    result = _handle_precomputed_bsgs(base, strong_gens)
    strong_gens_distr = _distribute_gens_by_base(base, strong_gens)
    assert strong_gens_distr == result[2]
    transversals = result[0]
    orbits = result[1]
    base_len = len(base)
    for i in range(base_len):
        for el in orbits[i]:
            assert transversals[i][el](base[i]) == el
            for j in range(i):
                assert transversals[i][el](base[j]) == base[j]
    order = 1
    for i in range(base_len):
        order *= len(orbits[i])
    assert A.order() == order

    _, transversals = _orbits_transversals_from_bsgs(base, strong_gens_distr)
    assert transversals == _handle_precomputed_bsgs(base, strong_gens,
                                                    transversals)[0]
    assert transversals == _handle_precomputed_bsgs(base, strong_gens,
                                                    transversals,
                                                    basic_orbits=transversals,
                                                    strong_gens_distr=strong_gens_distr)[0]