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


Python QQ.is_integral方法代码示例

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


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

示例1: is_consistent

# 需要导入模块: from sage.all import QQ [as 别名]
# 或者: from sage.all.QQ import is_integral [as 别名]
 def is_consistent(self,k):
     r"""
     Return True if the Weil representation is a multiplier of weight k.
     """
     if self._verbose>0:
         print "is_consistent at wr! k={0}".format(k)
     twok =QQ(2)*QQ(k)
     if not twok.is_integral():
         return False
     if self._sym_type <>0:
         if self.is_dual():
             sig_mod_4 = -self._weil_module.signature() % 4
         else:
             sig_mod_4 = self._weil_module.signature() % 4
         if is_odd(self._weil_module.signature()):                
             return (twok % 4 == (self._sym_type*sig_mod_4 %4))
         else:
             if sig_mod_4 == (1 - self._sym_type) % 4:
                 return twok % 4 == 0
             else:
                 return twok % 4 == 2
     if is_even(twok) and  is_even(self._weil_module.signature()):
             return True
     if is_odd(twok) and  is_odd(self._weil_module.signature()):
             return True
     return False
开发者ID:nilsskoruppa,项目名称:psage,代码行数:28,代码来源:multiplier_systems.py

示例2: __init__

# 需要导入模块: from sage.all import QQ [as 别名]
# 或者: from sage.all.QQ import is_integral [as 别名]
    def __init__(self,WR,weight=QQ(1)/QQ(2),use_symmetry=True,group=SL2Z,dual=False,**kwargs):
        r"""
        WR should be a Weil representation.
        INPUT:
         - weight -- weight (should be consistent with the signature of self)
         - use_symmetry -- if False we do not symmetrize the functions with respect to Z
                        -- if True we need a compatible weight
        - 'group' -- Group to act on.
        """
        if isinstance(WR,(Integer,int)):
            #self.WR=WeilRepDiscriminantForm(WR)
            #self.WR=WeilModule(WR)
            self._weil_module = WeilModule(WR)
        elif hasattr(WR,"signature"):
            self._weil_module=WR
        else:
            raise ValueError,"{0} is not a Weil module!".format(WR)
        self._sym_type = 0

        if group.level() <>1:
            raise NotImplementedError,"Only Weil representations of SL2Z implemented!"
        self._group = MySubgroup(Gamma0(1))
        self._dual = int(dual)
        self._sgn = (-1)**self._dual
        self.Qv=[]
        self._weight = weight
        self._use_symmetry = use_symmetry
        self._kwargs = kwargs
        self._sgn = (-1)**int(dual)        
        half = QQ(1)/QQ(2)
        threehalf = QQ(3)/QQ(2)
        if use_symmetry:
            ## First find weight mod 2:
            twok= QQ(2)*QQ(weight)
            if not twok.is_integral():
                raise ValueError,"Only integral or half-integral weights implemented!"
            kmod2 = QQ(twok % 4)/QQ(2)
            if dual:
                sig_mod_4 = -self._weil_module.signature() % 4
            else:
                sig_mod_4 = self._weil_module.signature() % 4
            sym_type = 0
            if (kmod2,sig_mod_4) in [(half,1),(threehalf,3),(0,0),(1,2)]:
                sym_type = 1
            elif (kmod2,sig_mod_4) in [(half,3),(threehalf,1),(0,2),(1,0)]:
                sym_type = -1
            else:
                raise ValueError,"The Weil module with signature {0} is incompatible with the weight {1}!".format( self._weil_module.signature(),weight)
            ## Deven and Dodd contains the indices for the even and odd basis
            Deven=[]; Dodd=[]
            if sym_type==1:
                self._D = self._weil_module.even_submodule(indices=1)
            else: #sym_type==-1:
                self._D = self._weil_module.odd_submodule(indices=1)
            self._sym_type=sym_type
            dim = len(self._D)  #Dfinish-Dstart+1
        else:
            dim = len(self._weil_module.finite_quadratic_module().list())
            self._D = range(dim)
            self._sym_type=0
        if hasattr(self._weil_module,"finite_quadratic_module"):
#            for x in list(self._weil_module.finite_quadratic_module()):
            for x in self._weil_module.finite_quadratic_module():
                self.Qv.append(self._weil_module.finite_quadratic_module().Q(x))
        else:
            self.Qv=self._weil_module.Qv
        ambient_rank = self._weil_module.rank()
        MultiplierSystem.__init__(self,self._group,dual=dual,dimension=dim,ambient_rank=ambient_rank)
开发者ID:nilsskoruppa,项目名称:psage,代码行数:70,代码来源:multiplier_systems.py


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