本文整理匯總了Python中sage.modules.free_module.VectorSpace.set_immutable方法的典型用法代碼示例。如果您正苦於以下問題:Python VectorSpace.set_immutable方法的具體用法?Python VectorSpace.set_immutable怎麽用?Python VectorSpace.set_immutable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sage.modules.free_module.VectorSpace
的用法示例。
在下文中一共展示了VectorSpace.set_immutable方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from sage.modules.free_module import VectorSpace [as 別名]
# 或者: from sage.modules.free_module.VectorSpace import set_immutable [as 別名]
def __init__(self, surface, label, point, ring = None, limit=None):
self._s = surface
if ring is None:
self._ring = surface.base_ring()
else:
self._ring = ring
p = surface.polygon(label)
point = VectorSpace(self._ring,2)(point)
point.set_immutable()
pos = p.get_point_position(point)
assert pos.is_inside(), \
"Point must be positioned within the polygon with the given label."
# This is the correct thing if point lies in the interior of the polygon with the given label.
self._coordinate_dict = {label: {point}}
if pos.is_in_edge_interior():
label2,e2 = surface.opposite_edge(label, pos.get_edge())
point2 = surface.edge_transformation(label, pos.get_edge())(point)
point2.set_immutable()
if label2 in self._coordinate_dict:
self._coordinate_dict[label2].add(point2)
else:
self._coordinate_dict[label2]={point2}
if pos.is_vertex():
self._coordinate_dict = {}
sing = surface.singularity(label, pos.get_vertex(), limit=limit)
for l,v in sing.vertex_set():
new_point = surface.polygon(l).vertex(v)
new_point.set_immutable()
if l in self._coordinate_dict:
self._coordinate_dict[l].add(new_point)
else:
self._coordinate_dict[l] = {new_point}
# Freeze the sets.
for label,point_set in self._coordinate_dict.iteritems():
self._coordinate_dict[label] = frozenset(point_set)