Ticket #1810: finite_field_refactor_doc.patch

File finite_field_refactor_doc.patch, 46.8 KB (added by Martin Albrecht, 15 years ago)
  • sage/coding/guava.py

    # HG changeset patch
    # User Martin Albrecht <malb@informatik.uni-bremen.de>
    # Date 1200604969 0
    # Node ID 2e1a3b3eddf22640d6e6a335b0f42ab70b215f43
    # Parent  c320674b52c4c03cfe9432e46252e4f4eaa92097
    refactoring to clean up finite field documentation reference manual
    
    diff -r c320674b52c4 -r 2e1a3b3eddf2 sage/coding/guava.py
    a b from sage.interfaces.all import gap 
    2323from sage.interfaces.all import gap
    2424from sage.misc.preparser import *
    2525from sage.matrix.matrix_space import MatrixSpace
    26 from sage.rings.finite_field import *
     26from sage.rings.finite_field import FiniteField as GF
     27from sage.interfaces.gap import gfq_gap_to_sage
    2728from sage.groups.perm_gps.permgroup import *
    2829from sage.misc.sage_eval import sage_eval
    2930from sage.misc.misc import prod, add
    def HammingCode(r,F): 
    7778    gap.eval("G:=GeneratorMat(C)")
    7879    k = eval(gap.eval("Length(G)"))
    7980    n = eval(gap.eval("Length(G[1])"))
    80     G = [[gap_to_sage(gap.eval("G["+str(i)+"]["+str(j)+"]"),F) for j in range(1,n+1)] for i in range(1,k+1)]
     81    G = [[gfq_gap_to_sage(gap.eval("G["+str(i)+"]["+str(j)+"]"),F) for j in range(1,n+1)] for i in range(1,k+1)]
    8182    MS = MatrixSpace(F,k,n)
    8283    return LinearCode(MS(G))
    8384   
    def QuadraticResidueCode(n,F): 
    111112    gap.eval("G:=GeneratorMat(C)")
    112113    k = eval(gap.eval("Length(G)"))
    113114    n = eval(gap.eval("Length(G[1])"))
    114     G = [[gap_to_sage(gap.eval("G["+str(i)+"]["+str(j)+"]"),F) for j in range(1,n+1)] for i in range(1,k+1)]
     115    G = [[gfq_gap_to_sage(gap.eval("G["+str(i)+"]["+str(j)+"]"),F) for j in range(1,n+1)] for i in range(1,k+1)]
    115116    MS = MatrixSpace(F,k,n)
    116117    return LinearCode(MS(G))
    117118
    def ExtendedQuadraticResidueCode(n,F): 
    146147    gap.eval("G:=GeneratorMat(XC)")
    147148    k = eval(gap.eval("Length(G)"))
    148149    n = eval(gap.eval("Length(G[1])"))
    149     G = [[gap_to_sage(gap.eval("G["+str(i)+"]["+str(j)+"]"),F) for j in range(1,n+1)] for i in range(1,k+1)]
     150    G = [[gfq_gap_to_sage(gap.eval("G["+str(i)+"]["+str(j)+"]"),F) for j in range(1,n+1)] for i in range(1,k+1)]
    150151    MS = MatrixSpace(F,k,n)
    151152    return LinearCode(MS(G))
    152153
    def QuasiQuadraticResidueCode(p): 
    184185    gap.eval("G:=GeneratorMat(C)")
    185186    k = eval(gap.eval("Length(G)"))
    186187    n = eval(gap.eval("Length(G[1])"))
    187     G = [[gap_to_sage(gap.eval("G["+str(i)+"]["+str(j)+"]"),F) for j in range(1,n+1)] for i in range(1,k+1)]
     188    G = [[gfq_gap_to_sage(gap.eval("G["+str(i)+"]["+str(j)+"]"),F) for j in range(1,n+1)] for i in range(1,k+1)]
    188189    MS = MatrixSpace(F,k,n)
    189190    return LinearCode(MS(G))
    190191
    def BinaryReedMullerCode(r,k): 
    229230    gap.eval("G:=GeneratorMat(C)")
    230231    k = eval(gap.eval("Length(G)"))
    231232    n = eval(gap.eval("Length(G[1])"))
    232     G = [[gap_to_sage(gap.eval("G["+str(i)+"]["+str(j)+"]"),F) for j in range(1,n+1)] for i in range(1,k+1)]
     233    G = [[gfq_gap_to_sage(gap.eval("G["+str(i)+"]["+str(j)+"]"),F) for j in range(1,n+1)] for i in range(1,k+1)]
    233234    MS = MatrixSpace(F,k,n)
    234235    return LinearCode(MS(G))
    235236
    def RandomLinearCodeGuava(n,k,F): 
    261262    gap.eval("G:=GeneratorMat(C)")
    262263    k = eval(gap.eval("Length(G)"))
    263264    n = eval(gap.eval("Length(G[1])"))
    264     G = [[gap_to_sage(gap.eval("G["+str(i)+"]["+str(j)+"]"),F) for j in range(1,n+1)] for i in range(1,k+1)]
     265    G = [[gfq_gap_to_sage(gap.eval("G["+str(i)+"]["+str(j)+"]"),F) for j in range(1,n+1)] for i in range(1,k+1)]
    265266    MS = MatrixSpace(F,k,n)
    266267    return LinearCode(MS(G))
    267268
    def CyclicCode(g,n,F): 
    291292    gap.eval("G:=GeneratorMat(C)")
    292293    k = eval(gap.eval("Length(G)"))
    293294    n1 = eval(gap.eval("Length(G[1])"))
    294     G = [[gap_to_sage(gap.eval("G["+str(i)+"]["+str(j)+"]"),F) for j in range(1,n1+1)] for i in range(1,k+1)]
     295    G = [[gfq_gap_to_sage(gap.eval("G["+str(i)+"]["+str(j)+"]"),F) for j in range(1,n1+1)] for i in range(1,k+1)]
    295296    MS = MatrixSpace(F,k,n1)
    296297    return LinearCode(MS(G))
  • sage/coding/linear_code.py

    diff -r c320674b52c4 -r 2e1a3b3eddf2 sage/coding/linear_code.py
    a b import sage.modules.module as module 
    174174import sage.modules.module as module
    175175import sage.modules.free_module_element as fme
    176176from sage.interfaces.all import gap
    177 from sage.rings.finite_field import GF
     177from sage.rings.finite_field import FiniteField as GF
    178178from sage.groups.perm_gps.permgroup import PermutationGroup
    179179from sage.matrix.matrix_space import MatrixSpace
    180180from sage.rings.arith import GCD, rising_factorial, binomial
    def min_wt_vec(Gmat,F): 
    257257
    258258    AUTHOR: David Joyner (11-2005)
    259259    """
    260     from sage.rings.finite_field import gap_to_sage
     260    from sage.interfaces.gap import gfq_gap_to_sage
    261261    gap.eval("G:="+Gmat)
    262262    k = int(gap.eval("Length(G)"))
    263263    q = F.order()
    def min_wt_vec(Gmat,F): 
    265265    C = gap(Gmat).GeneratorMatCode(F)
    266266    n = int(C.WordLength())
    267267    cg = C.MinimumDistanceCodeword()
    268     c = [gap_to_sage(cg[j],F) for j in range(1,n+1)]
     268    c = [gfq_gap_to_sage(cg[j],F) for j in range(1,n+1)]
    269269    V = VectorSpace(F,n)
    270270    return V(c)
    271271    ## this older code returns more info but may be slower:
    class LinearCode(module.Module): 
    493493            False
    494494
    495495        """
    496         from sage.rings.finite_field import gap_to_sage
     496        from sage.interfaces.gap import gfq_gap_to_sage
    497497        F = self.base_ring()
    498498        q = F.order()
    499499        G = self.gen_mat()
    500500        n = len(G.columns())
    501501        Cg = gap(G).GeneratorMatCode(F)
    502502        c = Cg.Random()
    503         ans = [gap_to_sage(c[i],F) for i in range(1,n+1)]
     503        ans = [gfq_gap_to_sage(c[i],F) for i in range(1,n+1)]
    504504        V = VectorSpace(F,n)
    505505        return V(ans)
    506506   
    class LinearCode(module.Module): 
    701701
    702702        Does not work for very long codes since the syndrome table grows too large.
    703703        """
    704         from sage.rings.finite_field import gap_to_sage
     704        from sage.interfaces.gap import gfq_gap_to_sage
    705705        F = self.base_ring()
    706706        q = F.order()
    707707        G = self.gen_mat()
    class LinearCode(module.Module): 
    713713            vstr = vstr[1:-1]     # added by William Stein so const.tex works 2006-10-01
    714714        gap.eval("C:=GeneratorMatCode("+Gstr+",GF("+str(q)+"))")
    715715        gap.eval("c:=VectorCodeword(Decodeword( C, Codeword( "+vstr+" )))") # v->vstr, 8-27-2006
    716         ans = [gap_to_sage(gap.eval("c["+str(i)+"]"),F) for i in range(1,n+1)]
     716        ans = [gfq_gap_to_sage(gap.eval("c["+str(i)+"]"),F) for i in range(1,n+1)]
    717717        V = VectorSpace(F,n)
    718718        return V(ans)
    719719
  • sage/crypto/mq/mpolynomialsystem.py

    diff -r c320674b52c4 -r 2e1a3b3eddf2 sage/crypto/mq/mpolynomialsystem.py
    a b from sage.structure.sage_object import S 
    3232from sage.structure.sage_object import SageObject
    3333
    3434from sage.rings.integer_ring import ZZ
    35 from sage.rings.finite_field import GF
     35from sage.rings.finite_field import FiniteField as GF
    3636
    3737from sage.rings.polynomial.multi_polynomial_ring import is_MPolynomialRing
    3838from sage.rings.polynomial.multi_polynomial_ideal import MPolynomialIdeal
  • sage/crypto/mq/sr.py

    diff -r c320674b52c4 -r 2e1a3b3eddf2 sage/crypto/mq/sr.py
    a b REFERENCES: 
    7676   Advanced Encryption Standard; Springer 2006; 
    7777"""
    7878
    79 from sage.rings.finite_field import GF
     79from sage.rings.finite_field import FiniteField as GF
    8080from sage.rings.integer_ring import ZZ
    8181from sage.rings.polynomial.polynomial_ring import PolynomialRing
    8282
  • sage/groups/perm_gps/cubegroup.py

    diff -r c320674b52c4 -r 2e1a3b3eddf2 sage/groups/perm_gps/cubegroup.py
    a b from sage.interfaces.all import gap, is_ 
    7474from sage.interfaces.all import gap, is_GapElement, is_ExpectElement
    7575from sage.groups.perm_gps.permgroup_element import PermutationGroupElement
    7676import sage.structure.coerce as coerce
    77 from sage.rings.finite_field import GF
     77from sage.rings.finite_field import FiniteField as GF
    7878from sage.rings.arith import factor
    7979from sage.groups.abelian_gps.abelian_group import AbelianGroup
    8080from sage.plot.plot import PolygonFactory, TextFactory
  • sage/groups/perm_gps/permgroup.py

    diff -r c320674b52c4 -r 2e1a3b3eddf2 sage/groups/perm_gps/permgroup.py
    a b from sage.interfaces.all import gap, is_ 
    9191from sage.interfaces.all import gap, is_GapElement, is_ExpectElement
    9292from sage.groups.perm_gps.permgroup_element import PermutationGroupElement
    9393import sage.structure.coerce as coerce
    94 from sage.rings.finite_field import GF
     94from sage.rings.finite_field import FiniteField as GF
    9595from sage.rings.arith import factor
    9696from sage.groups.abelian_gps.abelian_group import AbelianGroup
    9797from sage.misc.functional import is_even, log
  • sage/groups/perm_gps/permgroup_named.py

    diff -r c320674b52c4 -r 2e1a3b3eddf2 sage/groups/perm_gps/permgroup_named.py
    a b from sage.rings.all import Rational 
    7070from sage.rings.all      import RationalField, Integer
    7171from sage.interfaces.all import gap, is_GapElement, is_ExpectElement
    7272import sage.structure.coerce as coerce
    73 from sage.rings.finite_field import GF
     73from sage.rings.finite_field import FiniteField as GF
    7474from sage.rings.arith import factor
    7575from sage.groups.abelian_gps.abelian_group import AbelianGroup
    7676from sage.misc.functional import is_even, log
  • sage/interfaces/gap.py

    diff -r c320674b52c4 -r 2e1a3b3eddf2 sage/interfaces/gap.py
    a b def is_GapElement(x): 
    736736def is_GapElement(x):
    737737    return isinstance(x, GapElement)
    738738
    739 ###########
     739def gfq_gap_to_sage(x, F):
     740    """
     741    INPUT:
     742        x -- gap finite field element
     743        F -- SAGE finite field
     744    OUTPUT:
     745        element of F
     746
     747    EXAMPLES:
     748        sage: x = gap('Z(13)')
     749        sage: F = GF(13, 'a')
     750        sage: F(x)
     751        2
     752        sage: F(gap('0*Z(13)'))
     753        0
     754        sage: F = GF(13^2, 'a')
     755        sage: x = gap('Z(13)')
     756        sage: F(x)
     757        2
     758        sage: x = gap('Z(13^2)^3')
     759        sage: F(x)
     760        12*a + 11
     761        sage: F.multiplicative_generator()^3
     762        12*a + 11
     763
     764    AUTHOR:
     765        -- David Joyner and William Stein
     766    """
     767    from sage.rings.finite_field import FiniteField
     768   
     769    s = str(x)
     770    if s[:2] == '0*':
     771        return F(0)
     772    i1 = s.index("(")
     773    i2 = s.index(")")
     774    q  = eval(s[i1+1:i2].replace('^','**'))
     775    if q == F.order():
     776        K = F
     777    else:
     778        K = FiniteField(q, F.variable_name())
     779    if s.find(')^') == -1:
     780        e = 1
     781    else:
     782        e = int(s[i2+2:])
     783    if F.degree() == 1:
     784        g = int(gap.eval('Int(Z(%s))'%q))
     785    else:
     786        g = K.multiplicative_generator()
     787    return F(K(g**e))
    740788
    741789#############
    742790
  • sage/libs/singular/singular.pyx

    diff -r c320674b52c4 -r 2e1a3b3eddf2 sage/libs/singular/singular.pyx
    a b cdef extern from "limits.h": 
    2121    long INT_MIN
    2222
    2323from sage.rings.rational_field import RationalField
    24 from sage.rings.finite_field import FiniteField_prime_modn
     24from sage.rings.finite_field_prime_modn import FiniteField_prime_modn
    2525from sage.rings.finite_field_ext_pari import FiniteField_ext_pari
    2626from sage.libs.pari.all import pari
    2727
  • sage/matrix/matrix_rational_dense.pyx

    diff -r c320674b52c4 -r 2e1a3b3eddf2 sage/matrix/matrix_rational_dense.pyx
    a b from sage.rings.integer cimport Integer 
    6464from sage.rings.integer cimport Integer
    6565from sage.rings.ring import is_Ring
    6666from sage.rings.integer_ring import ZZ, is_IntegerRing
    67 from sage.rings.finite_field import GF
     67from sage.rings.finite_field import FiniteField as GF
    6868from sage.rings.integer_mod_ring import is_IntegerModRing
    6969from sage.rings.rational_field import QQ
    7070from sage.rings.arith import gcd
  • sage/misc/flatten.py

    diff -r c320674b52c4 -r 2e1a3b3eddf2 sage/misc/flatten.py
    a b def flatten(in_list, ltypes=(list, tuple 
    4040       [0, 1, 2, 3, 4]
    4141       sage: flatten([GF(5)])
    4242       [Finite Field of size 5]
    43        sage: flatten([GF(5)], ltypes = (list, tuple, sage.rings.finite_field.FiniteField_prime_modn))
     43       sage: flatten([GF(5)], ltypes = (list, tuple, sage.rings.finite_field_prime_modn.FiniteField_prime_modn))
    4444       [0, 1, 2, 3, 4]
    4545
    4646   Degenerate cases:
  • sage/rings/all.py

    diff -r c320674b52c4 -r 2e1a3b3eddf2 sage/rings/all.py
    a b Integers = IntegerModRing 
    6565
    6666# Finite fields
    6767from finite_field import (FiniteField, is_FiniteField, is_PrimeFiniteField,
    68                           GF, conway_polynomial, exists_conway_polynomial)
     68                          conway_polynomial, exists_conway_polynomial)
     69GF = FiniteField
     70
    6971from finite_field_element import FiniteFieldElement, is_FiniteFieldElement
    7072
    7173# Number field
  • sage/rings/finite_field.py

    diff -r c320674b52c4 -r 2e1a3b3eddf2 sage/rings/finite_field.py
    a b  
    1 """
     1r"""
    22Finite Fields
    33
     4Sage supports arithmetic in finite prime and extension fields.
     5Several implementation for prime fields are implemented natively in
     6Sage for several sizes of primes $p$. These implementations are
     7\begin{itemize}
     8\item \code{sage.rings.integer_mod.IntegerMod_int},
     9\item \code{sage.rings.integer_mod.IntegerMod_int64}, and
     10\item \code{sage.rings.integer_mod.IntegerMod_gmp}.
     11\end{itemize}
     12Small extension fields
     13of cardinality $< 2^{16}$ are implemented using tables of Zech logs
     14via the Givaro C++ library
     15(\code{sage.rings.finite_field_givaro.FiniteField_givaro}). While this
     16representation is very fast it is limited to finite fields of small
     17cardinality. Larger finite extension fields of order $q >= 2^{16}$ are
     18internally represented as polynomials over a smaller finite prime
     19fields. If the characteristic of such a field is 2 then NTL is used
     20internally to represent the field
     21(\code{sage.rings.finite_field_ntl_gf2e.FiniteField_ntl_gf2e}). In all
     22other case the PARI C library is used
     23(\code{sage.rings.finite_field_ext_pari.FiniteField_ext_pari}).
     24
     25However, this distinction is internal only and the user usually does
     26not have to worry about it because consistency across all
     27implementations is aimed for. In all extension field implementations
     28the user may either specify a minimal polynomial or leave the choice
     29to Sage.
     30 
     31For small finite fields the default choice are Conway polynomials.
     32
     33The Conway polynomial $C_n$ is the lexicographically first monic
     34irreducible, primitive polynomial of degree $n$ over $GF(p)$ with the
     35property that for a root $\alpha$ of $C_n$ we have that $\beta=
     36\alpha^{(p^n - 1)/(p^m - 1)}$ is a root of $C_m$ for all $m$ dividing
     37$n$. Sage contains a database of conway polynomials which also can be
     38queried independendtly of finite field construction.
     39
     40While Sage supports basic arithmetic in finite fields some more
     41advanced features for computing with finite fields are still not
     42implemented. For instance, Sage does not calculate embeddings of
     43finite fields yet.
    444
    545EXAMPLES:
     46    sage: k = GF(5); type(k)
     47    <class 'sage.rings.finite_field_prime_modn.FiniteField_prime_modn'>
     48   
     49    sage: k = GF(5^2,'c'); type(k)
     50    <type 'sage.rings.finite_field_givaro.FiniteField_givaro'>
     51   
     52    sage: k = GF(2^16,'c'); type(k)
     53    <type 'sage.rings.finite_field_ntl_gf2e.FiniteField_ntl_gf2e'>
     54   
     55    sage: k = GF(3^16,'c'); type(k)
     56    <class 'sage.rings.finite_field_ext_pari.FiniteField_ext_pari'>
     57
    658Finite Fields support iteration, starting with 0.
     59
    760    sage: k = GF(9, 'a')
    861    sage: i = 0
    962    sage: for x in k: print i, x; i+=1
    Finite Fields support iteration, startin 
    2578    4
    2679
    2780We output the base rings of several finite fields.
     81
    2882    sage: k = GF(3); type(k)
    29     <class 'sage.rings.finite_field.FiniteField_prime_modn'>
     83    <class 'sage.rings.finite_field_prime_modn.FiniteField_prime_modn'>
    3084    sage: k.base_ring()
    3185    Finite Field of size 3
    3286
    Further examples: 
    49103    True
    50104    sage: GF(8,'a').is_field()
    51105    True
     106
     107AUTHORS:
     108     -- William Stein: initial version
    52109"""
    53110
    54111#*****************************************************************************
    import random 
    69126import random
    70127import weakref
    71128
     129from ring import is_FiniteField
     130from sage.structure.parent_gens import normalize_names
     131
    72132import arith
    73 
    74133import integer
    75 import rational
    76 import integer_mod
    77 
    78 import integer_mod_ring
    79 from ring import is_FiniteField
    80 from ring import FiniteField as FiniteField_generic
    81 from finite_field_givaro import FiniteField_givaro
    82134
    83135import polynomial.polynomial_ring as polynomial_ring
    84136import polynomial.polynomial_element as polynomial_element
    85137import polynomial.multi_polynomial_element as multi_polynomial_element
    86 
    87 from sage.structure.parent_gens import normalize_names, ParentWithGens
    88138
    89139import sage.interfaces.gap
    90140import sage.databases.conway
    def FiniteField(order, name=None, modulu 
    98148    labeled by the given name and possibly with given modulus.
    99149
    100150    INPUT:
    101         order --   int
     151        order --   int > 1
    102152        name --    string; must be specified in not a prime field
    103153        modulus -- (optional) defining polynomial for field, i.e.,
    104154                   generator of the field will be a root of this
    def FiniteField(order, name=None, modulu 
    153203        sage: F.<x> = GF(5)[]
    154204        sage: K.<a> = GF(5**2, name='a', modulus=x^2 + 2, check_irreducible=False)
    155205
    156     For example, you may print finite field elements as integers via
    157     the Givaro implementation. But the constructor parameter to allow
    158     this is not passed to the actual implementation so far.
     206    For example, you may print finite field elements as integers. This
     207    currently only works if the order of field is $<2^{16}$, though.
    159208
    160209        sage: k.<a> = GF(2^8,repr='int')
    161210        sage: a
    162211        2
    163212
    164213    The order of a finite field must be a prime power:
     214   
    165215        sage: GF(100)
    166216        Traceback (most recent call last):
    167217        ...
    def FiniteField(order, name=None, modulu 
    180230        if not K is None:
    181231            return K
    182232    if arith.is_prime(order):
     233        from finite_field_prime_modn import FiniteField_prime_modn
    183234        K = FiniteField_prime_modn(order,*args,**kwds)
    184235    else:
    185236        if not arith.is_prime_power(order):
    def FiniteField(order, name=None, modulu 
    196247            # DO *NOT* use for prime subfield, since that would lead to
    197248            # a circular reference in the call to ParentWithGens in the
    198249            # __init__ method.
     250            from finite_field_givaro import FiniteField_givaro
    199251            K = FiniteField_givaro(order, name, modulus, cache=elem_cache, *args,**kwds)
    200252        else:
    201253            if integer.Integer(order).factor()[0][0] == 2:
    def FiniteField(order, name=None, modulu 
    211263
    212264def is_PrimeFiniteField(x):
    213265    """
    214     Returns True if x is a prime finite field (which is a specific
    215     data type).
     266    Returns True if x is a prime finite field.
    216267
    217268    EXAMPLES:
    218269        sage: is_PrimeFiniteField(QQ)
    def is_PrimeFiniteField(x): 
    224275        sage: is_PrimeFiniteField(GF(next_prime(10^90,proof=False)))
    225276        True
    226277    """
    227     return isinstance(x, FiniteField_prime_modn)
     278    from finite_field_prime_modn import FiniteField_prime_modn
     279    from ring import FiniteField as FiniteField_generic
     280
     281    return isinstance(x, FiniteField_prime_modn) or \
     282           (isinstance(x, FiniteField_generic) and x.degree() == 1)
    228283   
    229 GF = FiniteField
    230 
    231284##################################################################
    232285   
    233286def conway_polynomial(p, n):
    234     """
     287    r"""
    235288    Return the Conway polynomial of degree n over GF(p), which is
    236289    loaded from a table.
    237290
    def conway_polynomial(p, n): 
    249302    disk, which takes a fraction of a second.  Subsequent calls do not
    250303    require reloading the table.
    251304
    252     See also the ConwayPolynomials() object, which is a table of
    253     Conway polynomials.   For example, if c=ConwayPolynomials, then
    254     c.primes() is a list of all primes for which the polynomials are
    255     known, and for a given prime p,  c.degree(p) is a list of all
     305    See also the \code{ConwayPolynomials()} object, which is a table of
     306    Conway polynomials.   For example, if \code{c=ConwayPolynomials}, then
     307    \code{c.primes()} is a list of all primes for which the polynomials are
     308    known, and for a given prime $p$,  \code{c.degree(p)} is a list of all
    256309    degrees for which the Conway polynomials are known.
    257310
    258311    EXAMPLES:
    def conway_polynomial(p, n): 
    266319        RuntimeError: requested conway polynomial not in database.
    267320    """
    268321    (p,n)=(int(p),int(n))
    269     R = polynomial_ring.PolynomialRing(GF(p), 'x')
     322    R = polynomial_ring.PolynomialRing(FiniteField(p), 'x')
    270323    try:
    271324        return R(sage.databases.conway.ConwayPolynomials()[p][n])
    272325    except KeyError:
    273326        raise RuntimeError, "requested conway polynomial not in database."
    274327
    275328def exists_conway_polynomial(p, n):
    276     """
    277     Return True if the Conway polynomial over F_p of degree n is in the
     329    r"""
     330    Return True if the Conway polynomial over $F_p$ of degree $n$ is in the
    278331    database and False otherwise.
    279332
    280333    If the Conway polynomial is in the database, to obtain it use the
    281     command conway_polynomial(p,n).
     334    command \code{conway_polynomial(p,n)}.
    282335
    283336    EXAMPLES:
    284337        sage: exists_conway_polynomial(2,3)
    def exists_conway_polynomial(p, n): 
    292345    """
    293346    return sage.databases.conway.ConwayPolynomials().has_polynomial(p,n)
    294347
    295 def gap_to_sage(x, F):
    296     """
    297     INPUT:
    298         x -- gap finite field element
    299         F -- SAGE finite field
    300     OUTPUT:
    301         element of F
    302 
    303     EXAMPLES:
    304         sage: x = gap('Z(13)')
    305         sage: F = GF(13, 'a')
    306         sage: F(x)
    307         2
    308         sage: F(gap('0*Z(13)'))
    309         0
    310         sage: F = GF(13^2, 'a')
    311         sage: x = gap('Z(13)')
    312         sage: F(x)
    313         2
    314         sage: x = gap('Z(13^2)^3')
    315         sage: F(x)
    316         12*a + 11
    317         sage: F.multiplicative_generator()^3
    318         12*a + 11
    319 
    320     AUTHOR:
    321         -- David Joyner and William Stein
    322     """
    323     s = str(x)
    324     if s[:2] == '0*':
    325         return F(0)
    326     i1 = s.index("(")
    327     i2 = s.index(")")
    328     q  = eval(s[i1+1:i2].replace('^','**'))
    329     if q == F.order():
    330         K = F
    331     else:
    332         K = FiniteField(q, F.variable_name())
    333     if s.find(')^') == -1:
    334         e = 1
    335     else:
    336         e = int(s[i2+2:])
    337     if F.degree() == 1:
    338         g = int(sage.interfaces.gap.gap.eval('Int(Z(%s))'%q))
    339     else:
    340         g = K.multiplicative_generator()
    341     return F(K(g**e))
    342 
    343 
    344 class FiniteField_prime_modn(FiniteField_generic, integer_mod_ring.IntegerModRing_generic):
    345     def __init__(self, p, name=None):
    346         p = integer.Integer(p)
    347         if not arith.is_prime(p):
    348             raise ArithmeticError, "p must be prime"
    349         integer_mod_ring.IntegerModRing_generic.__init__(self, p)
    350         self._kwargs = {}
    351         self.__char = p
    352         self.__gen = self(1)  # self(int(pari.pari(p).znprimroot().lift()))
    353         ParentWithGens.__init__(self, self, ('x',), normalize=False)
    354 
    355     def __cmp__(self, other):
    356         if not isinstance(other, FiniteField_prime_modn):
    357             return cmp(type(self), type(other))
    358         return cmp(self.__char, other.__char)
    359 
    360     def _is_valid_homomorphism_(self, codomain, im_gens):
    361         """
    362         This is called implicitly by the hom constructor.
    363        
    364         EXAMPLES:
    365             sage: k = GF(73^2,'a')
    366             sage: f = k.modulus()
    367             sage: r = f.change_ring(k).roots()
    368             sage: k.hom([r[0][0]])
    369             Ring endomorphism of Finite Field in a of size 73^2
    370               Defn: a |--> 72*a + 3
    371         """
    372         try:
    373             return im_gens[0] == codomain._coerce_(self.gen(0))
    374         except TypeError:
    375             return False
    376 
    377     def _coerce_impl(self, x):
    378         if isinstance(x, (int, long, integer.Integer)):
    379             return self(x)
    380         if isinstance(x, integer_mod.IntegerMod_abstract) and \
    381                x.parent().characteristic() == self.characteristic():
    382             return self(x)
    383         raise TypeError, "no canonical coercion of x"
    384 
    385     def characteristic(self):
    386         return self.__char
    387 
    388     def modulus(self):
    389         try:
    390             return self.__modulus
    391         except AttributeError:
    392             x = polynomial_ring.PolynomialRing(self, 'x').gen()
    393             self.__modulus = x - 1
    394         return self.__modulus
    395 
    396     def is_prime_field(self):
    397         return True
    398        
    399     def is_prime(self):
    400         return True
    401 
    402     def polynomial(self, name=None):
    403         if name is None:
    404             name = self.variable_name()
    405         try:
    406             return self.__polynomial[name]
    407         except  AttributeError:
    408             R = polynomial_ring.PolynomialRing(FiniteField(self.characteristic()), name)
    409             f = polynomial_ring.PolynomialRing(self, name)([0,1])
    410             try:
    411                 self.__polynomial[name] = f
    412             except (KeyError, AttributeError):
    413                 self.__polynomial = {}
    414                 self.__polynomial[name] = f
    415             return f
    416 
    417     def order(self):
    418         return self.__char
    419 
    420     def gen(self, n=0):
    421         """
    422         Return generator of this finite field.
    423        
    424         EXAMPLES:
    425             sage: k = GF(13)
    426             sage: k.gen()
    427             1
    428             sage: k.gen(1)
    429             Traceback (most recent call last):
    430             ...
    431             IndexError: only one generator
    432         """
    433         if n != 0:
    434             raise IndexError, "only one generator"
    435         return self.__gen
    436 
    437     def __iter__(self):
    438         for i in xrange(self.order()):
    439             yield self(i)
    440 
    441     def degree(self):
    442         """
    443         Returns the degree of the finite field, which is a positive
    444         integer.
    445 
    446         EXAMPLES:
    447             sage: FiniteField(3).degree()
    448             1
    449             sage: FiniteField(3^20, 'a').degree()
    450             20
    451         """
    452         return 1
    453348
    454349zech_log_bound = 2**16
  • sage/rings/finite_field_ext_pari.py

    diff -r c320674b52c4 -r 2e1a3b3eddf2 sage/rings/finite_field_ext_pari.py
    a b class FiniteField_ext_pari(FiniteField_g 
    181181            raise ArithmeticError, "q must be a prime power"
    182182
    183183        if F[0][1] > 1:
    184             from finite_field import GF
     184            from finite_field import FiniteField as GF
    185185            base_ring = GF(F[0][0])
    186186        else:
    187187            raise ValueError, "The size of the finite field must not be prime."
    class FiniteField_ext_pari(FiniteField_g 
    207207                #     self.__pari_modulus = pari.pari.finitefield_init(self.__char, self.__degree, self.variable_name())
    208208                # So instead we iterate through random polys until we find an irreducible one.
    209209
    210                 from finite_field import GF
     210                from finite_field import FiniteField as GF
    211211                R = polynomial_ring.PolynomialRing(GF(self.__char), 'x')
    212212                while True:
    213213                    modulus = R.random_element(self.__degree)
    class FiniteField_ext_pari(FiniteField_g 
    433433                raise TypeError, "no coercion defined"
    434434
    435435        elif sage.interfaces.gap.is_GapElement(x):
    436             from finite_field import gap_to_sage
     436            from sage.interfaces.gap import gfq_gap_to_sage
    437437            try:
    438                 return gap_to_sage(x, self)
     438                return gfq_gap_to_sage(x, self)
    439439            except (ValueError, IndexError, TypeError):
    440440                raise TypeError, "no coercion defined"
    441441           
    class FiniteField_ext_pari(FiniteField_g 
    569569        try:
    570570            return self.__polynomial[name]
    571571        except (AttributeError, KeyError):
    572             from finite_field import GF
     572            from finite_field import FiniteField as GF
    573573            R = polynomial_ring.PolynomialRing(GF(self.characteristic()), name)
    574574            f = R(self._pari_modulus())
    575575            try:
  • sage/rings/finite_field_givaro.pyx

    diff -r c320674b52c4 -r 2e1a3b3eddf2 sage/rings/finite_field_givaro.pyx
    a b r""" 
    11r"""
    2 Finite Non-prime Fields of cardinality up to $2^{16}$
     2Finite Extension Fields of cardinality up to $2^{16}$
    33
    44SAGE includes the Givaro finite field library, for highly optimized
    55arithmetic in finite fields.
    using the PARI implementation. 
    1414
    1515EXAMPLES:
    1616    sage: k = GF(5); type(k)
    17     <class 'sage.rings.finite_field.FiniteField_prime_modn'>
     17    <class 'sage.rings.finite_field_prime_modn.FiniteField_prime_modn'>
    1818    sage: k = GF(5^2,'c'); type(k)
    1919    <type 'sage.rings.finite_field_givaro.FiniteField_givaro'>
    2020    sage: k = GF(2^16,'c'); type(k)
    cdef class FiniteField_givaro(FiniteFiel 
    537537            e = e._pari_()
    538538
    539539        elif sage.interfaces.gap.is_GapElement(e):
    540             from sage.rings.finite_field import gap_to_sage
    541             return gap_to_sage(e, self)
     540            from sage.interfaces.gap import gfq_gap_to_sage
     541            return gfq_gap_to_sage(e, self)
    542542
    543543        else:
    544544            raise TypeError, "unable to coerce"
    cdef class FiniteField_givaro(FiniteFiel 
    629629            sage: S.prime_subfield()
    630630            Finite Field of size 5
    631631            sage: type(S.prime_subfield())
    632             <class 'sage.rings.finite_field.FiniteField_prime_modn'>           
     632            <class 'sage.rings.finite_field_prime_modn.FiniteField_prime_modn'>           
    633633        """
    634634        return self.prime_subfield_C()
    635635
  • sage/rings/finite_field_ntl_gf2e.pyx

    diff -r c320674b52c4 -r 2e1a3b3eddf2 sage/rings/finite_field_ntl_gf2e.pyx
    a b cdef void late_import(): 
    115115    FreeModuleElement = sage.modules.free_module_element.FreeModuleElement
    116116
    117117    import sage.rings.finite_field
    118     GF = sage.rings.finite_field.GF
     118    GF = sage.rings.finite_field.FiniteField
    119119
    120120cdef extern from "arpa/inet.h":
    121121    unsigned int htonl(unsigned int)
    cdef class FiniteField_ntl_gf2e(FiniteFi 
    364364            e = e._pari_()
    365365
    366366        elif is_GapElement(e):
    367             from finite_field import gap_to_sage
    368             return gap_to_sage(e, self)
     367            from sage.interfaces.gap import gfq_gap_to_sage
     368            return gfq_gap_to_sage(e, self)
    369369        else:
    370370            raise TypeError, "unable to coerce"
    371371
  • new file sage/rings/finite_field_prime_modn.py

    diff -r c320674b52c4 -r 2e1a3b3eddf2 sage/rings/finite_field_prime_modn.py
    - +  
     1"""
     2Finite Prime Fields
     3
     4AUTHORS:
     5     -- William Stein: initial version
     6     -- Martin Albrecht (2008-01): refactoring
     7"""
     8
     9#*****************************************************************************
     10#       Copyright (C) 2006 William Stein <wstein@gmail.com>
     11#       Copyright (C) 2008 Martin Albrecht <malb@informatik.uni-bremen.de>
     12#
     13#  Distributed under the terms of the GNU General Public License (GPL)
     14#
     15#    This code is distributed in the hope that it will be useful,
     16#    but WITHOUT ANY WARRANTY; without even the implied warranty of
     17#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     18#    General Public License for more details.
     19#
     20#  The full text of the GPL is available at:
     21#
     22#                  http://www.gnu.org/licenses/
     23#*****************************************************************************
     24
     25from ring import FiniteField as FiniteField_generic
     26from sage.structure.parent_gens import normalize_names, ParentWithGens
     27
     28import polynomial.polynomial_ring as polynomial_ring
     29import integer_mod_ring
     30import integer
     31import rational
     32import integer_mod
     33import arith
     34
     35
     36class FiniteField_prime_modn(FiniteField_generic, integer_mod_ring.IntegerModRing_generic):
     37    def __init__(self, p, name=None):
     38        """
     39        Return a new finite field of order $p$ where $p$ is prime.
     40
     41        INPUT:
     42            p -- an integer >= 2
     43            name -- ignored
     44
     45        EXAMPLES:
     46            sage: FiniteField(3)
     47            Finite Field of size 3
     48           
     49            sage: FiniteField(next_prime(1000))
     50            Finite Field of size 1009
     51        """
     52        p = integer.Integer(p)
     53        if not arith.is_prime(p):
     54            raise ArithmeticError, "p must be prime"
     55        integer_mod_ring.IntegerModRing_generic.__init__(self, p)
     56        self._kwargs = {}
     57        self.__char = p
     58        self.__gen = self(1)  # self(int(pari.pari(p).znprimroot().lift()))
     59        ParentWithGens.__init__(self, self, ('x',), normalize=False)
     60
     61    def __cmp__(self, other):
     62        r"""
     63        Compare \code{self} with \code{other}. Two finite prime fields
     64        are considered equal if their characteristic is equal.
     65
     66        EXAMPLE:
     67            sage: K = FiniteField(3)
     68            sage: copy(K) == K
     69            True
     70            sage: copy(K) is K
     71            False
     72        """
     73        if not isinstance(other, FiniteField_prime_modn):
     74            return cmp(type(self), type(other))
     75        return cmp(self.__char, other.__char)
     76
     77    def _is_valid_homomorphism_(self, codomain, im_gens):
     78        """
     79        This is called implicitly by the hom constructor.
     80       
     81        EXAMPLES:
     82            sage: k = GF(73^2,'a')
     83            sage: f = k.modulus()
     84            sage: r = f.change_ring(k).roots()
     85            sage: k.hom([r[0][0]]) # indirect doctest
     86            Ring endomorphism of Finite Field in a of size 73^2
     87              Defn: a |--> 72*a + 3
     88        """
     89        try:
     90            return im_gens[0] == codomain._coerce_(self.gen(0))
     91        except TypeError:
     92            return False
     93
     94    def _coerce_impl(self, x):
     95        """
     96        This is called implicitly by arithmetic methods.
     97
     98        EXAMPLES:
     99            sage: k = GF(7)
     100            sage: e = k(6)
     101            sage: e * 2 # indirect doctest
     102            5
     103            sage: 12 % 7
     104            5
     105        """
     106        if isinstance(x, (int, long, integer.Integer)):
     107            return self(x)
     108        if isinstance(x, integer_mod.IntegerMod_abstract) and \
     109               x.parent().characteristic() == self.characteristic():
     110            return self(x)
     111        raise TypeError, "no canonical coercion of x"
     112
     113    def characteristic(self):
     114        r"""
     115        Return the characteristic of \code{self}.
     116
     117        EXAMPLE:
     118            sage: k = GF(7)
     119            sage: k.characteristic()
     120            7
     121        """
     122        return self.__char
     123
     124    def modulus(self):
     125        """
     126        Return the minimal polynomial of self, which is allways $x - 1$.
     127
     128        EXAMPLE:
     129            sage: k = GF(199)
     130            sage: k.modulus()
     131            x + 198
     132        """
     133        try:
     134            return self.__modulus
     135        except AttributeError:
     136            x = polynomial_ring.PolynomialRing(self, 'x').gen()
     137            self.__modulus = x - 1
     138        return self.__modulus
     139
     140    def is_prime_field(self):
     141        """
     142        Return True
     143
     144        EXAMPLE:
     145            sage: k.<a> = GF(3)
     146            sage: k.is_prime_field()
     147            True
     148
     149            sage: k.<a> = GF(3^2)
     150            sage: k.is_prime_field()
     151            False
     152        """
     153        return True
     154       
     155    def polynomial(self, name=None):
     156        """
     157       
     158        """
     159        if name is None:
     160            name = self.variable_name()
     161        try:
     162            return self.__polynomial[name]
     163        except  AttributeError:
     164            from sage.rings.finite_field import FiniteField
     165            R = polynomial_ring.PolynomialRing(FiniteField(self.characteristic()), name)
     166            f = polynomial_ring.PolynomialRing(self, name)([0,1])
     167            try:
     168                self.__polynomial[name] = f
     169            except (KeyError, AttributeError):
     170                self.__polynomial = {}
     171                self.__polynomial[name] = f
     172            return f
     173
     174    def order(self):
     175        """
     176        Return the order of this finite field.
     177
     178        EXAMPLE:
     179            sage: k = GF(5)
     180            sage: k.order()
     181            5
     182        """
     183        return self.__char
     184
     185    def gen(self, n=0):
     186        """
     187        Return generator of this finite field.
     188       
     189        EXAMPLES:
     190            sage: k = GF(13)
     191            sage: k.gen()
     192            1
     193            sage: k.gen(1)
     194            Traceback (most recent call last):
     195            ...
     196            IndexError: only one generator
     197        """
     198        if n != 0:
     199            raise IndexError, "only one generator"
     200        return self.__gen
     201
     202    def __iter__(self):
     203        """
     204        EXAMPLE:
     205            sage: for a in GF(5):
     206            ...    print a
     207            0
     208            1
     209            2
     210            3
     211            4
     212        """
     213        for i in xrange(self.order()):
     214            yield self(i)
     215
     216    def degree(self):
     217        """
     218        Returns the degree of the finite field, which is a positive
     219        integer.
     220
     221        EXAMPLES:
     222            sage: FiniteField(3).degree()
     223            1
     224        """
     225        return 1
  • sage/rings/integer_mod_ring.py

    diff -r c320674b52c4 -r 2e1a3b3eddf2 sage/rings/integer_mod_ring.py
    a b def IntegerModRing(order=0): 
    9999    if _objsIntegerModRing.has_key(order):
    100100        x = _objsIntegerModRing[order]()
    101101        if not x is None: return x
    102     #if check_prime and arith.is_prime(order):
    103     #    R = sage.rings.finite_field.FiniteField_prime_modn(order)
    104     #else:
    105102    R = IntegerModRing_generic(order)
    106103    _objsIntegerModRing[order] = weakref.ref(R)
    107104    return R
    class IntegerModRing_generic(quotient_ri 
    580577            return TypeError, "error coercing to finite field"
    581578        except TypeError:
    582579            if sage.interfaces.all.is_GapElement(x):
    583                 import finite_field
     580                from sage.interfaces.gap import gfq_gap_to_sage
    584581                try:
    585                     return finite_field.gap_to_sage(x, self)
     582                    return gfq_gap_to_sage(x, self)
    586583                except (ValueError, IndexError, TypeError), msg:
    587584                    raise TypeError, "%s\nerror coercing to finite field"%msg
    588585            else:
  • sage/rings/padics/eisenstein_extension_generic_element.py

    diff -r c320674b52c4 -r 2e1a3b3eddf2 sage/rings/padics/eisenstein_extension_generic_element.py
    a b import sage.rings.polynomial.polynomial_ 
    1414import sage.rings.polynomial.polynomial_ring_constructor
    1515import sage.rings.padics.padic_extension_generic_element
    1616
    17 GF = sage.rings.finite_field.GF
     17GF = sage.rings.finite_field.FiniteField
    1818PolynomialRing = sage.rings.polynomial.polynomial_ring_constructor.PolynomialRing
    1919infinity = sage.rings.infinity.infinity
    2020PQRElement = sage.rings.polynomial.polynomial_quotient_ring_element.PolynomialQuotientRingElement
  • sage/rings/padics/factory.py

    diff -r c320674b52c4 -r 2e1a3b3eddf2 sage/rings/padics/factory.py
    a b def Qq(q, prec = 20, type = 'capped-rel' 
    154154        return Qp(q, prec, type, print_mode, halt, names, check)
    155155    base = Qp(F[0][0], prec, type, print_mode, halt, qp_name, check = False)
    156156    if modulus is None:
    157         from sage.rings.finite_field import GF
     157        from sage.rings.finite_field import FiniteField as GF
    158158        from sage.rings.integer_ring import ZZ
    159159        from sage.rings.polynomial.polynomial_ring import PolynomialRing
    160160        if qp_name is None:
    def Zq(q, prec = 20, type = 'capped-abs' 
    402402        return Zp(q, prec, type, print_mode, halt, names, check)
    403403    base = Zp(F[0][0], prec, type, print_mode, halt, zp_name, check = False)
    404404    if modulus is None:
    405         from sage.rings.finite_field import GF
     405        from sage.rings.finite_field import FiniteField as GF
    406406        if zp_name is None:
    407407            zp_name = (str(F[0][0]),)
    408408        modulus = PolynomialRing(base, 'x')(GF(q, names).modulus().change_ring(ZZ))
  • sage/rings/padics/padic_extension_generic_element.py

    diff -r c320674b52c4 -r 2e1a3b3eddf2 sage/rings/padics/padic_extension_generic_element.py
    a b from __future__ import with_statement 
    11from __future__ import with_statement
    2 from sage.rings.finite_field import GF
     2from sage.rings.finite_field import FiniteField as GF
    33from sage.rings.padics.misc import min
    44import sage.rings.polynomial.polynomial_quotient_ring_element
    55import sage.rings.integer
  • sage/rings/padics/padic_generic.py

    diff -r c320674b52c4 -r 2e1a3b3eddf2 sage/rings/padics/padic_generic.py
    a b class pAdicGeneric(sage.rings.ring.Princ 
    237237            sage: k
    238238                Finite Field of size 3
    239239        """
    240         return sage.rings.finite_field.GF(self.prime())
     240        return sage.rings.finite_field.FiniteField(self.prime())
    241241
    242242    def residue_system(self):
    243243        """
    class pAdicGeneric(sage.rings.ring.Princ 
    472472            else:
    473473                raise ValueError, "No, %sth root of unity in self"%n
    474474        else:
    475             return self.teichmuller(sage.rings.finite_field.GF(self.prime()).zeta(n).lift())
     475            return self.teichmuller(sage.rings.finite_field.FiniteField(self.prime()).zeta(n).lift())
    476476
    477477    def zeta_order(self):
    478478        """
  • sage/rings/padics/unramified_extension_generic.py

    diff -r c320674b52c4 -r 2e1a3b3eddf2 sage/rings/padics/unramified_extension_generic.py
    a b pAdicExtensionGeneric = padic_extension_ 
    1717pAdicExtensionGeneric = padic_extension_generic.pAdicExtensionGeneric
    1818UnramifiedExtensionGenericElement = sage.rings.padics.unramified_extension_generic_element.UnramifiedExtensionGenericElement
    1919PolynomialRing = sage.rings.polynomial.polynomial_ring.PolynomialRing
    20 GF = sage.rings.finite_field.GF
     20GF = sage.rings.finite_field.FiniteField
    2121pAdicGeneric = sage.rings.padics.padic_generic.pAdicGeneric
    2222
    2323class UnramifiedExtensionGeneric(pAdicExtensionGeneric):
  • sage/rings/padics/unramified_extension_generic_element.py

    diff -r c320674b52c4 -r 2e1a3b3eddf2 sage/rings/padics/unramified_extension_generic_element.py
    a b import sage.rings.polynomial.polynomial_ 
    1414import sage.rings.polynomial.polynomial_ring_constructor
    1515import sage.rings.padics.padic_extension_generic_element
    1616
    17 GF = sage.rings.finite_field.GF
     17GF = sage.rings.finite_field.FiniteField
    1818PolynomialRing = sage.rings.polynomial.polynomial_ring_constructor.PolynomialRing
    1919infinity = sage.rings.infinity.infinity
    2020PQRElement = sage.rings.polynomial.polynomial_quotient_ring_element.PolynomialQuotientRingElement
  • sage/rings/polynomial/multi_polynomial_libsingular.pyx

    diff -r c320674b52c4 -r 2e1a3b3eddf2 sage/rings/polynomial/multi_polynomial_libsingular.pyx
    a b from sage.rings.polynomial.polydict impo 
    4848
    4949# base ring imports
    5050from sage.rings.rational_field import RationalField
    51 from sage.rings.finite_field import FiniteField_prime_modn
    52 from sage.rings.finite_field import FiniteField_generic
     51from sage.rings.finite_field_prime_modn import FiniteField_prime_modn
     52from sage.rings.ring import FiniteField as FiniteField_generic
    5353from sage.rings.finite_field_givaro cimport FiniteField_givaroElement
    5454from sage.rings.finite_field_givaro cimport FiniteField_givaro
    5555from sage.rings.number_field.number_field import NumberField_generic
  • sage/rings/polynomial/pbori.pyx

    diff -r c320674b52c4 -r 2e1a3b3eddf2 sage/rings/polynomial/pbori.pyx
    a b from sage.rings.polynomial.polynomial_el 
    3131
    3232from sage.rings.polynomial.multi_polynomial_ideal import MPolynomialIdeal
    3333from sage.rings.polynomial.term_order import TermOrder
    34 from sage.rings.finite_field import GF
     34from sage.rings.finite_field import FiniteField as GF
    3535from sage.monoids.monoid import Monoid_class
    3636
    3737order_dict= {"lp":      lp,
  • sage/rings/residue_field.pyx

    diff -r c320674b52c4 -r 2e1a3b3eddf2 sage/rings/residue_field.pyx
    a b from sage.rings.all import ZZ, QQ, Integ 
    6565from sage.rings.all import ZZ, QQ, Integers
    6666from sage.rings.number_field.number_field_ideal import is_NumberFieldIdeal
    6767import weakref
     68from sage.rings.finite_field import FiniteField as GF
    6869from sage.rings.finite_field_givaro import FiniteField_givaro
    69 from sage.rings.finite_field import FiniteField_prime_modn, GF
     70from sage.rings.finite_field_prime_modn import FiniteField_prime_modn
    7071from sage.rings.finite_field_ext_pari import FiniteField_ext_pari
    7172from sage.structure.parent_base import ParentWithBase
    7273
  • sage/rings/ring.pyx

    diff -r c320674b52c4 -r 2e1a3b3eddf2 sage/rings/ring.pyx
    a b cdef class FiniteFieldIterator: 
    11201120        return self.parent(self.iter.next())
    11211121
    11221122cdef class FiniteField(Field):
    1123     """
    1124     """
    1125    
    11261123    def __init__(self):
    11271124        """
    11281125        EXAMPLES:
    cdef class FiniteField(Field): 
    15141511            Univariate Polynomial Ring in alpha over Finite Field of size 3
    15151512        """
    15161513        from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
    1517         from sage.rings.finite_field import GF
     1514        from sage.rings.finite_field import FiniteField as GF
    15181515       
    15191516        if variable_name is None and self.__polynomial_ring is not None:
    15201517            return self.__polynomial_ring