def __init__(self, p, prec, print_mode, names, element_class):
        """
        Initialization

        TESTS::

            sage: R = Zp(5) #indirect doctest
        """
        if self.is_relaxed():
            from sage.rings.padics.pow_computer_flint import PowComputer_flint
            self.prime_pow = PowComputer_flint(p, 1, 1, 1, self.is_field())
        else:
            self.prime_pow = PowComputer(p, max(min(prec - 1, 30), 1), prec,
                                         self.is_field(), self._prec_type())
        pAdicGeneric.__init__(self, self, p, prec, print_mode, names,
                              element_class)
        if self.is_field():
            if self.is_capped_relative():
                coerce_list = [
                    pAdicCoercion_ZZ_CR(self),
                    pAdicCoercion_QQ_CR(self)
                ]
                convert_list = []
            elif self.is_floating_point():
                coerce_list = [
                    pAdicCoercion_ZZ_FP(self),
                    pAdicCoercion_QQ_FP(self)
                ]
                convert_list = []
            elif self.is_lattice_prec():
                coerce_list = [QQ]
                convert_list = []
            elif self.is_relaxed():
                coerce_list = [QQ]
                convert_list = []
            else:
                raise RuntimeError
        elif self.is_capped_relative():
            coerce_list = [pAdicCoercion_ZZ_CR(self)]
            convert_list = [pAdicConvert_QQ_CR(self)]
        elif self.is_capped_absolute():
            coerce_list = [pAdicCoercion_ZZ_CA(self)]
            convert_list = [pAdicConvert_QQ_CA(self)]
        elif self.is_fixed_mod():
            coerce_list = [pAdicCoercion_ZZ_FM(self)]
            convert_list = [pAdicConvert_QQ_FM(self)]
        elif self.is_floating_point():
            coerce_list = [pAdicCoercion_ZZ_FP(self)]
            convert_list = [pAdicConvert_QQ_FP(self)]
        elif self.is_lattice_prec():
            coerce_list = [ZZ]
            convert_list = [QQ]
        elif self.is_relaxed():
            coerce_list = [ZZ]
            convert_list = [QQ]
        else:
            raise RuntimeError
        self.Element = element_class
        self._populate_coercion_lists_(coerce_list=coerce_list,
                                       convert_list=convert_list)
예제 #2
0
    def __init__(self, p, prec, print_mode, names, element_class):
        """
        Initialization

        TESTS::

            sage: R = Zp(5) #indirect doctest
        """
        self.prime_pow = PowComputer(p, max(min(prec - 1, 30), 1), prec, self.is_field(), self._prec_type())
        pAdicGeneric.__init__(self, self, p, prec, print_mode, names, element_class)
        if self.is_field():
            if self.is_capped_relative():
                coerce_list = [pAdicCoercion_ZZ_CR(self), pAdicCoercion_QQ_CR(self)]
                convert_list = []
            else:
                coerce_list = [pAdicCoercion_ZZ_FP(self), pAdicCoercion_QQ_FP(self)]
                convert_list = []
        elif self.is_capped_relative():
            coerce_list = [pAdicCoercion_ZZ_CR(self)]
            convert_list = [pAdicConvert_QQ_CR(self)]
        elif self.is_capped_absolute():
            coerce_list = [pAdicCoercion_ZZ_CA(self)]
            convert_list = [pAdicConvert_QQ_CA(self)]
        elif self.is_fixed_mod():
            coerce_list = [pAdicCoercion_ZZ_FM(self)]
            convert_list = [pAdicConvert_QQ_FM(self)]
        elif self.is_floating_point():
            coerce_list = [pAdicCoercion_ZZ_FP(self)]
            convert_list = [pAdicConvert_QQ_FP(self)]
        else:
            raise RuntimeError
        self._populate_coercion_lists_(coerce_list=coerce_list, convert_list=convert_list, element_constructor=element_class)
예제 #3
0
    def __init__(self, p, prec, print_mode, names, element_class):
        """
        Initialization

        TESTS::

            sage: R = Zp(5) #indirect doctest
        """
        self.prime_pow = PowComputer(p, max(min(prec - 1, 30), 1), prec,
                                     self.is_field(), self._prec_type())
        pAdicGeneric.__init__(self, self, p, prec, print_mode, names,
                              element_class)
        if self.is_field():
            coerce_list = [
                pAdicCoercion_ZZ_CR(self),
                pAdicCoercion_QQ_CR(self)
            ]
            convert_list = []
        elif self.is_capped_relative():
            coerce_list = [pAdicCoercion_ZZ_CR(self)]
            convert_list = [pAdicConvert_QQ_CR(self)]
        elif self.is_capped_absolute():
            coerce_list = [pAdicCoercion_ZZ_CA(self)]
            convert_list = [pAdicConvert_QQ_CA(self)]
        elif self.is_fixed_mod():
            coerce_list = [pAdicCoercion_ZZ_FM(self)]
            convert_list = [pAdicConvert_QQ_FM(self)]
        else:
            raise RuntimeError
        self._populate_coercion_lists_(coerce_list=coerce_list,
                                       convert_list=convert_list,
                                       element_constructor=element_class)