当前位置: 首页>>代码示例>>Python>>正文


Python VectorSpace.subspace方法代码示例

本文整理汇总了Python中sage.modules.free_module.VectorSpace.subspace方法的典型用法代码示例。如果您正苦于以下问题:Python VectorSpace.subspace方法的具体用法?Python VectorSpace.subspace怎么用?Python VectorSpace.subspace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sage.modules.free_module.VectorSpace的用法示例。


在下文中一共展示了VectorSpace.subspace方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_satisfy_inter

# 需要导入模块: from sage.modules.free_module import VectorSpace [as 别名]
# 或者: from sage.modules.free_module.VectorSpace import subspace [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)
开发者ID:robertgoss,项目名称:Logarithmic-differential-forms,代码行数:9,代码来源:logarithmic_forms_test.py

示例2: homology

# 需要导入模块: from sage.modules.free_module import VectorSpace [as 别名]
# 或者: from sage.modules.free_module.VectorSpace import subspace [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
开发者ID:robertgoss,项目名称:Logarithmic-differential-forms,代码行数:36,代码来源:logarithmic_forms.py

示例3: _complex_relative

# 需要导入模块: from sage.modules.free_module import VectorSpace [as 别名]
# 或者: from sage.modules.free_module.VectorSpace import subspace [as 别名]
 def _complex_relative(self,n,*args):
   if len(args)==2:
     complex = []
     for i in range(args[0],args[1]):
       complex.append(self._complex_relative(n,i))
     return complex
   if n<0 or n>self.poly_ring.ngens():
     return []
   if n==0:
     hom_basis = self._p_graded_module(n).homogeneous_part_basis(self.degree+args[0])
     return [LogarithmicDifferentialForm(n,b,self) for b in hom_basis]
   base = self._p_graded_module(n).homogeneous_part_basis(self.degree+args[0])
   if len(base)==0:
     return []
   vs_base = VectorSpace(QQ,len(base))
   df_base = [LogarithmicDifferentialForm(n,b,self) for b in base]
   pre_base = self._p_graded_module(n-1).homogeneous_part_basis(self.degree+args[0])
   if len(pre_base)==0:
     return df_base
   dh = [self.divisor.derivative(g) for g in self.poly_ring.gens()]
   dh = LogarithmicDifferentialForm(1,dh,self)
   rel_gens = []
   for b in pre_base:
     b_form = LogarithmicDifferentialForm(n-1,b,self)
     w = dh.wedge(b_form)
     rel_gens.append(lift_to_basis([w],df_base))
   rel = vs_base.subspace(rel_gens)
   comp = orth_complement(vs_base,rel)
   #Lift
   rel_complex = []
   for vec in comp.basis():
     rel_complex.append(_weighted_sum(vec,df_base,self))
   return rel_complex
开发者ID:robertgoss,项目名称:Logarithmic-differential-forms,代码行数:35,代码来源:logarithmic_forms.py

示例4: _differential_relative

# 需要导入模块: from sage.modules.free_module import VectorSpace [as 别名]
# 或者: from sage.modules.free_module.VectorSpace import subspace [as 别名]
 def _differential_relative(self,form,*args):
   n = form.degree
   deg = self._p_graded_module(n).total_degree(form.vec)
   deg -= self.degree
   der = form.derivative()
   full = self._p_graded_module(n+1).homogeneous_part_basis(self.degree+deg)
   full_forms = [LogarithmicDifferentialForm(n+1,b,self) for b in full]
   full_space = VectorSpace(QQ,len(full))
   target_comp = self._complex_relative(n+1,deg)
   comp_vecs = []
   for b in target_comp:
     comp_vecs.append(lift_to_basis([b],full_forms))
   comp_vecs = full_space.subspace(comp_vecs)
   lift_full = lift_to_basis([der],full_forms)
   lift_prog = comp_vecs.basis_matrix()*vector(lift_full)
   return [_weighted_sum(lift_prog,target_comp,self)]
开发者ID:robertgoss,项目名称:Logarithmic-differential-forms,代码行数:18,代码来源:logarithmic_forms.py

示例5: test_satisfy_sum

# 需要导入模块: from sage.modules.free_module import VectorSpace [as 别名]
# 或者: from sage.modules.free_module.VectorSpace import subspace [as 别名]
 def test_satisfy_sum(self):
   v_space = VectorSpace(QQ,4)
   sub = v_space.subspace([[1,1,1,-1],[2,-3,41,5]])
   comp = orth_complement(v_space,sub)
   self.assertEqual(v_space,sub+comp)
开发者ID:robertgoss,项目名称:Logarithmic-differential-forms,代码行数:7,代码来源:logarithmic_forms_test.py

示例6: test_comp

# 需要导入模块: from sage.modules.free_module import VectorSpace [as 别名]
# 或者: from sage.modules.free_module.VectorSpace import subspace [as 别名]
 def test_comp(self):
   v_space = VectorSpace(QQ,4)
   sub = v_space.subspace([[1,1,1,1],[2,2,-3,-1]])
   comp = orth_complement(v_space,sub)
   true_comp = v_space.subspace([[19,-17,3,-5],[1,-1,0,0]])
   self.assertEqual(comp,true_comp)
开发者ID:robertgoss,项目名称:Logarithmic-differential-forms,代码行数:8,代码来源:logarithmic_forms_test.py

示例7: test_full

# 需要导入模块: from sage.modules.free_module import VectorSpace [as 别名]
# 或者: from sage.modules.free_module.VectorSpace import subspace [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)
开发者ID:robertgoss,项目名称:Logarithmic-differential-forms,代码行数:7,代码来源:logarithmic_forms_test.py


注:本文中的sage.modules.free_module.VectorSpace.subspace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。