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


Python PolynomialRing.degree方法代码示例

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


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

示例1: Polynomial_padic_capped_relative_dense

# 需要导入模块: from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing [as 别名]
# 或者: from sage.rings.polynomial.polynomial_ring_constructor.PolynomialRing import degree [as 别名]

#.........这里部分代码省略.........
            elif val != 0:
                self._relprecs = [max(prec - val,0) for prec in self._relprecs]
                v = [Integer(0) if (e is infinity) else ((c // prime_pow(val)) % prime_pow(e)) for (c,e) in zip(selflist, self._relprecs)]
                self._poly = self._poly.parent()(v, check=False)
                self._valbase += val
                self._valaddeds = [c - val for c in self._valaddeds]
            else:
                self._poly = self._poly.parent()([Integer(0) if (e is infinity) else (c % prime_pow(e)) for (c,e) in zip(selflist, self._relprecs)], check=False)
            self._normalized = True

    def _reduce_poly(self):
        selflist = self._poly.list()
        prime_pow = self.base_ring().prime_pow
        self._poly = self._poly.parent()([Integer(0) if (e is infinity) else (c % prime_pow(e)) for (c, e) in zip(selflist, self._relprecs)], check=False)

    def __reduce__(self):
        """
        For pickling.  This function is here because the relative precisions were getting screwed up for some reason.
        """
        return make_padic_poly, (self.parent(), (self._poly, self._valbase, self._relprecs, self._normalized, self._valaddeds, self._list), 0)

    def _comp_list(self):
        """
        Recomputes the list of coefficients.

        EXAMPLES:
        sage: K = Qp(13,7)
        sage: R.<t> = K[]
        sage: a = t[0:1]
        sage: a._comp_list()
        sage: a
        0
        """
        if self.degree() == -1 and self._valbase == infinity:
            self._list = []
            return self._list
        polylist = self._poly.list()
        polylen = len(polylist)
        self._list = [self.base_ring()(polylist[i], absprec = self._relprecs[i]) << self._valbase for i in range(polylen)] \
                     + [self.base_ring()(0, absprec = self._relprecs[i] + self._valbase) for i in range(polylen, len(self._relprecs))]
        while len(self._list) > 0 and self._list[-1]._is_exact_zero():
            self._list.pop()

    def _comp_valaddeds(self):
        self._valaddeds = []
        for i in range(self._poly.degree() + 1):
            tmp = self._poly.list()[i].valuation(self.parent().base_ring().prime())
            if tmp is infinity or tmp > self._relprecs[i]:
                self._valaddeds.append(self._relprecs[i])
            else:
                self._valaddeds.append(tmp)
        for i in range(self._poly.degree() + 1, len(self._relprecs)):
            self._valaddeds.append(self._relprecs[i])

    def _adjust_prec_info(self, absprec=infinity, relprec=infinity):
        r"""
        Assumes that self._poly, self._val and self._relprec are set initially and adjusts self._val and self._relprec to the termwise minimum of absprec and relprec.
        """
        return

#         min = sage.rings.padics.misc.min
#         slen = len(self._relprec)
#         if isinstance(absprec, list):
#             alen = len(absprec)
#         elif absprec is infinity:
#             alen = 0
开发者ID:chos9,项目名称:sage,代码行数:70,代码来源:polynomial_padic_capped_relative_dense.py

示例2: Polynomial_padic_capped_relative_dense

# 需要导入模块: from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing [as 别名]
# 或者: from sage.rings.polynomial.polynomial_ring_constructor.PolynomialRing import degree [as 别名]

#.........这里部分代码省略.........
                self._relprecs = [max(prec - val,0) for prec in self._relprecs]
                v = [Integer(0) if (e is infinity) else ((c // prime_pow(val)) % prime_pow(e)) for (c,e) in zip(selflist, self._relprecs)]
                self._poly = self._poly.parent()(v, check=False)
                self._valbase += val
                self._valaddeds = [c - val for c in self._valaddeds]
            else:
                self._poly = self._poly.parent()([Integer(0) if (e is infinity) else (c % prime_pow(e)) for (c,e) in zip(selflist, self._relprecs)], check=False)
            self._normalized = True

    def _reduce_poly(self):
        selflist = self._poly.list()
        prime_pow = self.base_ring().prime_pow
        self._poly = self._poly.parent()([Integer(0) if (e is infinity) else (c % prime_pow(e)) for (c, e) in zip(selflist, self._relprecs)], check=False)

    def __reduce__(self):
        """
        For pickling.  This function is here because the relative precisions were getting screwed up for some reason.
        """
        return make_padic_poly, (self.parent(), (self._poly, self._valbase, self._relprecs, self._normalized, self._valaddeds, self._list), 0)

    def _comp_list(self):
        """
        Recomputes the list of coefficients.

        EXAMPLES::

            sage: K = Qp(13,7)
            sage: R.<t> = K[]
            sage: a = t[0:1]
            sage: a._comp_list()
            sage: a
            0
        """
        if self.degree() == -1 and self._valbase == infinity:
            self._list = []
            return self._list
        polylist = self._poly.list()
        polylen = len(polylist)
        self._list = [self.base_ring()(polylist[i], absprec = self._relprecs[i]) << self._valbase for i in range(polylen)] \
                     + [self.base_ring()(0, absprec = self._relprecs[i] + self._valbase) for i in range(polylen, len(self._relprecs))]
        while len(self._list) > 0 and self._list[-1]._is_exact_zero():
            self._list.pop()

    def _comp_valaddeds(self):
        self._valaddeds = []
        for i in range(self._poly.degree() + 1):
            tmp = self._poly.list()[i].valuation(self.parent().base_ring().prime())
            if tmp is infinity or tmp > self._relprecs[i]:
                self._valaddeds.append(self._relprecs[i])
            else:
                self._valaddeds.append(tmp)
        for i in range(self._poly.degree() + 1, len(self._relprecs)):
            self._valaddeds.append(self._relprecs[i])

    def _adjust_prec_info(self, absprec=infinity, relprec=infinity):
        r"""
        Assumes that self._poly, self._val and self._relprec are set initially and adjusts self._val and self._relprec to the termwise minimum of absprec and relprec.
        """
        return

#         min = sage.rings.padics.misc.min
#         slen = len(self._relprec)
#         if isinstance(absprec, list):
#             alen = len(absprec)
#         elif absprec is infinity:
#             alen = 0
开发者ID:Findstat,项目名称:sage,代码行数:70,代码来源:polynomial_padic_capped_relative_dense.py


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