本文整理汇总了Python中sage.combinat.root_system.cartan_type.CartanType.cartan_matrix方法的典型用法代码示例。如果您正苦于以下问题:Python CartanType.cartan_matrix方法的具体用法?Python CartanType.cartan_matrix怎么用?Python CartanType.cartan_matrix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sage.combinat.root_system.cartan_type.CartanType
的用法示例。
在下文中一共展示了CartanType.cartan_matrix方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: find_cartan_type_from_matrix
# 需要导入模块: from sage.combinat.root_system.cartan_type import CartanType [as 别名]
# 或者: from sage.combinat.root_system.cartan_type.CartanType import cartan_matrix [as 别名]
def find_cartan_type_from_matrix(CM):
"""
Find a Cartan type by direct comparison of matrices given from the
generalized Cartan matrix ``CM`` and return ``None`` if not found.
INPUT:
- ``CM`` -- A generalized Cartan matrix
EXAMPLES::
sage: from sage.combinat.root_system.cartan_matrix import find_cartan_type_from_matrix
sage: M = matrix([[2,-1,-1], [-1,2,-1], [-1,-1,2]])
sage: find_cartan_type_from_matrix(M)
['A', 2, 1]
sage: M = matrix([[2,-1,0], [-1,2,-2], [0,-1,2]])
sage: find_cartan_type_from_matrix(M)
['C', 3]
sage: M = matrix([[2,-1,-2], [-1,2,-1], [-2,-1,2]])
sage: find_cartan_type_from_matrix(M)
"""
n = CM.ncols()
# Build the list to test based upon rank
if n == 1:
return CartanType(['A', 1])
test = [['A', n]]
if n >= 2:
if n == 2:
test += [['G',2], ['A',2,2]]
test += [['B',n], ['A',n-1,1]]
if n >= 3:
if n == 3:
test += [['G',2,1], ['D',4,3]]
test += [['C',n], ['BC',n-1,2], ['C',n-1,1]]
if n >= 4:
if n == 4:
test += [['F',4], ['G',2,1], ['D',4,3]]
test += [['D',n], ['B',n-1,1]]
if n == 5:
test += [['F',4,1], ['D',n-1,1]]
elif n == 6:
test.append(['E',6])
elif n == 7:
test += [['E',7], ['E',6,1]]
elif n == 8:
test += [['E',8], ['E',7,1]]
elif n == 9:
test.append(['E',8,1])
# Test every possible Cartan type and its dual
for x in test:
ct = CartanType(x)
if ct.cartan_matrix() == CM:
return ct
if ct == ct.dual():
continue
ct = ct.dual()
if ct.cartan_matrix() == CM:
return ct
return None
示例2: cartan_type
# 需要导入模块: from sage.combinat.root_system.cartan_type import CartanType [as 别名]
# 或者: from sage.combinat.root_system.cartan_type.CartanType import cartan_matrix [as 别名]
def cartan_type(self):
r"""
Returns the Cartan type of the Cartan companion of self.b_matrix()
Only crystallographic types are implemented
Warning: this function is redundant but the corresonding method in
CartanType does not recognize all the types
"""
A = self.cartan_companion()
n = self.rk
degrees_dict = dict(zip(range(n),map(sum,2-A)))
degrees_set = Set(degrees_dict.values())
types_to_check = [ ["A",n] ]
if n > 1:
types_to_check.append(["B",n])
if n > 2:
types_to_check.append(["C",n])
if n > 3:
types_to_check.append(["D",n])
if n >=6 and n <= 8:
types_to_check.append(["E",n])
if n == 4:
types_to_check.append(["F",n])
if n == 2:
types_to_check.append(["G",n])
if n >1:
types_to_check.append(["A", n-1,1])
types_to_check.append(["B", n-1,1])
types_to_check.append(["BC",n-1,2])
types_to_check.append(["A", 2*n-2,2])
types_to_check.append(["A", 2*n-3,2])
if n>2:
types_to_check.append(["C", n-1,1])
types_to_check.append(["D", n,2])
if n>3:
types_to_check.append(["D", n-1,1])
if n >=7 and n <= 9:
types_to_check.append(["E",n-1,1])
if n == 5:
types_to_check.append(["F",4,1])
if n == 3:
types_to_check.append(["G",n-1,1])
types_to_check.append(["D",4,3])
if n == 5:
types_to_check.append(["E",6,2])
for ct_name in types_to_check:
ct = CartanType(ct_name)
if 0 not in ct.index_set():
ct = ct.relabel(dict(zip(range(1,n+1),range(n))))
ct_matrix = ct.cartan_matrix()
ct_degrees_dict = dict(zip(range(n),map(sum,2-ct_matrix)))
if Set(ct_degrees_dict.values()) != degrees_set:
continue
for p in Permutations(range(n)):
relabeling = dict(zip(range(n),p))
ct_new = ct.relabel(relabeling)
if ct_new.cartan_matrix() == A:
return copy(ct_new)
raise ValueError("Type not recognized")