本文整理汇总了Python中sage.matrix.matrix_space.MatrixSpace._get_matrix_class方法的典型用法代码示例。如果您正苦于以下问题:Python MatrixSpace._get_matrix_class方法的具体用法?Python MatrixSpace._get_matrix_class怎么用?Python MatrixSpace._get_matrix_class使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sage.matrix.matrix_space.MatrixSpace
的用法示例。
在下文中一共展示了MatrixSpace._get_matrix_class方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from sage.matrix.matrix_space import MatrixSpace [as 别名]
# 或者: from sage.matrix.matrix_space.MatrixSpace import _get_matrix_class [as 别名]
def __init__(self, coxeter_matrix, base_ring, index_set):
"""
Initialize ``self``.
EXAMPLES::
sage: W = CoxeterGroup([[1,3,2],[3,1,3],[2,3,1]])
sage: TestSuite(W).run() # long time
sage: W = CoxeterGroup([[1,3,2],[3,1,4],[2,4,1]], base_ring=QQbar)
sage: TestSuite(W).run() # long time
sage: W = CoxeterGroup([[1,3,2],[3,1,6],[2,6,1]])
sage: TestSuite(W).run(max_runs=30) # long time
sage: W = CoxeterGroup([[1,3,2],[3,1,-1],[2,-1,1]])
sage: TestSuite(W).run(max_runs=30) # long time
We check that :trac:`16630` is fixed::
sage: CoxeterGroup(['D',4], base_ring=QQ).category()
Category of finite coxeter groups
sage: CoxeterGroup(['H',4], base_ring=QQbar).category()
Category of finite coxeter groups
sage: F = CoxeterGroups().Finite()
sage: all(CoxeterGroup([letter,i]) in F
....: for i in range(2,5) for letter in ['A','B','D'])
True
sage: all(CoxeterGroup(['E',i]) in F for i in range(6,9))
True
sage: CoxeterGroup(['F',4]).category()
Category of finite coxeter groups
sage: CoxeterGroup(['G',2]).category()
Category of finite coxeter groups
sage: all(CoxeterGroup(['H',i]) in F for i in range(3,5))
True
sage: all(CoxeterGroup(['I',i]) in F for i in range(2,5))
True
"""
self._matrix = coxeter_matrix
n = coxeter_matrix.rank()
# Compute the matrix with entries `2 \cos( \pi / m_{ij} )`.
MS = MatrixSpace(base_ring, n, sparse=True)
MC = MS._get_matrix_class()
# FIXME: Hack because there is no ZZ \cup \{ \infty \}: -1 represents \infty
if base_ring is UniversalCyclotomicField():
val = lambda x: base_ring.gen(2*x) + ~base_ring.gen(2*x) if x != -1 else base_ring(2)
else:
from sage.functions.trig import cos
from sage.symbolic.constants import pi
val = lambda x: base_ring(2*cos(pi / x)) if x != -1 else base_ring(2)
gens = [MS.one() + MC(MS, entries={(i, j): val(coxeter_matrix[index_set[i], index_set[j]])
for j in range(n)},
coerce=True, copy=True)
for i in range(n)]
category = CoxeterGroups()
# Now we shall see if the group is finite, and, if so, refine
# the category to ``category.Finite()``. Otherwise the group is
# infinite and we refine the category to ``category.Infinite()``.
if self._matrix.is_finite():
category = category.Finite()
else:
category = category.Infinite()
FinitelyGeneratedMatrixGroup_generic.__init__(self, ZZ(n), base_ring,
gens, category=category)
示例2: __init__
# 需要导入模块: from sage.matrix.matrix_space import MatrixSpace [as 别名]
# 或者: from sage.matrix.matrix_space.MatrixSpace import _get_matrix_class [as 别名]
def __init__(self, coxeter_matrix, base_ring, index_set):
"""
Initialize ``self``.
EXAMPLES::
sage: W = CoxeterGroup([[1,3,2],[3,1,3],[2,3,1]])
sage: TestSuite(W).run() # long time
sage: W = CoxeterGroup([[1,3,2],[3,1,4],[2,4,1]], base_ring=QQbar)
sage: TestSuite(W).run() # long time
sage: W = CoxeterGroup([[1,3,2],[3,1,6],[2,6,1]])
sage: TestSuite(W).run(max_runs=30) # long time
sage: W = CoxeterGroup([[1,3,2],[3,1,-1],[2,-1,1]])
sage: TestSuite(W).run(max_runs=30) # long time
We check that :trac:`16630` is fixed::
sage: CoxeterGroup(['D',4], base_ring=QQ).category()
Category of finite coxeter groups
sage: CoxeterGroup(['H',4], base_ring=QQbar).category()
Category of finite coxeter groups
sage: F = CoxeterGroups().Finite()
sage: all(CoxeterGroup([letter,i]) in F
....: for i in range(2,5) for letter in ['A','B','D'])
True
sage: all(CoxeterGroup(['E',i]) in F for i in range(6,9))
True
sage: CoxeterGroup(['F',4]).category()
Category of finite coxeter groups
sage: CoxeterGroup(['G',2]).category()
Category of finite coxeter groups
sage: all(CoxeterGroup(['H',i]) in F for i in range(3,5))
True
sage: all(CoxeterGroup(['I',i]) in F for i in range(2,5))
True
"""
self._matrix = coxeter_matrix
self._index_set = index_set
n = ZZ(coxeter_matrix.nrows())
# Compute the matrix with entries `2 \cos( \pi / m_{ij} )`.
MS = MatrixSpace(base_ring, n, sparse=True)
MC = MS._get_matrix_class()
# FIXME: Hack because there is no ZZ \cup \{ \infty \}: -1 represents \infty
if base_ring is UniversalCyclotomicField():
val = lambda x: base_ring.gen(2 * x) + ~base_ring.gen(2 * x) if x != -1 else base_ring(2)
else:
from sage.functions.trig import cos
from sage.symbolic.constants import pi
val = lambda x: base_ring(2 * cos(pi / x)) if x != -1 else base_ring(2)
gens = [
MS.one() + MC(MS, entries={(i, j): val(coxeter_matrix[i, j]) for j in range(n)}, coerce=True, copy=True)
for i in range(n)
]
# Compute the matrix with entries `- \cos( \pi / m_{ij} )`.
# This describes the bilinear form corresponding to this
# Coxeter system, and might lead us out of our base ring.
base_field = base_ring.fraction_field()
MS2 = MatrixSpace(base_field, n, sparse=True)
MC2 = MS2._get_matrix_class()
self._bilinear = MC2(
MS2,
entries={
(i, j): val(coxeter_matrix[i, j]) / base_field(-2)
for i in range(n)
for j in range(n)
if coxeter_matrix[i, j] != 2
},
coerce=True,
copy=True,
)
self._bilinear.set_immutable()
category = CoxeterGroups()
# Now we shall see if the group is finite, and, if so, refine
# the category to ``category.Finite()``. Otherwise the group is
# infinite and we refine the category to ``category.Infinite()``.
is_finite = self._finite_recognition()
if is_finite:
category = category.Finite()
else:
category = category.Infinite()
FinitelyGeneratedMatrixGroup_generic.__init__(self, n, base_ring, gens, category=category)