Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
#***************************************************************************** # Copyright (C) 2005 William Stein <wstein@gmail.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # http://www.gnu.org/licenses/ #*****************************************************************************
from sage.libs.gmp.mpz cimport mpz_get_si include 'misc.pxi' include 'decl.pxi'
from sage.rings.integer cimport Integer
zz_pContextDict = {}
cdef class ntl_zz_pContext_class(object): def __init__(self, long v): """ EXAMPLES: # You can construct contexts manually. sage: c = ntl.zz_pContext(11) sage: n1 = ntl.zz_p(12,c) sage: n1 1
# or You can construct contexts implicitly. sage: n2=ntl.zz_p(12, 7) sage: n2 5 sage: ntl.zz_p(2,3)+ntl.zz_p(1,3) 0 sage: n2+n1 # Mismatched moduli: It will go BOOM! Traceback (most recent call last): ... ValueError: arithmetic operands must have the same modulus. """ pass
def __cinit__(self, long v): raise ValueError("Modulus (=%s) is too big" % v)
def __reduce__(self): """ sage: c=ntl.zz_pContext(13) sage: loads(dumps(c)) is c True """
def modulus(self): """ Print the modulus for self.
EXAMPLES: sage: c1 = ntl.zz_pContext(36) sage: c1.modulus() 36 """
def restore(self): """ Restore a zz_pContext.
EXAMPLES: sage: c = ntl.zz_pContext(5) sage: m = ntl.zz_p(4,7) sage: c.restore() """
cdef void restore_c(self): """ Actual code for the above.
EXAMPLES: sage: n = ntl.zz_p(3,5) sage: m = ntl.zz_p(4,7) sage: n*n ## indirect doctest 4 """
def ntl_zz_pContext( v ): """ Creation function for a zz_p context.
EXAMPLES: sage: f = ntl.zz_pContext(26) sage: f = ntl.zz_pContext(10^100) Traceback (most recent call last): ... ValueError: Modulus (=10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) is too big """ |