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


Python sage_object.register_unpickle_override函数代码示例

本文整理汇总了Python中sage.structure.sage_object.register_unpickle_override函数的典型用法代码示例。如果您正苦于以下问题:Python register_unpickle_override函数的具体用法?Python register_unpickle_override怎么用?Python register_unpickle_override使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: action

        There is no coercion for additive groups since ``+`` could mean
        both the action (i.e., the group operation) or adding a term::

            sage: G = groups.misc.AdditiveCyclic(3)
            sage: ZG = G.algebra(ZZ, category=AdditiveMagmas())
            sage: ZG.has_coerce_map_from(G)
            False
        """
        G = self.basis().keys()
        K = self.base_ring()

        if G.has_coerce_map_from(S):
            from sage.categories.groups import Groups
            # No coercion for additive groups because of ambiguity of +
            #   being the group action or addition of a new term.
            return self.category().is_subcategory(Groups().Algebras(K))

        if S in Sets.Algebras:
            S_K = S.base_ring()
            S_G = S.basis().keys()
            hom_K = K.coerce_map_from(S_K)
            hom_G = G.coerce_map_from(S_G)
            if hom_K is not None and hom_G is not None:
                return SetMorphism(S.Hom(self, category=self.category() | S.category()),
                                   lambda x: self.sum_of_terms( (hom_G(g), hom_K(c)) for g,c in x ))

from sage.structure.sage_object import register_unpickle_override
register_unpickle_override('sage.algebras.group_algebras', 'GroupAlgebra',  GroupAlgebra_class)

开发者ID:saraedum,项目名称:sage-renamed,代码行数:28,代码来源:group_algebra.py

示例2: Sequence

            sage: a = P.base_ring().gen()
            sage: F = Sequence([x*y + 1, a*x + 1], P)
            sage: F2 = F.weil_restriction()
            sage: F2
            [x1*y0 + x0*y1 + x1*y1,
             x0*y0 + x1*y1 + 1,
             x0 + x1,
             x1 + 1,
             x0^2 + x0,
             x1^2 + x1,
             y0^2 + y0,
             y1^2 + y1]

        Another bigger example for a small scale AES::

           sage: sr = mq.SR(1,1,1,4,gf2=False)
           sage: F,s = sr.polynomial_system(); F
           Polynomial Sequence with 40 Polynomials in 20 Variables
           sage: F2 = F.weil_restriction(); F2
           Polynomial Sequence with 240 Polynomials in 80 Variables
        """
        from sage.rings.ideal import FieldIdeal
        J = self.ideal().weil_restriction()
        J += FieldIdeal(J.ring())
        return PolynomialSequence(J)

from sage.structure.sage_object import register_unpickle_override
register_unpickle_override("sage.crypto.mq.mpolynomialsystem","MPolynomialSystem_generic", PolynomialSequence_generic)
register_unpickle_override("sage.crypto.mq.mpolynomialsystem","MPolynomialRoundSystem_generic", PolynomialSequence_generic)

开发者ID:NitikaAgarwal,项目名称:sage,代码行数:29,代码来源:multi_polynomial_sequence.py

示例3: QQ

            data = QQ(data).continued_fraction_list()
        else:
            from .continued_fraction import check_and_reduce_pair
            data,_ = check_and_reduce_pair(data, [])
        return self.element_class(data)

    def _coerce_map_from_(self, R):
        r"""
        Return True for ZZ and QQ.

        EXAMPLES::

            sage: CFF.has_coerce_map_from(ZZ) # indirect doctest
            True
            sage: CFF.has_coerce_map_from(QQ)
            True
            sage: CFF.has_coerce_map_from(RR)
            False
        """
        from sage.rings.integer_ring import ZZ
        from sage.rings.rational_field import QQ
        return R is ZZ or R is QQ

CFF = ContinuedFractionField()

# Unpickling support is needed as the class ContinuedFractionField_class has
# been renamed into ContinuedFractionField in the ticket 14567
from sage.structure.sage_object import register_unpickle_override
register_unpickle_override('sage.rings.contfrac', 'ContinuedFractionField_class',ContinuedFractionField)

开发者ID:drupel,项目名称:sage,代码行数:29,代码来源:contfrac.py

示例4: SFAHomogeneous

            variables.
        
            EXAMPLES::
            
                sage: h = SFAHomogeneous(QQ)
                sage: h([3]).expand(2)
                x0^3 + x0^2*x1 + x0*x1^2 + x1^3
                sage: h([1,1,1]).expand(2)
                x0^3 + 3*x0^2*x1 + 3*x0*x1^2 + x1^3
                sage: h([2,1]).expand(3)
                x0^3 + 2*x0^2*x1 + 2*x0*x1^2 + x1^3 + 2*x0^2*x2 + 3*x0*x1*x2 + 2*x1^2*x2 + 2*x0*x2^2 + 2*x1*x2^2 + x2^3
                sage: h([3]).expand(2,alphabet='y')
                y0^3 + y0^2*y1 + y0*y1^2 + y1^3
                sage: h([3]).expand(2,alphabet='x,y')
                x^3 + x^2*y + x*y^2 + y^3
                sage: h([3]).expand(3,alphabet='x,y,z')
                x^3 + x^2*y + x*y^2 + y^3 + x^2*z + x*y*z + y^2*z + x*z^2 + y*z^2 + z^3
            """
            condition = lambda part: False
            return self._expand(condition, n, alphabet)


# Backward compatibility for unpickling
from sage.structure.sage_object import register_unpickle_override

register_unpickle_override(
    "sage.combinat.sf.homogeneous",
    "SymmetricFunctionAlgebraElement_homogeneous",
    SymmetricFunctionAlgebra_homogeneous.Element,
)
开发者ID:jtmurphy89,项目名称:sagelib,代码行数:30,代码来源:homogeneous.py

示例5: range

        ret = "\\draw (0 cm,0) -- (%s cm,0);\n" % ((n - 2) * node_dist)
        ret += "\\draw (%s cm, 0.1 cm) -- +(%s cm,0);\n" % ((n - 2) * node_dist, node_dist)
        ret += "\\draw (%s cm, -0.1 cm) -- +(%s cm,0);\n" % ((n - 2) * node_dist, node_dist)
        if dual:
            ret += self._latex_draw_arrow_tip((n - 1.5) * node_dist - 0.2, 0, 180)
        else:
            ret += self._latex_draw_arrow_tip((n - 1.5) * node_dist + 0.2, 0, 0)
        for i in range(self.n):
            ret += node(i * node_dist, 0, label(i + 1))
        return ret

    def _default_folded_cartan_type(self):
        """
        Return the default folded Cartan type.

        EXAMPLES::

            sage: CartanType(['B', 3])._default_folded_cartan_type()
            ['B', 3] as a folding of ['D', 4]
        """
        from sage.combinat.root_system.type_folded import CartanTypeFolded

        n = self.n
        return CartanTypeFolded(self, ["D", n + 1], [[i] for i in range(1, n)] + [[n, n + 1]])


# For unpickling backward compatibility (Sage <= 4.1)
from sage.structure.sage_object import register_unpickle_override

register_unpickle_override("sage.combinat.root_system.type_B", "ambient_space", AmbientSpace)
开发者ID:sampadsaha5,项目名称:sage,代码行数:30,代码来源:type_B.py

示例6: hash

            sage: del S._Sequence_generic__hash
            sage: hash(S)
            Traceback (most recent call last):
            ...
            AttributeError: 'Sequence_generic' object has no attribute '_Sequence_generic__hash'
            sage: S._Sequence__hash = 34
            sage: hash(S)
            34
        """
        if name == "_Sequence_generic__cr" and hasattr(self,"_Sequence__cr"):
            self.__cr = self._Sequence__cr
            return self.__cr
        elif name == "_Sequence_generic__cr_str" and hasattr(self,"_Sequence__cr_str"):
            self.__cr_str = self._Sequence__cr_str
            return self.__cr_str
        elif name == "_Sequence_generic__immutable" and hasattr(self,"_Sequence__immutable"):
            self.__immutable = self._Sequence__immutable
            return self.__immutable
        elif name == "_Sequence_generic__universe" and hasattr(self,"_Sequence__universe"):
            self.__universe = self._Sequence__universe
            return self.__universe
        elif name == "_Sequence_generic__hash" and hasattr(self,"_Sequence__hash"):
            self.__hash = self._Sequence__hash
            return self.__hash
        else:
            raise AttributeError("'Sequence_generic' object has no attribute '%s'"%name)
seq = Sequence

from sage.structure.sage_object import register_unpickle_override
register_unpickle_override('sage.structure.sequence', 'Sequence', Sequence_generic)
开发者ID:CETHop,项目名称:sage,代码行数:30,代码来源:sequence.py

示例7: Traceback

            Integer Ring
            sage: Hom.base_extend(QQ)
            Traceback (most recent call last):
            ...
            NotImplementedError: Abelian variety point sets are not 
            implemented as modules over rings other than ZZ.
        """
        if R is not ZZ:
            raise NotImplementedError('Abelian variety point sets are not '
                            'implemented as modules over rings other than ZZ.')
        return self
    

from sage.structure.sage_object import register_unpickle_override 
register_unpickle_override('sage.schemes.generic.homset', 
                           'SchemeHomsetModule_abelian_variety_coordinates_field', 
                           SchemeHomset_points_abelian_variety_field) 

#*******************************************************************
# Toric varieties
#*******************************************************************
class SchemeHomset_points_toric_field(SchemeHomset_points):
    """
    Set of rational points of a toric variety.

    INPUT:

    - same as for :class:`SchemeHomset_points`.

    OUPUT:
开发者ID:dagss,项目名称:sage,代码行数:30,代码来源:homset.py

示例8: deprecation

    """
    For old pickles of ``MonotoneTriangles_n``.

    EXAMPLES::

        sage: sage.combinat.alternating_sign_matrix.MonotoneTriangles_n(3)
        doctest:...: DeprecationWarning: this class is deprecated. Use sage.combinat.alternating_sign_matrix.MonotoneTriangles instead
        See http://trac.sagemath.org/14301 for details.
        Monotone triangles with 3 rows
    """
    from sage.misc.superseded import deprecation
    deprecation(14301,'this class is deprecated. Use sage.combinat.alternating_sign_matrix.MonotoneTriangles instead')
    return MonotoneTriangles(n)

from sage.structure.sage_object import register_unpickle_override
register_unpickle_override('sage.combinat.alternating_sign_matrix', 'AlternatingSignMatrices_n', AlternatingSignMatrices)
register_unpickle_override('sage.combinat.alternating_sign_matrix', 'MonotoneTriangles_n', MonotoneTriangles)
register_unpickle_override('sage.combinat.alternating_sign_matrix', 'MonotoneTriangles_n', MonotoneTriangles_n)

# Here are the previous implementations of the combinatorial structure
# of the alternating sign matrices. Please, consider it obsolete and
# tend to use the monotone triangles instead.

def from_contre_tableau(comps):
    r"""
    Returns an alternating sign matrix from a contre-tableau.

    EXAMPLES::

        sage: import sage.combinat.alternating_sign_matrix as asm
        sage: asm.from_contre_tableau([[1, 2, 3], [1, 2], [1]])
开发者ID:odellus,项目名称:sage,代码行数:31,代码来源:alternating_sign_matrix.py

示例9: Integers

        EXAMPLE::

            sage: R = Integers(12345678900)
            sage: R.degree()
            1
        """
        return integer.Integer(1)

Zmod = IntegerModRing
Integers = IntegerModRing

# Register unpickling methods for backward compatibility.

from sage.structure.sage_object import register_unpickle_override
register_unpickle_override('sage.rings.integer_mod_ring', 'IntegerModRing_generic', IntegerModRing_generic)

## def GF(p):
##     """
##     EXAMPLES:
##         sage: F = GF(11)
##         sage: F
##         Finite field of size 11
##     """
##     if not arith.is_prime(p):
##         raise NotImplementedError, "Only prime fields currently implemented."
##     return IntegerModRing(p)

def crt(v):
    """
    INPUT: v - (list) a lift of elements of rings.IntegerMod(n), for
开发者ID:CETHop,项目名称:sage,代码行数:30,代码来源:integer_mod_ring.py

示例10: range

            pos = 0  #Double check this
            restmp = [ S.from_shape_and_word(parts[0], [l[k][j] for j in range(s[0])]) ]
            for i in range(1, len(parts)):
                w = [l[k][j] for j in range(pos+s[i-1], pos+s[i-1]+s[i])]
                restmp.append( S.from_shape_and_word(parts[i], w) )
            yield self.element_class(self, restmp)

class RibbonTableau_class(RibbonTableau):
    """
    This exists solely for unpickling ``RibbonTableau_class`` objects.
    """
    def __setstate__(self, state):
        r"""
        Unpickle old ``RibbonTableau_class`` objects.

        TESTS::

            sage: loads('x\x9c5\xcc\xbd\x0e\xc2 \[email protected]\xe1\xb4Z\x7f\xd0\x07\xc1\x85D}\x8f\x0e\x8d\x1d\t\xb9\x90\x1bJ\xa44\x17\xe8h\xa2\x83\xef-\xda\xb8\x9do9\xcf\xda$\xb0(\xcc4j\x17 \x8b\xe8\xb4\x9e\x82\xca\xa0=\xc2\xcc\xba\x1fo\x8b\x94\xf1\x90\x12\xa3\xea\xf4\xa2\xfaA+\xde7j\x804\xd0\xba-\xe5]\xca\xd4H\xdapI[\xde.\xdf\xe8\x82M\xc2\x85\x8c\x16#\x1b\xe1\x8e\xea\x0f\xda\xf5\xd5\xf9\xdd\xd1\x1e%1>\x14]\x8a\x0e\xdf\xb8\x968"\xceZ|\x00x\xef5\x11')
            [[None, 1], [2, 3]]
            sage: loads(dumps( RibbonTableau([[None, 1],[2,3]]) ))
            [[None, 1], [2, 3]]
        """
        self.__class__ = RibbonTableau
        self.__init__(RibbonTableaux(), state['_list'])

from sage.structure.sage_object import register_unpickle_override
register_unpickle_override('sage.combinat.ribbon_tableau', 'RibbonTableau_class', RibbonTableau_class)
register_unpickle_override('sage.combinat.ribbon_tableau', 'RibbonTableaux_shapeweightlength', RibbonTableaux)
register_unpickle_override('sage.combinat.ribbon_tableau', 'SemistandardMultiSkewTtableaux_shapeweight', SemistandardMultiSkewTableaux)

开发者ID:drupel,项目名称:sage,代码行数:29,代码来源:ribbon_tableau.py

示例11: deprecation

    """
    EXAMPLES::

        sage: sage.combinat.skew_tableau.SemistandardSkewTableaux_pmu([[2,1],[]],[2,1])
        doctest:1: DeprecationWarning: this class is deprecated. Use SemistandardSkewTableaux_shape_weight instead
        See http://trac.sagemath.org/9265 for details.
        Semistandard skew tableaux of shape [[2, 1], []] and weight [2, 1]
    """
    deprecation(9265,'this class is deprecated. Use SemistandardSkewTableaux_shape_weight instead')
    return SemistandardSkewTableaux_shape_weight(*args, **kargs)

def StandardSkewTableaux_n(*args, **kargs):
    """
    EXAMPLES::

        sage: sage.combinat.skew_tableau.StandardSkewTableaux_n(2)
        doctest:1: DeprecationWarning: this class is deprecated. Use StandardSkewTableaux_size instead
        See http://trac.sagemath.org/9265 for details.
        Standard skew tableaux of size 2
    """
    deprecation(9265,'this class is deprecated. Use StandardSkewTableaux_size instead')
    return StandardSkewTableaux(*args, **kargs)

# October 2012: fixing outdated pickles which use the classes being deprecated
from sage.structure.sage_object import register_unpickle_override
register_unpickle_override('sage.combinat.skew_tableau', 'StandardSkewTableaux_n',  StandardSkewTableaux_size)
register_unpickle_override('sage.combinat.skew_tableau', 'SemistandardSkewTableaux_n',  SemistandardSkewTableaux_size)
register_unpickle_override('sage.combinat.skew_tableau', 'SemistandardSkewTableaux_nmu',  SemistandardSkewTableaux_size_weight)
register_unpickle_override('sage.combinat.skew_tableau', 'SemistandardSkewTableaux_p',  SemistandardSkewTableaux_shape)
register_unpickle_override('sage.combinat.skew_tableau', 'SemistandardSkewTableaux_pmu',  SemistandardSkewTableaux_shape_weight)
开发者ID:odellus,项目名称:sage,代码行数:30,代码来源:skew_tableau.py

示例12: expansion

            INPUT:

            - ``self`` -- an element of the symmetric functions in a dual basis
            - ``n`` -- a positive integer
            - ``alphabet`` -- a variable for the expansion (default: `x`)

            OUTPUT:

            - a monomial expansion of an instance of dual of ``self`` in `n` variable

            EXAMPLES::

                sage: m = SymmetricFunctions(QQ).monomial()
                sage: zee = sage.combinat.sf.sfa.zee
                sage: h = m.dual_basis(zee)
                sage: a = h([2,1])+h([3])
                sage: a.expand(2)
                2*x0^3 + 3*x0^2*x1 + 3*x0*x1^2 + 2*x1^3
                sage: a.dual().expand(2)
                2*x0^3 + 3*x0^2*x1 + 3*x0*x1^2 + 2*x1^3
                sage: a.expand(2,alphabet='y')
                2*y0^3 + 3*y0^2*y1 + 3*y0*y1^2 + 2*y1^3
                sage: a.expand(2,alphabet='x,y')
                2*x^3 + 3*x^2*y + 3*x*y^2 + 2*y^3
            """
            return self._dual.expand(n, alphabet)

# Backward compatibility for unpickling
from sage.structure.sage_object import register_unpickle_override
register_unpickle_override('sage.combinat.sf.dual', 'SymmetricFunctionAlgebraElement_dual',  SymmetricFunctionAlgebra_dual.Element)
开发者ID:sageb0t,项目名称:testsage,代码行数:30,代码来源:dual.py

示例13: len

            yield cur + [zero] * (len(l) - len(cur))
        elif cur[-1] < zero or rem < zero:
            rem += cur.pop() * l[k]
            k -= 1
        elif len(l) == len(cur) + 1:
            if rem % l[-1] == zero:
                yield cur + [rem // l[-1]]
        else:
            k += 1
            cur.append(rem // l[k] + one)
            rem -= cur[-1] * l[k]


def WeightedIntegerVectors_nweight(n, weight):
    """
    Deprecated in :trac:`12453`. Use :class:`WeightedIntegerVectors` instead.

    EXAMPLES::

        sage: sage.combinat.integer_vector_weighted.WeightedIntegerVectors_nweight(7, [2,2])
        doctest:...: DeprecationWarning: this class is deprecated. Use WeightedIntegerVectors instead
        See http://trac.sagemath.org/12453 for details.
        Integer vectors of 7 weighted by [2, 2]
    """
    from sage.misc.superseded import deprecation
    deprecation(12453, 'this class is deprecated. Use WeightedIntegerVectors instead')
    return WeightedIntegerVectors(n, weight)

from sage.structure.sage_object import register_unpickle_override
register_unpickle_override('sage.combinat.integer_vector_weighted', 'WeightedIntegerVectors_nweight', WeightedIntegerVectors)
开发者ID:mcognetta,项目名称:sage,代码行数:30,代码来源:integer_vector_weighted.py

示例14: SpecFunctor

            sage: from sage.schemes.generic.spec import SpecFunctor
            sage: F = SpecFunctor(GF(7))
            sage: A.<x, y> = GF(7)[]
            sage: B.<t> = GF(7)[]
            sage: f = A.hom((t^2, t^3))
            sage: Spec(f) # indirect doctest
            Affine Scheme morphism:
              From: Spectrum of Univariate Polynomial Ring in t over Finite Field of size 7
              To:   Spectrum of Multivariate Polynomial Ring in x, y over Finite Field of size 7
              Defn: Ring morphism:
                     From: Multivariate Polynomial Ring in x, y over Finite Field of size 7
                     To:   Univariate Polynomial Ring in t over Finite Field of size 7
                     Defn: x |--> t^2
                           y |--> t^3
        """
        A = f.domain()
        B = f.codomain()
        return self(B).hom(f, self(A))


SpecZ = Spec(ZZ)


# Compatibility with older versions of this module

from sage.misc.superseded import deprecated_function_alias
is_Spec = deprecated_function_alias(16158, is_AffineScheme)

from sage.structure.sage_object import register_unpickle_override
register_unpickle_override('sage.schemes.generic.spec', 'Spec', AffineScheme)
开发者ID:Etn40ff,项目名称:sage,代码行数:30,代码来源:spec.py

示例15: range

            yield self.element_class(self, [Set(res[dcomp[i]+1:dcomp[i+1]+1])
                                            for i in range(l)])

##########################################################
# Deprecations


class SplitNK(OrderedSetPartitions_scomp):
    def __setstate__(self, state):
        r"""
        For unpickling old ``SplitNK`` objects.

        TESTS::

            sage: loads("x\x9ck`J.NLO\xd5K\xce\xcfM\xca\xccK,\xd1+.\xc8\xc9,"
            ....:   "\x89\xcf\xcb\xe6\n\x061\xfc\xbcA\xccBF\xcd\xc6B\xa6\xda"
            ....:   "Bf\x8dP\xa6\xf8\xbcB\x16\x88\x96\xa2\xcc\xbc\xf4b\xbd\xcc"
            ....:   "\xbc\x92\xd4\xf4\xd4\"\xae\xdc\xc4\xec\xd4x\x18\xa7\x905"
            ....:   "\x94\xd1\xb45\xa8\x90\r\xa8>\xbb\x90=\x03\xc85\x02r9J\x93"
            ....:   "\xf4\x00\xb4\xc6%f")
            Ordered set partitions of {0, 1, 2, 3, 4} into parts of size [2, 3]
        """
        self.__class__ = OrderedSetPartitions_scomp
        n = state['_n']
        k = state['_k']
        OrderedSetPartitions_scomp.__init__(self, range(state['_n']), (k,n-k))

from sage.structure.sage_object import register_unpickle_override
register_unpickle_override("sage.combinat.split_nk", "SplitNK_nk", SplitNK)

开发者ID:Findstat,项目名称:sage,代码行数:29,代码来源:set_partition_ordered.py


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