當前位置: 首頁>>代碼示例>>Python>>正文


Python Permutation.read_cycle_form方法代碼示例

本文整理匯總了Python中permutation.Permutation.read_cycle_form方法的典型用法代碼示例。如果您正苦於以下問題:Python Permutation.read_cycle_form方法的具體用法?Python Permutation.read_cycle_form怎麽用?Python Permutation.read_cycle_form使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在permutation.Permutation的用法示例。


在下文中一共展示了Permutation.read_cycle_form方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_len

# 需要導入模塊: from permutation import Permutation [as 別名]
# 或者: from permutation.Permutation import read_cycle_form [as 別名]
 def test_len(self):
     s1 = Permutation.read_cycle_form([[1,2,3,4]], 4)
     s2 = Permutation.read_cycle_form([[1,2]], 4)
     G = PermGroup([s1, s2])
     self.assertEqual(len(G), len(G._list_elements()))
     self.assertEqual(len(G), 24)
     self.assertTrue(Permutation.read_cycle_form([[3,4]], 4) in G._list_elements())
開發者ID:cyberewok,項目名稱:cgt-sandpit,代碼行數:9,代碼來源:group_tests.py

示例2: test_identity

# 需要導入模塊: from permutation import Permutation [as 別名]
# 或者: from permutation.Permutation import read_cycle_form [as 別名]
 def test_identity(self):
     a = Permutation([2, 3, 1, 4])
     c = Permutation([])
     self.assertEqual(a ** -1 * a, Permutation.read_cycle_form([], 4))
     self.assertEqual(a * a ** -1, Permutation.read_cycle_form([], 4))
     self.assertEqual((a * a ** -1)._func, (1, 2, 3, 4))
     self.assertEqual(c._func, ())
開發者ID:cyberewok,項目名稱:cgt-sandpit,代碼行數:9,代碼來源:permutation_tests.py

示例3: test_coset_enumeration

# 需要導入模塊: from permutation import Permutation [as 別名]
# 或者: from permutation.Permutation import read_cycle_form [as 別名]
 def test_coset_enumeration(self):
     g1 = Permutation.read_cycle_form([[1,2,3,4]], 4)
     g2 = Permutation.read_cycle_form([[1,2]], 4)
     h1 = Permutation.read_cycle_form([[1,2,3]], 4)
     h2 = Permutation.read_cycle_form([[1,2]], 4)
     G = PermGroup([g1, g2])
     H = PermGroup([h1, h2])
     cosets = G._left_cosets(H)
     total = 0
     elements = []
     for coset in cosets:
         temp_eles = coset._list_elements()
         elements += temp_eles
         self.assertEqual(len(temp_eles),len(H))
         total += len(temp_eles)
     self.assertEqual(len(G), total)
     self.assertEqual(sorted(G._list_elements()), sorted(elements))        
     cosets = G._right_cosets(H)
     total = 0
     elements = []
     for coset in cosets:
         temp_eles = coset._list_elements()
         elements += temp_eles
         self.assertEqual(len(temp_eles),len(H))
         total += len(temp_eles)
     self.assertEqual(len(G), total)
     self.assertEqual(sorted(G._list_elements()), sorted(elements))
開發者ID:cyberewok,項目名稱:cgt-sandpit,代碼行數:29,代碼來源:group_tests.py

示例4: test_schreier_graph_construction

# 需要導入模塊: from permutation import Permutation [as 別名]
# 或者: from permutation.Permutation import read_cycle_form [as 別名]
 def test_schreier_graph_construction(self):
     s1 = Permutation.read_cycle_form([[2,3]], 4)
     s2 = Permutation.read_cycle_form([[1,2,4]], 4)
     gens = [s1,s2]
     identity = Permutation([1,2,3,4])
     s_g = _schreier_graph(2, gens, identity)
     self.assertEqual(s_g, [s2,identity,s1,s2])
開發者ID:cyberewok,項目名稱:cgt-sandpit,代碼行數:9,代碼來源:schreier_sims_tests.py

示例5: test_klien4

# 需要導入模塊: from permutation import Permutation [as 別名]
# 或者: from permutation.Permutation import read_cycle_form [as 別名]
 def test_klien4(self):
     a = Permutation.read_cycle_form([[1,2],[3,4]],4)
     b = Permutation.read_cycle_form([[1,3],[2,4]],4)
     G = PermGroup([a,b])
     oG = OrbitGraph(G,(1,2))
     self.assertTrue(tuple(sorted(oG.edges)) == ((1,2),(2,1),(3,4),(4,3)))
     self.assertTrue(oG.ad_list == [[2],[1],[4],[3]])
開發者ID:cyberewok,項目名稱:cgt-sandpit,代碼行數:9,代碼來源:orbit_graph_tests.py

示例6: test_cycle_form_reading

# 需要導入模塊: from permutation import Permutation [as 別名]
# 或者: from permutation.Permutation import read_cycle_form [as 別名]
 def test_cycle_form_reading(self):
     a = Permutation([2, 3, 1, 4])
     b = Permutation.read_cycle_form([], 4)
     e = Permutation([1, 2, 3, 4])
     self.assertEqual(b, e)
     self.assertEqual(a, Permutation.read_cycle_form([[1, 2, 3]], 4))
     self.assertEqual(a, Permutation.read_cycle_form([[2, 3, 1]], 4))
     self.assertEqual(a, Permutation.read_cycle_form([[3, 1, 2]], 4))
開發者ID:cyberewok,項目名稱:cgt-sandpit,代碼行數:10,代碼來源:permutation_tests.py

示例7: test_coset_reps

# 需要導入模塊: from permutation import Permutation [as 別名]
# 或者: from permutation.Permutation import read_cycle_form [as 別名]
 def test_coset_reps(self):
     s1 = Permutation.read_cycle_form([[2,3]], 4)
     s2 = Permutation.read_cycle_form([[1,2,4]], 4)
     gens = [s1,s2]
     identity = Permutation([1,2,3,4])
     s_g = _schreier_graph(2, gens, identity)
     cosets = _coset_reps(s_g, identity)
     self.assertEqual(cosets, [Permutation.read_cycle_form([[1,4,2]], 4),identity,s1,s2])
開發者ID:cyberewok,項目名稱:cgt-sandpit,代碼行數:10,代碼來源:schreier_sims_tests.py

示例8: test_base_image_member

# 需要導入模塊: from permutation import Permutation [as 別名]
# 或者: from permutation.Permutation import read_cycle_form [as 別名]
 def test_base_image_member(self):
     h1 = Permutation.read_cycle_form([[3,4,5,6,7]], 7)
     h2 = Permutation.read_cycle_form([[3,4]], 7)
     H = PermGroup.fixed_base_group([h1, h2], [3,4,5,6])
     self.assertEqual(H.base, [3,4,5,6])
     image1 = [1,2,3,4]
     image2 = [5,3,4,6]
     self.assertTrue(H.base_image_member(image1) is None)
     self.assertEqual(H.base_image_member(image2), Permutation.read_cycle_form([[3,5,4]],7))   
開發者ID:cyberewok,項目名稱:cgt-sandpit,代碼行數:11,代碼來源:group_tests.py

示例9: test_fixed_base_group

# 需要導入模塊: from permutation import Permutation [as 別名]
# 或者: from permutation.Permutation import read_cycle_form [as 別名]
 def test_fixed_base_group(self):
     g1 = Permutation.read_cycle_form([[1,2,3,4,5,6]], 6)
     g2 = Permutation.read_cycle_form([[1,2]], 6)
     h1 = Permutation.read_cycle_form([[3,4,5,6]], 6)
     h2 = Permutation.read_cycle_form([[3,4]], 6)
     G = PermGroup.fixed_base_group([g1, g2], [5,4])
     H = PermGroup.fixed_base_group([h1, h2], [1,2,3,4,5,6])
     N = PermGroup.fixed_base_group([g1,h1], [])
     self.assertEqual(G.base[:2], [5,4])
     self.assertEqual(H.base[:4], [1,2,3,4])
     self.contains_membership_test(G, H)
開發者ID:cyberewok,項目名稱:cgt-sandpit,代碼行數:13,代碼來源:group_tests.py

示例10: test_orbit

# 需要導入模塊: from permutation import Permutation [as 別名]
# 或者: from permutation.Permutation import read_cycle_form [as 別名]
 def test_orbit(self):
     g1 = Permutation.read_cycle_form([[1,2,3,4]], 4)
     g2 = Permutation.read_cycle_form([[1,2]], 4)
     base = [3,4,1]
     reverse_priority = [3,4,1,2]
     G = PermGroup.fixed_base_group([g1, g2], base)
     self.assertEqual(G.orbit(1), [1,2,3,4])
     self.assertEqual(G.orbit(1, stab_level = 0), [1,2,3,4])
     self.assertEqual(G.orbit(1, stab_level = 1), [1,2,4])
     self.assertEqual(G.orbit(1, stab_level = 2), [1,2])
     self.assertEqual(G.orbit(1, stab_level = 3), [1])
     self.assertEqual(G.orbit(1, key = lambda x : reverse_priority[x - 1]), [3,4,1,2])
開發者ID:cyberewok,項目名稱:cgt-sandpit,代碼行數:14,代碼來源:group_tests.py

示例11: test_schreier_generators

# 需要導入模塊: from permutation import Permutation [as 別名]
# 或者: from permutation.Permutation import read_cycle_form [as 別名]
 def test_schreier_generators(self):
     s1 = Permutation.read_cycle_form([[2,3]], 4)
     s2 = Permutation.read_cycle_form([[1,2,4]], 4)
     gens = [s1,s2]
     identity = Permutation([1,2,3,4])
     s_g = _schreier_graph(2, gens, identity)
     cosets = _coset_reps(s_g, identity)
     s_gen = _schreier_generators(2, cosets, gens, identity)
     gen_1 = Permutation.read_cycle_form([[3,4]], 4)
     gen_2 = Permutation.read_cycle_form([[1,3,4]], 4)
     gen_3 = Permutation.read_cycle_form([[1,3]], 4)
     self.assertEqual(s_gen, [gen_1, gen_2, gen_3])
開發者ID:cyberewok,項目名稱:cgt-sandpit,代碼行數:14,代碼來源:schreier_sims_tests.py

示例12: test_coset

# 需要導入模塊: from permutation import Permutation [as 別名]
# 或者: from permutation.Permutation import read_cycle_form [as 別名]
 def test_coset(self):
     g1 = Permutation.read_cycle_form([[1,2,3,4]], 4)
     g2 = Permutation.read_cycle_form([[1,2]], 4)
     h1 = Permutation.read_cycle_form([[1,2,3]], 4)
     h2 = Permutation.read_cycle_form([[1,2]], 4)
     G = PermGroup([g1, g2])
     H = PermGroup([h1, h2])
     coset = sorted((H*g1)._list_elements())
     for c in coset:
         self.assertEqual(sorted((H*c)._list_elements()), coset)
     self.assertEqual(len(H), len(coset))
     coset = sorted((g1*H)._list_elements())   
     for c in coset:
         self.assertEqual(sorted((c*H)._list_elements()), coset)
     self.assertEqual(len(H), len(coset))
開發者ID:cyberewok,項目名稱:cgt-sandpit,代碼行數:17,代碼來源:group_tests.py

示例13: test_initialisation

# 需要導入模塊: from permutation import Permutation [as 別名]
# 或者: from permutation.Permutation import read_cycle_form [as 別名]
 def test_initialisation(self):
     s1 = Permutation.read_cycle_form([[2,3,5,7],[9, 10]], 10)
     s2 = Permutation.read_cycle_form([[1,2,4,8],[9, 10]], 10)
     G = PermGroup([s1, s2])
     base_gen_pairs = list(zip(['_']+G.base, G.chain_generators))
     prev = base_gen_pairs[0][1]
     base_eles = []
     for base_ele, gens in base_gen_pairs[1:-1]:
         base_eles.append(base_ele)
         for g in gens:
             for b in base_eles:
                 self.assertEqual(b, b**g)
         temp = PermGroup(gens)
         self.assertTrue(len([g for g in prev if g not in temp])>0)
         prev = gens   
開發者ID:cyberewok,項目名稱:cgt-sandpit,代碼行數:17,代碼來源:group_tests.py

示例14: test_order

# 需要導入模塊: from permutation import Permutation [as 別名]
# 或者: from permutation.Permutation import read_cycle_form [as 別名]
 def test_order(self):
     cf = lambda x : Permutation.read_cycle_form(x,6)
     g1 = cf([[1,4,5,2,3]])
     g2 = cf([[1,2],[3,4]])
     g3 = cf([[1,2],[6,5]])
     G = PermGroup([g1,g2,g3])
     self.assertEqual(G.order(), 360)
開發者ID:cyberewok,項目名稱:cgt-sandpit,代碼行數:9,代碼來源:group_tests.py

示例15: test_change_base_redundancy

# 需要導入模塊: from permutation import Permutation [as 別名]
# 或者: from permutation.Permutation import read_cycle_form [as 別名]
 def test_change_base_redundancy(self):
     cf = lambda x: Permutation.read_cycle_form(x,6)
     a = cf([[1,2,3,4],[5,6]])
     b = cf([[1,2]])
     G = PermGroup([a,b])
     G.change_base([5,6,1,2,3,4])
     self.assertEqual(G.base[:4],[5,6,1,2])
開發者ID:cyberewok,項目名稱:cgt-sandpit,代碼行數:9,代碼來源:group_tests.py


注:本文中的permutation.Permutation.read_cycle_form方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。