本文整理汇总了Python中sage.modules.free_module.VectorSpace.zero方法的典型用法代码示例。如果您正苦于以下问题:Python VectorSpace.zero方法的具体用法?Python VectorSpace.zero怎么用?Python VectorSpace.zero使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sage.modules.free_module.VectorSpace
的用法示例。
在下文中一共展示了VectorSpace.zero方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_satisfy_inter
# 需要导入模块: from sage.modules.free_module import VectorSpace [as 别名]
# 或者: from sage.modules.free_module.VectorSpace import zero [as 别名]
def test_satisfy_inter(self):
v_space = VectorSpace(QQ,4)
sub = v_space.subspace([[1,-1,1,1],[2,-3,4,5]])
comp = orth_complement(v_space,sub)
zero = v_space.subspace([v_space.zero()])
inter = sub.intersection(comp)
self.assertEqual(zero,inter)
示例2: homology
# 需要导入模块: from sage.modules.free_module import VectorSpace [as 别名]
# 或者: from sage.modules.free_module.VectorSpace import zero [as 别名]
def homology(self,varient="complement",*args):
hom = {}
cc = self.chain_complex(varient,(-1,self.poly_ring.ngens()+1),*args)
#Some need wider return range
for i in range(self.poly_ring.ngens()+1):
vs_am = VectorSpace(QQ,len(cc[i]))
if len(cc[i])==0:
hom[i] = []
continue
if len(cc[i-1])!=0:
d_im = []
for b in cc[i-1]:
d_b = self.differential(b,varient,*args)
d_im.append(lift_to_basis(d_b,cc[i]))
img = vs_am.subspace(d_im)
else:
img = vs_am.subspace([vs_am.zero()])
if len(cc[i+1])!=0:
d_ker = []
for b in cc[i]:
d_b = self.differential(b,varient,*args)
d_ker.append(lift_to_basis(d_b,cc[i+1]))
ker = (matrix(QQ,d_ker)).left_kernel()
else:
ker = vs_am
quo = ker.quotient(img)
hom[i] = []
for b in quo.basis():
vec = quo.lift(b)
part_sum = LogarithmicDifferentialForm.make_zero(i,self)
for c,f in zip(vec,cc[i]):
part_sum = part_sum + c*f
hom[i].append(part_sum)
return hom
示例3: test_full
# 需要导入模块: from sage.modules.free_module import VectorSpace [as 别名]
# 或者: from sage.modules.free_module.VectorSpace import zero [as 别名]
def test_full(self):
v_space = VectorSpace(QQ,4)
zero = v_space.subspace([v_space.zero()])
comp = orth_complement(v_space,v_space)
self.assertEqual(zero,comp)