Ticket #4305: 4305-move-finite-field.patch

File 4305-move-finite-field.patch, 65.7 KB (added by robertwb, 13 years ago)
  • sage/coding/code_constructions.py

    # HG changeset patch
    # User Robert Bradshaw <robertwb@math.washington.edu>
    # Date 1224101008 25200
    # Node ID fc7e9d6360973f5fae54fd608659f0fbfecc3e2b
    # Parent  1e967d0b7e40267fa1079aa1831f1e4d54df14d4
    imported patch finite_field_moving
    
    diff --git a/sage/coding/code_constructions.py b/sage/coding/code_constructions.py
    a b  
    118118from sage.interfaces.all import gap
    119119from sage.matrix.matrix_space import MatrixSpace
    120120from sage.matrix.constructor import matrix
    121 from sage.rings.finite_field import FiniteField as GF
     121from sage.rings.finite_field.all import FiniteField as GF
    122122from sage.groups.perm_gps.permgroup_named import SymmetricGroup
    123123from sage.misc.sage_eval import sage_eval
    124124from sage.misc.misc import prod, add
  • sage/coding/guava.py

    diff --git a/sage/coding/guava.py b/sage/coding/guava.py
    a b  
    2929from sage.misc.randstate import current_randstate
    3030from sage.misc.preparser import *
    3131from sage.matrix.matrix_space import MatrixSpace
    32 from sage.rings.finite_field import FiniteField as GF
     32from sage.rings.finite_field.all import FiniteField as GF
    3333from sage.interfaces.gap import gfq_gap_to_sage
    3434from sage.groups.perm_gps.permgroup import *
    3535from sage.misc.sage_eval import sage_eval
  • sage/coding/linear_code.py

    diff --git a/sage/coding/linear_code.py b/sage/coding/linear_code.py
    a b  
    154154import sage.modules.free_module as fm
    155155import sage.modules.module as module
    156156from sage.interfaces.all import gap
    157 from sage.rings.finite_field import FiniteField as GF
     157from sage.rings.finite_field.all import FiniteField as GF
    158158from sage.groups.perm_gps.permgroup import PermutationGroup
    159159from sage.matrix.matrix_space import MatrixSpace
    160160from sage.matrix.constructor import Matrix
  • sage/coding/sd_codes.py

    diff --git a/sage/coding/sd_codes.py b/sage/coding/sd_codes.py
    a b  
    7777
    7878
    7979"""
    80 from sage.rings.finite_field import FiniteField as GF
     80from sage.rings.finite_field.all import FiniteField as GF
    8181from sage.matrix.matrix_space import MatrixSpace
    8282from linear_code import LinearCode
    8383from sage.matrix.constructor import block_diagonal_matrix
  • sage/combinat/designs/block_design.py

    diff --git a/sage/combinat/designs/block_design.py b/sage/combinat/designs/block_design.py
    a b  
    4343from sage.matrix.matrix_space import MatrixSpace
    4444from sage.rings.integer_ring import ZZ
    4545from sage.rings.arith import binomial, integer_floor
    46 from sage.rings.finite_field import FiniteField
     46from sage.rings.finite_field.all import FiniteField
    4747from sage.combinat.designs.incidence_structures import IncidenceStructure, IncidenceStructureFromMatrix
    4848
    4949###  utility functions  -------------------------------------------------------
  • sage/combinat/matrices/latin.py

    diff --git a/sage/combinat/matrices/latin.py b/sage/combinat/matrices/latin.py
    a b  
    153153from sage.interfaces.gap import gap
    154154from sage.groups.perm_gps.permgroup import PermutationGroup
    155155from sage.rings.arith import is_prime
    156 from sage.rings.finite_field import FiniteField
     156from sage.rings.finite_field.all import FiniteField
    157157from sage.misc.misc import uniq
    158158from sage.misc.flatten import flatten
    159159
  • sage/combinat/posets/hasse_diagram.py

    diff --git a/sage/combinat/posets/hasse_diagram.py b/sage/combinat/posets/hasse_diagram.py
    a b  
    2424from sage.graphs.graph import Graph, DiGraph
    2525from sage.misc.sage_eval import sage_eval
    2626from sage.matrix.constructor import matrix
    27 from sage.rings.finite_field import FiniteField
     27from sage.rings.finite_field.all import FiniteField
    2828from sage.rings.integer_ring import IntegerRing, ZZ
    2929from sage.matrix.constructor import matrix
    3030from sage.misc.misc import uniq
  • sage/crypto/mq/mpolynomialsystem.py

    diff --git a/sage/crypto/mq/mpolynomialsystem.py b/sage/crypto/mq/mpolynomialsystem.py
    a b  
    3232from sage.structure.sage_object import SageObject
    3333
    3434from sage.rings.integer_ring import ZZ
    35 from sage.rings.finite_field import FiniteField as GF
     35from sage.rings.finite_field.all 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/sbox.py

    diff --git a/sage/crypto/mq/sbox.py b/sage/crypto/mq/sbox.py
    a b  
    3838from sage.misc.functional import log as log_b
    3939from sage.misc.misc_c import prod as mul
    4040from sage.modules.free_module_element import vector
    41 from sage.rings.finite_field import FiniteField as GF
     41from sage.rings.finite_field.all import FiniteField as GF
    4242from sage.rings.ideal import FieldIdeal, Ideal
    4343from sage.rings.integer_ring import ZZ
    4444from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
  • sage/crypto/mq/sr.py

    diff --git a/sage/crypto/mq/sr.py b/sage/crypto/mq/sr.py
    a b  
    9595   of the Advanced Encryption Standard; Springer 2006;
    9696"""
    9797
    98 from sage.rings.finite_field import FiniteField as GF
     98from sage.rings.finite_field.all import FiniteField as GF
    9999from sage.rings.integer_ring import ZZ
    100100from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
    101101
  • sage/crypto/stream.py

    diff --git a/sage/crypto/stream.py b/sage/crypto/stream.py
    a b  
    1111#*****************************************************************************
    1212
    1313from sage.monoids.string_monoid import BinaryStrings
    14 from sage.rings.finite_field import FiniteField
     14from sage.rings.finite_field.all import FiniteField
    1515from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
    1616from sage.rings.polynomial.polynomial_element import is_Polynomial
    1717from stream_cipher import LFSRCipher, ShrinkingGeneratorCipher
  • sage/graphs/graph_generators.py

    diff --git a/sage/graphs/graph_generators.py b/sage/graphs/graph_generators.py
    a b  
    31063106                    butterfly[(padded_bv,i)]=[(padded_bv,i+1), (padded_bw,i+1)]
    31073107        elif vertices=='vectors':
    31083108            from sage.modules.free_module import VectorSpace
    3109             from sage.rings.finite_field import FiniteField
     3109            from sage.rings.finite_field.all import FiniteField
    31103110            from copy import copy
    31113111            butterfly = {}
    31123112            for v in VectorSpace(FiniteField(2),n):
  • sage/groups/matrix_gps/matrix_group.py

    diff --git a/sage/groups/matrix_gps/matrix_group.py b/sage/groups/matrix_gps/matrix_group.py
    a b  
    6464from sage.groups.group import Group
    6565from sage.rings.all import IntegerRing, is_Ring, infinity
    6666from sage.misc.functional import is_field
    67 from sage.rings.finite_field import is_FiniteField
     67from sage.rings.finite_field.all import is_FiniteField
    6868from sage.interfaces.gap import gap, GapElement
    6969from sage.matrix.all import MatrixSpace, is_MatrixSpace, is_Matrix
    7070import sage.rings.integer as integer
  • sage/groups/perm_gps/cubegroup.py

    diff --git a/sage/groups/perm_gps/cubegroup.py b/sage/groups/perm_gps/cubegroup.py
    a b  
    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 FiniteField as GF
    7877from sage.rings.arith import factor
    7978from sage.groups.abelian_gps.abelian_group import AbelianGroup
    8079from sage.plot.plot import polygon, text
  • sage/groups/perm_gps/partn_ref/refinement_binary.pyx

    diff --git a/sage/groups/perm_gps/partn_ref/refinement_binary.pyx b/sage/groups/perm_gps/partn_ref/refinement_binary.pyx
    a b  
    10991099    from sage.misc.prandom import random, randint
    11001100    from sage.combinat.permutation import Permutations
    11011101    from sage.matrix.constructor import random_matrix, matrix
    1102     from sage.rings.finite_field import FiniteField as GF
     1102    from sage.rings.finite_field.all import FiniteField as GF
    11031103    cdef int h, i, j, n, k, num_tests = 0, num_codes = 0
    11041104    cdef LinearBinaryCodeStruct B, C
    11051105    cdef NonlinearBinaryCodeStruct B_n, C_n
  • sage/groups/perm_gps/partn_ref/refinement_matrices.pyx

    diff --git a/sage/groups/perm_gps/partn_ref/refinement_matrices.pyx b/sage/groups/perm_gps/partn_ref/refinement_matrices.pyx
    a b  
    327327    from sage.misc.prandom import random, randint
    328328    from sage.combinat.permutation import Permutations
    329329    from sage.matrix.constructor import random_matrix, matrix
    330     from sage.rings.finite_field import FiniteField as GF
     330    from sage.rings.finite_field.all import FiniteField as GF
    331331    from sage.rings.arith import next_prime
    332332    cdef int h, i, j, nrows, k, num_tests = 0, num_matrices = 0
    333333    cdef MatrixStruct M, N
  • sage/groups/perm_gps/permgroup.py

    diff --git a/sage/groups/perm_gps/permgroup.py b/sage/groups/perm_gps/permgroup.py
    a b  
    9292from sage.interfaces.gap import gap, is_GapElement, GapElement
    9393from sage.groups.perm_gps.permgroup_element import PermutationGroupElement
    9494import sage.structure.coerce as coerce
    95 from sage.rings.finite_field import FiniteField as GF
    9695from sage.groups.abelian_gps.abelian_group import AbelianGroup
    9796from sage.misc.functional import is_even, log
    9897from sage.rings.rational_field import RationalField
  • sage/groups/perm_gps/permgroup_named.py

    diff --git a/sage/groups/perm_gps/permgroup_named.py b/sage/groups/perm_gps/permgroup_named.py
    a b  
    7474from sage.rings.all      import RationalField, Integer
    7575from sage.interfaces.all import gap, is_GapElement, is_ExpectElement
    7676import sage.structure.coerce as coerce
    77 from sage.rings.finite_field import FiniteField as GF
     77from sage.rings.finite_field.all import FiniteField as GF
    7878from sage.rings.arith import factor
    7979from sage.groups.abelian_gps.abelian_group import AbelianGroup
    8080from sage.misc.functional import is_even, log
  • sage/interfaces/gap.py

    diff --git a/sage/interfaces/gap.py b/sage/interfaces/gap.py
    a b  
    10381038    AUTHOR:
    10391039        -- David Joyner and William Stein
    10401040    """
    1041     from sage.rings.finite_field import FiniteField
     1041    from sage.rings.finite_field.all import FiniteField
    10421042   
    10431043    s = str(x)
    10441044    if s[:2] == '0*':
  • sage/libs/ntl/ntl_GF2E.pyx

    diff --git a/sage/libs/ntl/ntl_GF2E.pyx b/sage/libs/ntl/ntl_GF2E.pyx
    a b  
    446446        e = GF2E_degree()
    447447
    448448        if k is None:
    449             from sage.rings.finite_field import FiniteField
     449            from sage.rings.finite_field.all import FiniteField
    450450            f = self.c.m._sage_()
    451451            k = FiniteField(2**e, name='a', modulus=f)
    452452
  • sage/libs/ntl/ntl_GF2X.pyx

    diff --git a/sage/libs/ntl/ntl_GF2X.pyx b/sage/libs/ntl/ntl_GF2X.pyx
    a b  
    536536        """
    537537        if R==None:
    538538            from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
    539             from sage.rings.finite_field import FiniteField
     539            from sage.rings.finite_field.all import FiniteField
    540540            R = PolynomialRing(FiniteField(2), 'x')
    541541
    542542        return R(map(int,self.list()))
  • sage/libs/ntl/ntl_mat_GF2.pyx

    diff --git a/sage/libs/ntl/ntl_mat_GF2.pyx b/sage/libs/ntl/ntl_mat_GF2.pyx
    a b  
    518518            [0 0 0 1 1 1]
    519519            [0 0 1 1 1 1]
    520520        """
    521         from sage.rings.finite_field import FiniteField
     521        from sage.rings.finite_field.all import FiniteField
    522522        from sage.matrix.constructor import Matrix
    523523        m =  Matrix(FiniteField(2),self.x.NumRows(),self.x.NumCols())
    524524
  • sage/libs/ntl/ntl_mat_GF2E.pyx

    diff --git a/sage/libs/ntl/ntl_mat_GF2E.pyx b/sage/libs/ntl/ntl_mat_GF2E.pyx
    a b  
    503503            [a^2 + 1 a^2 + a]
    504504        """
    505505        if k is None:
    506             from sage.rings.finite_field import FiniteField
     506            from sage.rings.finite_field.all import FiniteField
    507507            f = self.c.m._sage_()
    508508            e = GF2E_degree()
    509509            k = FiniteField(2**e, name='a', modulus=f)
  • sage/libs/singular/singular.pxd

    diff --git a/sage/libs/singular/singular.pxd b/sage/libs/singular/singular.pxd
    a b  
    33from sage.rings.rational cimport Rational
    44from sage.structure.element cimport Element
    55from sage.rings.integer cimport Integer
    6 from sage.rings.finite_field_givaro cimport FiniteField_givaro,FiniteField_givaroElement
    7 from sage.rings.finite_field_ntl_gf2e cimport FiniteField_ntl_gf2e,FiniteField_ntl_gf2eElement
     6from sage.rings.finite_field.finite_field_givaro cimport FiniteField_givaro,FiniteField_givaroElement
     7from sage.rings.finite_field.finite_field_ntl_gf2e cimport FiniteField_ntl_gf2e,FiniteField_ntl_gf2eElement
    88from sage.rings.polynomial.multi_polynomial_libsingular cimport MPolynomial_libsingular
    99from sage.rings.polynomial.multi_polynomial_libsingular cimport MPolynomialRing_libsingular
    1010
  • sage/libs/singular/singular.pyx

    diff --git a/sage/libs/singular/singular.pyx b/sage/libs/singular/singular.pyx
    a b  
    2222
    2323from sage.rings.rational_field import RationalField
    2424from sage.rings.integer_ring cimport IntegerRing_class
    25 from sage.rings.finite_field_prime_modn import FiniteField_prime_modn
    26 from sage.rings.finite_field_ext_pari import FiniteField_ext_pari
     25from sage.rings.finite_field.finite_field_prime_modn import FiniteField_prime_modn
     26from sage.rings.finite_field.finite_field_ext_pari import FiniteField_ext_pari
    2727from sage.libs.pari.all import pari
    2828
    2929from sage.structure.parent_base cimport ParentWithBase
  • sage/matrix/matrix_mod2_dense.pyx

    diff --git a/sage/matrix/matrix_mod2_dense.pyx b/sage/matrix/matrix_mod2_dense.pyx
    a b  
    14561456        True
    14571457    """
    14581458    from sage.matrix.constructor import Matrix
    1459     from sage.rings.finite_field import FiniteField as GF
     1459    from sage.rings.finite_field.all import FiniteField as GF
    14601460
    14611461    cdef int i, j
    14621462    cdef Matrix_mod2_dense A
     
    15041504        True
    15051505    """
    15061506    from sage.matrix.constructor import Matrix
    1507     from sage.rings.finite_field import FiniteField as GF
     1507    from sage.rings.finite_field.all import FiniteField as GF
    15081508
    15091509    cdef int i,j,r,c
    15101510    cdef Matrix_mod2_dense A
  • sage/matrix/matrix_rational_dense.pyx

    diff --git a/sage/matrix/matrix_rational_dense.pyx b/sage/matrix/matrix_rational_dense.pyx
    a b  
    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 FiniteField as GF
     67from sage.rings.finite_field.all 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/matrix/matrix_space.py

    diff --git a/sage/matrix/matrix_space.py b/sage/matrix/matrix_space.py
    a b  
    6969import sage.rings.integer_ring as integer_ring
    7070import sage.rings.integer as integer
    7171import sage.rings.field as field
    72 import sage.rings.finite_field as finite_field
     72import sage.rings.finite_field.finite_field as finite_field
    7373import sage.rings.principal_ideal_domain as principal_ideal_domain
    7474import sage.rings.integral_domain as integral_domain
    7575import sage.rings.number_field.all
  • sage/modules/free_module.py

    diff --git a/sage/modules/free_module.py b/sage/modules/free_module.py
    a b  
    153153import sage.rings.commutative_ring as commutative_ring
    154154import sage.rings.principal_ideal_domain as principal_ideal_domain
    155155import sage.rings.field as field
    156 import sage.rings.finite_field as finite_field
     156import sage.rings.finite_field.finite_field as finite_field
    157157import sage.rings.integral_domain as integral_domain
    158158import sage.rings.ring as ring
    159159import sage.rings.integer_ring
  • sage/modules/free_quadratic_module.py

    diff --git a/sage/modules/free_quadratic_module.py b/sage/modules/free_quadratic_module.py
    a b  
    8282import sage.rings.commutative_ring as commutative_ring
    8383import sage.rings.principal_ideal_domain as principal_ideal_domain
    8484import sage.rings.field as field
    85 import sage.rings.finite_field as finite_field
    8685import sage.rings.integral_domain as integral_domain
    8786import sage.rings.ring as ring
    8887import sage.rings.integer_ring
  • sage/quadratic_forms/genera/genus.py

    diff --git a/sage/quadratic_forms/genera/genus.py b/sage/quadratic_forms/genera/genus.py
    a b  
    1010import sage.misc.misc as misc
    1111from sage.rings.arith import LCM
    1212from sage.rings.real_mpfr import RealField
    13 from sage.rings.finite_field import FiniteField
     13from sage.rings.finite_field.all import FiniteField
    1414from sage.matrix.matrix_space import MatrixSpace
    1515from sage.rings.integer_ring import IntegerRing
    1616from sage.rings.rational_field import RationalField
  • sage/rings/all.py

    diff --git a/sage/rings/all.py b/sage/rings/all.py
    a b  
    6464Integers = IntegerModRing
    6565
    6666# Finite fields
    67 from finite_field import (FiniteField, is_FiniteField, is_PrimeFiniteField,
    68                           conway_polynomial, exists_conway_polynomial)
    69 GF = FiniteField
    70 
    71 from finite_field_element import FiniteFieldElement, is_FiniteFieldElement
     67from finite_field.all import *
    7268
    7369# Number field
    7470from number_field.all import *
  • sage/rings/field.py

    diff --git a/sage/rings/field.py b/sage/rings/field.py
    a b  
    2020from sage.rings.ring import Field, is_Field
    2121
    2222def is_PrimeField(R):
    23     from finite_field import is_FiniteField
     23    from finite_field.all import is_FiniteField
    2424    from rational_field import is_RationalField
    2525    if is_RationalField(R):
    2626        return True
  • new file sage/rings/finite_field/all.py

    diff --git a/sage/rings/finite_field/all.py b/sage/rings/finite_field/all.py
    new file mode 100644
    - +  
     1from finite_field import (FiniteField, is_FiniteField, is_PrimeFiniteField,
     2                          conway_polynomial, exists_conway_polynomial)
     3GF = FiniteField
     4
     5from finite_field_element import FiniteFieldElement, is_FiniteFieldElement
  • finite_field.py

    diff --git a/sage/rings/finite_field.py b/sage/rings/finite_field/finite_field.py
    rename from sage/rings/finite_field.py
    rename to sage/rings/finite_field/finite_field.py
    old new  
    1212Small extension fields
    1313of cardinality $< 2^{16}$ are implemented using tables of Zech logs
    1414via the Givaro C++ library
    15 (\code{sage.rings.finite_field_givaro.FiniteField_givaro}). While this
     15(\code{sage.rings.finite_field.finite_field_givaro.FiniteField_givaro}). While this
    1616representation is very fast it is limited to finite fields of small
    1717cardinality. Larger finite extension fields of order $q >= 2^{16}$ are
    1818internally represented as polynomials over a smaller finite prime
    1919fields. If the characteristic of such a field is 2 then NTL is used
    2020internally to represent the field
    21 (\code{sage.rings.finite_field_ntl_gf2e.FiniteField_ntl_gf2e}). In all
     21(\code{sage.rings.finite_field.finite_field_ntl_gf2e.FiniteField_ntl_gf2e}). In all
    2222other case the PARI C library is used
    2323(\code{sage.rings.finite_field_ext_pari.FiniteField_ext_pari}).
    2424
     
    4444
    4545EXAMPLES:
    4646    sage: k = GF(5); type(k)
    47     <class 'sage.rings.finite_field_prime_modn.FiniteField_prime_modn'>
     47    <class 'sage.rings.finite_field.finite_field_prime_modn.FiniteField_prime_modn'>
    4848   
    4949    sage: k = GF(5^2,'c'); type(k)
    50     <type 'sage.rings.finite_field_givaro.FiniteField_givaro'>
     50    <type 'sage.rings.finite_field.finite_field_givaro.FiniteField_givaro'>
    5151   
    5252    sage: k = GF(2^16,'c'); type(k)
    53     <type 'sage.rings.finite_field_ntl_gf2e.FiniteField_ntl_gf2e'>
     53    <type 'sage.rings.finite_field.finite_field_ntl_gf2e.FiniteField_ntl_gf2e'>
    5454   
    5555    sage: k = GF(3^16,'c'); type(k)
    56     <class 'sage.rings.finite_field_ext_pari.FiniteField_ext_pari'>
     56    <class 'sage.rings.finite_field.finite_field_ext_pari.FiniteField_ext_pari'>
    5757
    5858Finite Fields support iteration, starting with 0.
    5959
     
    7979We output the base rings of several finite fields.
    8080
    8181    sage: k = GF(3); type(k)
    82     <class 'sage.rings.finite_field_prime_modn.FiniteField_prime_modn'>
     82    <class 'sage.rings.finite_field.finite_field_prime_modn.FiniteField_prime_modn'>
    8383    sage: k.base_ring()
    8484    Finite Field of size 3
    8585
    8686    sage: k = GF(9,'alpha'); type(k)
    87     <type 'sage.rings.finite_field_givaro.FiniteField_givaro'>
     87    <type 'sage.rings.finite_field.finite_field_givaro.FiniteField_givaro'>
    8888    sage: k.base_ring()
    8989    Finite Field of size 3
    9090   
    9191    sage: k = GF(3^40,'b'); type(k)
    92     <class 'sage.rings.finite_field_ext_pari.FiniteField_ext_pari'>
     92    <class 'sage.rings.finite_field.finite_field_ext_pari.FiniteField_ext_pari'>
    9393    sage: k.base_ring()
    9494    Finite Field of size 3
    9595
     
    124124#                  http://www.gnu.org/licenses/
    125125#*****************************************************************************
    126126
    127 from ring import is_FiniteField
     127from sage.rings.ring import is_FiniteField
    128128from sage.structure.parent_gens import normalize_names
    129129
    130 import arith
    131 import integer
     130import sage.rings.arith as arith
     131import sage.rings.integer as integer
    132132
    133 import polynomial.polynomial_element as polynomial_element
    134 import polynomial.multi_polynomial_element as multi_polynomial_element
     133import sage.rings.polynomial.polynomial_element as polynomial_element
     134import sage.rings.polynomial.multi_polynomial_element as multi_polynomial_element
    135135
    136136# We don't late import this because this means trouble with the Givaro library
    137137# TODO: figure out why
     
    265265        cache[key] = K
    266266    return K
    267267
     268GF = FiniteField
    268269
    269270def is_PrimeFiniteField(x):
    270271    """
    271272    Returns True if x is a prime finite field.
    272273
    273274    EXAMPLES:
    274         sage: from sage.rings.finite_field import is_PrimeFiniteField
     275        sage: from sage.rings.finite_field.finite_field import is_PrimeFiniteField
    275276        sage: is_PrimeFiniteField(QQ)
    276277        False
    277278        sage: is_PrimeFiniteField(GF(7))
     
    282283        True
    283284    """
    284285    from finite_field_prime_modn import FiniteField_prime_modn
    285     from ring import FiniteField as FiniteField_generic
     286    from sage.rings.ring import FiniteField as FiniteField_generic
    286287
    287288    return isinstance(x, FiniteField_prime_modn) or \
    288289           (isinstance(x, FiniteField_generic) and x.degree() == 1)
  • finite_field_element.py

    diff --git a/sage/rings/finite_field_element.py b/sage/rings/finite_field/finite_field_element.py
    rename from sage/rings/finite_field_element.py
    rename to sage/rings/finite_field/finite_field_element.py
    old new  
    2525import operator
    2626
    2727import sage.structure.element as element
    28 import arith
    29 import integer_ring
    30 from integer import Integer
    31 import rational
     28import sage.rings.arith as arith
     29import sage.rings.integer_ring as integer_ring
     30from sage.rings.integer import Integer
     31import sage.rings.rational as rational
    3232from sage.libs.pari.all import pari, pari_gen
    3333from sage.structure.element import FiniteFieldElement
    34 import field_element
    35 import integer_mod
    36 import ring
     34import sage.rings.field_element as field_element
     35import sage.rings.ring as ring
    3736
    3837def is_FiniteFieldElement(x):
    3938    """
    4039    Returns if x is a finite field element.
    4140
    4241    EXAMPLE:
    43         sage: from sage.rings.finite_field_element import is_FiniteFieldElement
     42        sage: from sage.rings.finite_field.finite_field_element import is_FiniteFieldElement
    4443        sage: is_FiniteFieldElement(1)
    4544        False
    4645        sage: is_FiniteFieldElement(IntegerRing())
     
    6059    write the element in terms of a.
    6160
    6261    EXAMPLES:
    63         sage: from sage.rings.finite_field_ext_pari import FiniteField_ext_pari
     62        sage: from sage.rings.finite_field.finite_field_ext_pari import FiniteField_ext_pari
    6463        sage: K = FiniteField_ext_pari(10007^10, 'a')
    6564        sage: a = K.gen(); a
    6665        a
     
    9291        Create element of a finite field.
    9392
    9493        EXAMPLES:
    95             sage: from sage.rings.finite_field_ext_pari import FiniteField_ext_pari
     94            sage: from sage.rings.finite_field.finite_field_ext_pari import FiniteField_ext_pari
    9695            sage: k = FiniteField_ext_pari(9,'a')
    9796            sage: a = k(11); a
    9897            2
     
    156155       
    157156        EXAMPLES:
    158157        The default variable is a:
    159             sage: from sage.rings.finite_field_ext_pari import FiniteField_ext_pari
     158            sage: from sage.rings.finite_field.finite_field_ext_pari import FiniteField_ext_pari
    160159            sage: k = FiniteField_ext_pari(3**2,'a')
    161160            sage: k.gen().polynomial()
    162161            a
     
    178177        Returns True if and only if this element is a perfect square.
    179178
    180179        EXAMPLES:
    181             sage: from sage.rings.finite_field_ext_pari import FiniteField_ext_pari
     180            sage: from sage.rings.finite_field.finite_field_ext_pari import FiniteField_ext_pari
    182181            sage: k = FiniteField_ext_pari(3**2, 'a')
    183182            sage: a = k.gen()
    184183            sage: a.is_square()
     
    218217                 roots of self, instead of just one.
    219218
    220219        EXAMPLES:
    221           sage: from sage.rings.finite_field_ext_pari import FiniteField_ext_pari
     220          sage: from sage.rings.finite_field.finite_field_ext_pari import FiniteField_ext_pari
    222221          sage: F = FiniteField_ext_pari(7^2, 'a')
    223222          sage: F(2).square_root()
    224223          4
     
    312311        try to find a lift of this element to the rational numbers.
    313312
    314313        EXAMPLES:
    315             sage: from sage.rings.finite_field_ext_pari import FiniteField_ext_pari
     314            sage: from sage.rings.finite_field.finite_field_ext_pari import FiniteField_ext_pari
    316315            sage: k = GF(97)
    317316            sage: a = k(RationalField()('2/3'))
    318317            sage: a
     
    333332        must be nonzero.
    334333
    335334        EXAMPLES:
    336             sage: from sage.rings.finite_field_ext_pari import FiniteField_ext_pari
     335            sage: from sage.rings.finite_field.finite_field_ext_pari import FiniteField_ext_pari
    337336            sage: a = FiniteField_ext_pari(5**3, 'a').0
    338337            sage: a.multiplicative_order()
    339338            124
     
    361360        Return a copy of this element.
    362361
    363362        EXAMPLES:
    364             sage: from sage.rings.finite_field_ext_pari import FiniteField_ext_pari
     363            sage: from sage.rings.finite_field.finite_field_ext_pari import FiniteField_ext_pari
    365364            sage: k = FiniteField_ext_pari(3**3,'a')
    366365            sage: a = k(5)
    367366            sage: a
     
    383382        Return PARI object corresponding to this finite field element.
    384383
    385384        EXAMPLES:
    386             sage: from sage.rings.finite_field_ext_pari import FiniteField_ext_pari
     385            sage: from sage.rings.finite_field.finite_field_ext_pari import FiniteField_ext_pari
    387386            sage: k = FiniteField_ext_pari(3**3, 'a')
    388387            sage: a = k.gen()
    389388            sage: b = a**2 + 2*a + 1
     
    429428       
    430429       
    431430        EXAMPLES:
    432             sage: from sage.rings.finite_field_ext_pari import FiniteField_ext_pari
     431            sage: from sage.rings.finite_field.finite_field_ext_pari import FiniteField_ext_pari
    433432            sage: F = FiniteField_ext_pari(8,'a')
    434433            sage: a = F.multiplicative_generator()
    435434            sage: gap(a)
     
    541540    def __invert__(self):
    542541        """
    543542        EXAMPLES:
    544             sage: from sage.rings.finite_field_ext_pari import FiniteField_ext_pari
     543            sage: from sage.rings.finite_field.finite_field_ext_pari import FiniteField_ext_pari
    545544            sage: a = FiniteField_ext_pari(9, 'a').gen()
    546545            sage: ~a
    547546            a + 2
     
    559558        element to an integer.
    560559
    561560        EXAMPLES:
    562             sage: from sage.rings.finite_field_ext_pari import FiniteField_ext_pari
     561            sage: from sage.rings.finite_field.finite_field_ext_pari import FiniteField_ext_pari
    563562            sage: k = GF(next_prime(10**10))
    564563            sage: a = k(17)/k(19)
    565564            sage: b = a.lift(); b
     
    577576        it so it is one.
    578577
    579578        EXAMPLES:
    580             sage: from sage.rings.finite_field_ext_pari import FiniteField_ext_pari
     579            sage: from sage.rings.finite_field.finite_field_ext_pari import FiniteField_ext_pari
    581580            sage: a = FiniteField_ext_pari(3**3, 'a').gen()
    582581            sage: a == 1
    583582            False
  • finite_field_ext_pari.py

    diff --git a/sage/rings/finite_field_ext_pari.py b/sage/rings/finite_field/finite_field_ext_pari.py
    rename from sage/rings/finite_field_ext_pari.py
    rename to sage/rings/finite_field/finite_field_ext_pari.py
    old new  
    1717#                  http://www.gnu.org/licenses/
    1818#*****************************************************************************
    1919
    20 import polynomial.polynomial_element as polynomial_element
    21 import polynomial.multi_polynomial_element as multi_polynomial_element
     20import sage.rings.polynomial.polynomial_element as polynomial_element
     21import sage.rings.polynomial.multi_polynomial_element as multi_polynomial_element
    2222
    23 import integer
    24 import rational
    25 import integer_mod
    26 import integer_mod_ring
     23import sage.rings.integer as integer
     24import sage.rings.rational as rational
     25import sage.rings.integer_mod as integer_mod
     26import sage.rings.integer_mod_ring as integer_mod_ring
    2727
    2828import sage.libs.pari.all as pari
    2929
     
    5353        FiniteField_ext_pari -- finite field of order q.
    5454
    5555    EXAMPLES:
    56         sage: from sage.rings.finite_field_ext_pari import FiniteField_ext_pari   
     56        sage: from sage.rings.finite_field.finite_field_ext_pari import FiniteField_ext_pari   
    5757        sage: k = FiniteField_ext_pari(9, 'a')
    5858        sage: k
    5959        Finite Field in a of size 3^2
     
    8989       
    9090    Next we compute with the finite field of order 16, where
    9191    the name is named b.
    92         sage: from sage.rings.finite_field_ext_pari import FiniteField_ext_pari
     92        sage: from sage.rings.finite_field.finite_field_ext_pari import FiniteField_ext_pari
    9393        sage: k16 = FiniteField_ext_pari(16, "b")
    9494        sage: z = k16.gen()
    9595        sage: z
     
    113113        1
    114114
    115115    Illustration of dumping and loading:
    116         sage: from sage.rings.finite_field_ext_pari import FiniteField_ext_pari
     116        sage: from sage.rings.finite_field.finite_field_ext_pari import FiniteField_ext_pari
    117117        sage: K = FiniteField(7)
    118118        sage: loads(K.dumps()) == K
    119119        True
     
    257257        OUTPUT:
    258258            gen -- a pari polynomial gen
    259259        EXAMPLES:
    260             sage: from sage.rings.finite_field_ext_pari import FiniteField_ext_pari
     260            sage: from sage.rings.finite_field.finite_field_ext_pari import FiniteField_ext_pari
    261261            sage: FiniteField_ext_pari(19^2, 'a')._pari_modulus()
    262262            Mod(1, 19)*a^2 + Mod(18, 19)*a + Mod(2, 19)
    263263
     
    268268        the field variable isn't.  This is because the specific choice
    269269        of variable name has meaning in PARI, i.e., it can't be
    270270        arbitrary.
    271             sage: from sage.rings.finite_field_ext_pari import FiniteField_ext_pari
     271            sage: from sage.rings.finite_field.finite_field_ext_pari import FiniteField_ext_pari
    272272            sage: FiniteField_ext_pari(2^4, "b")._pari_modulus()
    273273            Mod(1, 2)*a^4 + Mod(1, 2)*a + Mod(1, 2)
    274274        """
     
    292292            FiniteField_ext_pariElement -- field generator of finite field
    293293           
    294294        EXAMPLES:
    295             sage: from sage.rings.finite_field_ext_pari import FiniteField_ext_pari
     295            sage: from sage.rings.finite_field.finite_field_ext_pari import FiniteField_ext_pari
    296296            sage: FiniteField_ext_pari(2^4, "b").gen()
    297297            b
    298298            sage: k = FiniteField_ext_pari(3^4, "alpha")
     
    311311        prime int.
    312312
    313313        EXAMPLES:
    314             sage: from sage.rings.finite_field_ext_pari import FiniteField_ext_pari
     314            sage: from sage.rings.finite_field.finite_field_ext_pari import FiniteField_ext_pari
    315315            sage: k = FiniteField_ext_pari(3^4, 'a')
    316316            sage: k.characteristic()
    317317            3
     
    339339        integer.
    340340
    341341        EXAMPLES:
    342             sage: from sage.rings.finite_field_ext_pari import FiniteField_ext_pari
     342            sage: from sage.rings.finite_field.finite_field_ext_pari import FiniteField_ext_pari
    343343            sage: FiniteField(3).degree()
    344344            1
    345345            sage: FiniteField_ext_pari(3^20, 'a').degree()
     
    358358            FiniteField_ext_pariElement -- if possible, makes a finite field element from x.
    359359           
    360360        EXAMPLES:
    361             sage: from sage.rings.finite_field_ext_pari import FiniteField_ext_pari
     361            sage: from sage.rings.finite_field.finite_field_ext_pari import FiniteField_ext_pari
    362362            sage: k = FiniteField_ext_pari(3^4, 'a')
    363363            sage: b = k(5)
    364364            sage: b.parent()
     
    369369
    370370        Univariate polynomials coerce into finite fields by evaluating
    371371        the polynomial at the field's generator:
    372             sage: from sage.rings.finite_field_ext_pari import FiniteField_ext_pari
     372            sage: from sage.rings.finite_field.finite_field_ext_pari import FiniteField_ext_pari
    373373            sage: R.<x> = QQ[]
    374374            sage: k, a = FiniteField_ext_pari(5^2, 'a').objgen()
    375375            sage: k(R(2/3))
     
    411411
    412412        Gap elements can also be coerced into finite fields.
    413413
    414             sage: from sage.rings.finite_field_ext_pari import FiniteField_ext_pari
     414            sage: from sage.rings.finite_field.finite_field_ext_pari import FiniteField_ext_pari
    415415            sage: F = FiniteField_ext_pari(8, 'a')
    416416            sage: a = F.multiplicative_generator(); a
    417417            a
     
    510510        Canonical coercion to \code{self}.
    511511       
    512512        EXAMPLES:
    513             sage: from sage.rings.finite_field_ext_pari import FiniteField_ext_pari
     513            sage: from sage.rings.finite_field.finite_field_ext_pari import FiniteField_ext_pari
    514514            sage: FiniteField_ext_pari(4,'a')._coerce_(GF(2)(1)) # indirect doctest
    515515            1
    516516            sage: k = FiniteField_ext_pari(4,'a')
     
    558558        The number of elements of the finite field.
    559559
    560560        EXAMPLES:
    561             sage: from sage.rings.finite_field_ext_pari import FiniteField_ext_pari
     561            sage: from sage.rings.finite_field.finite_field_ext_pari import FiniteField_ext_pari
    562562            sage: k = FiniteField_ext_pari(2^10, 'a')
    563563            sage: k
    564564            Finite Field in a of size 2^10
     
    572572        The number of elements of the finite field.
    573573
    574574        EXAMPLES:
    575             sage: from sage.rings.finite_field_ext_pari import FiniteField_ext_pari
     575            sage: from sage.rings.finite_field.finite_field_ext_pari import FiniteField_ext_pari
    576576            sage: k = FiniteField_ext_pari(2^10,'a')
    577577            sage: k
    578578            Finite Field in a of size 2^10
     
    591591            sage: k = FiniteField(17)
    592592            sage: k.polynomial('x')
    593593            x
    594             sage: from sage.rings.finite_field_ext_pari import FiniteField_ext_pari
     594            sage: from sage.rings.finite_field.finite_field_ext_pari import FiniteField_ext_pari
    595595            sage: k = FiniteField_ext_pari(9,'a')
    596596            sage: k.polynomial('x')
    597597            x^2 + 2*x + 2
  • finite_field_givaro.pyx

    diff --git a/sage/rings/finite_field_givaro.pxd b/sage/rings/finite_field/finite_field_givaro.pxd
    rename from sage/rings/finite_field_givaro.pxd
    rename to sage/rings/finite_field/finite_field_givaro.pxd
    diff --git a/sage/rings/finite_field_givaro.pyx b/sage/rings/finite_field/finite_field_givaro.pyx
    rename from sage/rings/finite_field_givaro.pyx
    rename to sage/rings/finite_field/finite_field_givaro.pyx
    old new  
    1414
    1515EXAMPLES:
    1616    sage: k = GF(5); type(k)
    17     <class 'sage.rings.finite_field_prime_modn.FiniteField_prime_modn'>
     17    <class 'sage.rings.finite_field.finite_field_prime_modn.FiniteField_prime_modn'>
    1818    sage: k = GF(5^2,'c'); type(k)
    19     <type 'sage.rings.finite_field_givaro.FiniteField_givaro'>
     19    <type 'sage.rings.finite_field.finite_field_givaro.FiniteField_givaro'>
    2020    sage: k = GF(2^16,'c'); type(k)
    21     <type 'sage.rings.finite_field_ntl_gf2e.FiniteField_ntl_gf2e'>
     21    <type 'sage.rings.finite_field.finite_field_ntl_gf2e.FiniteField_ntl_gf2e'>
    2222    sage: k = GF(3^16,'c'); type(k)
    23     <class 'sage.rings.finite_field_ext_pari.FiniteField_ext_pari'>
     23    <class 'sage.rings.finite_field.finite_field_ext_pari.FiniteField_ext_pari'>
    2424
    2525    sage: n = previous_prime_power(2^16 - 1)
    2626    sage: while is_prime(n):
     
    2828    sage: factor(n)
    2929    251^2
    3030    sage: k = GF(n,'c'); type(k)
    31     <type 'sage.rings.finite_field_givaro.FiniteField_givaro'>
     31    <type 'sage.rings.finite_field.finite_field_givaro.FiniteField_givaro'>
    3232
    3333AUTHORS:
    3434     -- Martin Albrecht <malb@informatik.uni-bremen.de> (2006-06-05)
     
    5555#                  http://www.gnu.org/licenses/
    5656#*****************************************************************************
    5757
    58 include "../ext/interrupt.pxi"
     58include "../../ext/interrupt.pxi"
    5959
    6060# this fails with a scoping error:
    6161#   AttributeError: CVoidType instance has no attribute 'scope'
     
    7272from sage.rings.ring cimport FiniteField
    7373from sage.rings.ring cimport Ring
    7474from sage.structure.element cimport FiniteFieldElement, Element, RingElement, ModuleElement
    75 from sage.rings.finite_field_element import FiniteField_ext_pariElement
     75from finite_field_element import FiniteField_ext_pariElement
    7676from sage.structure.sage_object cimport SageObject
    7777import operator
    7878import sage.rings.arith
     
    9898cdef object Polynomial
    9999cdef object FreeModuleElement
    100100
    101 cdef void late_import():
     101cdef int late_import() except -1:
    102102    """
    103103    """
    104104    global is_IntegerMod, \
     
    113113           FreeModuleElement
    114114
    115115    if is_IntegerMod is not None:
    116         return
     116        return 0
    117117
    118     import sage.rings.integer_mod
    119     is_IntegerMod = sage.rings.integer_mod.is_IntegerMod
    120 
    121     import sage.rings.integer_mod_ring
    122     IntegerModRing_generic = sage.rings.integer_mod_ring.IntegerModRing_generic
    123 
    124     import sage.rings.integer
    125     Integer = sage.rings.integer.Integer
    126 
    127     import sage.rings.rational
    128     Rational = sage.rings.rational.Rational
    129 
    130     import sage.rings.polynomial.polynomial_element
    131     is_Polynomial = sage.rings.polynomial.polynomial_element.is_Polynomial
    132    
    133     import sage.databases.conway
    134     ConwayPolynomials = sage.databases.conway.ConwayPolynomials
    135    
    136     import sage.rings.finite_field
    137     conway_polynomial = sage.rings.finite_field.conway_polynomial
    138 
    139     import sage.rings.polynomial.multi_polynomial_element
    140     MPolynomial = sage.rings.polynomial.multi_polynomial_element.MPolynomial
    141 
    142     import sage.rings.polynomial.polynomial_element
    143     Polynomial = sage.rings.polynomial.polynomial_element.Polynomial
    144 
    145     import sage.modules.free_module_element
    146     FreeModuleElement = sage.modules.free_module_element.FreeModuleElement
     118    from sage.rings.integer_mod import is_IntegerMod
     119    from sage.rings.integer_mod_ring import IntegerModRing_generic
     120    from sage.rings.integer import Integer
     121    from sage.rings.rational import Rational
     122    from sage.rings.polynomial.polynomial_element import is_Polynomial
     123    from sage.databases.conway import ConwayPolynomials
     124    from finite_field import conway_polynomial
     125    from sage.rings.polynomial.multi_polynomial_element import MPolynomial
     126    from sage.rings.polynomial.polynomial_element import Polynomial
     127    from sage.modules.free_module_element import FreeModuleElement
    147128
    148129cdef FiniteField_givaro parent_object(Element o):
    149130    return <FiniteField_givaro>(o._parent)
     
    206187
    207188            Three different representations are possible:
    208189           
    209             sage: sage.rings.finite_field_givaro.FiniteField_givaro(9,repr='poly').gen()
     190            sage: sage.rings.finite_field.finite_field_givaro.FiniteField_givaro(9,repr='poly').gen()
    210191            a
    211             sage: sage.rings.finite_field_givaro.FiniteField_givaro(9,repr='int').gen()
     192            sage: sage.rings.finite_field.finite_field_givaro.FiniteField_givaro(9,repr='int').gen()
    212193            3
    213             sage: sage.rings.finite_field_givaro.FiniteField_givaro(9,repr='log').gen()
     194            sage: sage.rings.finite_field.finite_field_givaro.FiniteField_givaro(9,repr='log').gen()
    214195            5
    215196        """
    216197
     
    371352            sage: e = k.random_element(); e
    372353            9*a^2 + 10*a + 3
    373354            sage: type(e)
    374             <type 'sage.rings.finite_field_givaro.FiniteField_givaroElement'>
     355            <type 'sage.rings.finite_field.finite_field_givaro.FiniteField_givaroElement'>
    375356
    376357            sage: P.<x> = PowerSeriesRing(GF(3^3, 'a'))
    377358            sage: P.random_element(5)
     
    432413
    433414        Univariate polynomials coerce into finite fields by evaluating
    434415        the polynomial at the field's generator:
    435             sage: from sage.rings.finite_field_givaro import FiniteField_givaro
     416            sage: from sage.rings.finite_field.finite_field_givaro import FiniteField_givaro
    436417            sage: R.<x> = QQ[]
    437418            sage: k, a = FiniteField_givaro(5^2, 'a').objgen()
    438419            sage: k(R(2/3))
     
    479460
    480461            GAP elements need to be finite field elements:
    481462
    482             sage: from sage.rings.finite_field_givaro import FiniteField_givaro
     463            sage: from sage.rings.finite_field.finite_field_givaro import FiniteField_givaro
    483464            sage: x = gap('Z(13)')
    484465            sage: F = FiniteField_givaro(13)
    485466            sage: F(x)
     
    500481            sage: k(48771/1225)
    501482            28
    502483
    503             sage: from sage.rings.finite_field_givaro import FiniteField_givaro
     484            sage: from sage.rings.finite_field.finite_field_givaro import FiniteField_givaro
    504485            sage: F9 = FiniteField_givaro(9)
    505486            sage: F81 = FiniteField_givaro(81)
    506487            sage: F81(F9.gen())
     
    646627            Traceback (most recent call last):
    647628            ...
    648629            IndexError: only one generator
    649             sage: F=sage.rings.finite_field_givaro.FiniteField_givaro(31)
     630            sage: F=sage.rings.finite_field.finite_field_givaro.FiniteField_givaro(31)
    650631            sage: F.gen()
    651632            3
    652633            sage: F.gen().multiplicative_order()
     
    680661            sage: S.prime_subfield()
    681662            Finite Field of size 5
    682663            sage: type(S.prime_subfield())
    683             <class 'sage.rings.finite_field_prime_modn.FiniteField_prime_modn'>           
     664            <class 'sage.rings.finite_field.finite_field_prime_modn.FiniteField_prime_modn'>           
    684665        """
    685666        return self.prime_subfield_C()
    686667
     
    898879            sage: k._element_repr(a^20)
    899880            '2*a^3 + 2*a^2 + 2'
    900881           
    901             sage: k = sage.rings.finite_field_givaro.FiniteField_givaro(3^4,'a', repr='int')
     882            sage: k = sage.rings.finite_field.finite_field_givaro.FiniteField_givaro(3^4,'a', repr='int')
    902883            sage: a = k.gen()
    903884            sage: k._element_repr(a^20)
    904885            '74'
    905886           
    906             sage: k = sage.rings.finite_field_givaro.FiniteField_givaro(3^4,'a', repr='log')
     887            sage: k = sage.rings.finite_field.finite_field_givaro.FiniteField_givaro(3^4,'a', repr='log')
    907888            sage: a = k.gen()
    908889            sage: k._element_repr(a^20)
    909890            '20'
     
    10581039        else:
    10591040            cache = 1
    10601041       
    1061         return sage.rings.finite_field_givaro.unpickle_FiniteField_givaro, \
     1042        return unpickle_FiniteField_givaro, \
    10621043               (self.order_c(),(self.variable_name(),),
    10631044                map(int,list(self.modulus())),int(self.repr),int(self._array is not None))
    10641045
     
    11681149
    11691150        EXAMPLE:
    11701151            sage: k.<a> = GF(5^2)
    1171             sage: from sage.rings.finite_field_givaro import FiniteField_givaroElement
     1152            sage: from sage.rings.finite_field.finite_field_givaro import FiniteField_givaroElement
    11721153            sage: FiniteField_givaroElement(k)
    11731154            0
    11741155           
     
    18191800            sage: b.charpoly('x')
    18201801            x^2 + 4*x + 2
    18211802            sage: P = S._finite_field_ext_pari_(); type(P)
    1822             <class 'sage.rings.finite_field_ext_pari.FiniteField_ext_pari'>
     1803            <class 'sage.rings.finite_field.finite_field_ext_pari.FiniteField_ext_pari'>
    18231804            sage: c = b._finite_field_ext_pari_element(P); c
    18241805            b
    18251806            sage: type(c)
    1826             <class 'sage.rings.finite_field_element.FiniteField_ext_pariElement'>           
     1807            <class 'sage.rings.finite_field.finite_field_element.FiniteField_ext_pariElement'>           
    18271808            sage: c.charpoly('x')
    18281809            x^2 + 4*x + 2
    18291810
     
    18311812            sage: d = b._finite_field_ext_pari_element(); d
    18321813            b
    18331814            sage: type(d)
    1834             <class 'sage.rings.finite_field_element.FiniteField_ext_pariElement'>           
     1815            <class 'sage.rings.finite_field.finite_field_element.FiniteField_ext_pariElement'>           
    18351816        """
    18361817        if k is None:
    18371818            k = (<FiniteField_givaro>self._parent)._finite_field_ext_pari_()
  • finite_field_ntl_gf2e.pxd

    diff --git a/sage/rings/finite_field_morphism.py b/sage/rings/finite_field/finite_field_morphism.py
    rename from sage/rings/finite_field_morphism.py
    rename to sage/rings/finite_field/finite_field_morphism.py
    diff --git a/sage/rings/finite_field_ntl_gf2e.pxd b/sage/rings/finite_field/finite_field_ntl_gf2e.pxd
    rename from sage/rings/finite_field_ntl_gf2e.pxd
    rename to sage/rings/finite_field/finite_field_ntl_gf2e.pxd
    old new  
    1 include "../libs/ntl/decl.pxi"
     1include "../../libs/ntl/decl.pxi"
    22
    33from sage.rings.ring cimport FiniteField
    44from sage.structure.element cimport FiniteFieldElement, Element, RingElement, ModuleElement
  • finite_field_ntl_gf2e.pyx

    diff --git a/sage/rings/finite_field_ntl_gf2e.pyx b/sage/rings/finite_field/finite_field_ntl_gf2e.pyx
    rename from sage/rings/finite_field_ntl_gf2e.pyx
    rename to sage/rings/finite_field/finite_field_ntl_gf2e.pyx
    old new  
    2626#
    2727#                  http://www.gnu.org/licenses/
    2828#*****************************************************************************
    29 include "../libs/ntl/decl.pxi"
    30 include "../ext/interrupt.pxi"
    31 include "../ext/stdsage.pxi"
     29include "../../libs/ntl/decl.pxi"
     30include "../../ext/interrupt.pxi"
     31include "../../ext/stdsage.pxi"
    3232
    3333from sage.structure.sage_object cimport SageObject
    3434
     
    5353from finite_field_ext_pari import FiniteField_ext_pari
    5454from finite_field_element import FiniteField_ext_pariElement
    5555
    56 from polynomial.polynomial_ring_constructor import PolynomialRing
     56from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
    5757
    5858cdef object is_IntegerMod
    5959cdef object IntegerModRing_generic
     
    6868cdef object GF
    6969cdef object GF2, GF2_0, GF2_1
    7070
    71 cdef void late_import():
     71cdef int late_import() except -1:
    7272    """
    7373    Import a bunch of objects to the module name space late,
    7474    i.e. after the module was loaded. This is needed to avoid circular
     
    8888           GF2, GF2_0, GF2_1
    8989
    9090    if is_IntegerMod is not None:
    91         return
     91        return 0
    9292
    93     import sage.rings.integer_mod
    94     is_IntegerMod = sage.rings.integer_mod.is_IntegerMod
     93    from sage.rings.integer_mod import is_IntegerMod
     94    from sage.rings.integer_mod_ring import IntegerModRing_generic
     95    from sage.rings.integer import Integer
     96    from sage.rings.rational import Rational
     97    from sage.rings.polynomial.polynomial_element import is_Polynomial
     98    from sage.databases.conway import ConwayPolynomials
     99    from finite_field import conway_polynomial
     100    from sage.rings.polynomial.multi_polynomial_element import MPolynomial
     101    from sage.rings.polynomial.polynomial_element import Polynomial
     102    from sage.modules.free_module_element import FreeModuleElement
    95103
    96     import sage.rings.integer_mod_ring
    97     IntegerModRing_generic = sage.rings.integer_mod_ring.IntegerModRing_generic
    98 
    99     import sage.rings.integer
    100     Integer = sage.rings.integer.Integer
    101 
    102     import sage.rings.rational
    103     Rational = sage.rings.rational.Rational
    104 
    105     import sage.rings.polynomial.polynomial_element
    106     is_Polynomial = sage.rings.polynomial.polynomial_element.is_Polynomial
    107    
    108     import sage.databases.conway
    109     ConwayPolynomials = sage.databases.conway.ConwayPolynomials
    110    
    111     import sage.rings.finite_field
    112     conway_polynomial = sage.rings.finite_field.conway_polynomial
    113 
    114     import sage.rings.polynomial.multi_polynomial_element
    115     MPolynomial = sage.rings.polynomial.multi_polynomial_element.MPolynomial
    116 
    117     import sage.rings.polynomial.polynomial_element
    118     Polynomial = sage.rings.polynomial.polynomial_element.Polynomial
    119 
    120     import sage.modules.free_module_element
    121     FreeModuleElement = sage.modules.free_module_element.FreeModuleElement
    122 
    123     import sage.rings.finite_field
    124     GF = sage.rings.finite_field.FiniteField
     104    from finite_field import GF
    125105    GF2 = GF(2)
    126106    GF2_0 = GF2(0)
    127107    GF2_1 = GF2(1)
     
    162142        EXAMPLE:
    163143            sage: k.<a> = GF(2^16)
    164144            sage: type(k)
    165             <type 'sage.rings.finite_field_ntl_gf2e.FiniteField_ntl_gf2e'>
     145            <type 'sage.rings.finite_field.finite_field_ntl_gf2e.FiniteField_ntl_gf2e'>
    166146            sage: k.<a> = GF(2^1024)
    167147            sage: k.modulus()
    168148            x^1024 + x^19 + x^6 + x + 1
     
    582562            sage: kP
    583563            Finite Field in a of size 2^20
    584564            sage: type(kP)
    585             <class 'sage.rings.finite_field_ext_pari.FiniteField_ext_pari'>
     565            <class 'sage.rings.finite_field.finite_field_ext_pari.FiniteField_ext_pari'>
    586566        """
    587567        f = self.polynomial()
    588568        return FiniteField_ext_pari(self.order(), self.variable_name(), f)
     
    659639
    660640        EXAMPLE:
    661641            sage: k.<a> = GF(2^16)
    662             sage: from sage.rings.finite_field_ntl_gf2e import FiniteField_ntl_gf2eElement
     642            sage: from sage.rings.finite_field.finite_field_ntl_gf2e import FiniteField_ntl_gf2eElement
    663643            sage: FiniteField_ntl_gf2eElement(k)
    664644            0
    665645        """
  • finite_field_prime_modn.py

    diff --git a/sage/rings/finite_field_prime_modn.py b/sage/rings/finite_field/finite_field_prime_modn.py
    rename from sage/rings/finite_field_prime_modn.py
    rename to sage/rings/finite_field/finite_field_prime_modn.py
    old new  
    2929
    3030import sys
    3131
    32 from ring import FiniteField as FiniteField_generic
     32from sage.rings.ring import FiniteField as FiniteField_generic
    3333from sage.structure.parent_gens import normalize_names, ParentWithGens
    3434
    35 import integer_mod_ring
    36 import integer
    37 import rational
    38 import integer_mod
    39 import arith
     35import sage.rings.integer_mod_ring as integer_mod_ring
     36import sage.rings.integer as integer
     37import sage.rings.rational as rational
     38import sage.rings.integer_mod as integer_mod
     39import sage.rings.arith as arith
    4040
    4141
    4242class FiniteField_prime_modn(FiniteField_generic, integer_mod_ring.IntegerModRing_generic):
     
    176176        try:
    177177            return self.__polynomial[name]
    178178        except  AttributeError:
    179             from sage.rings.finite_field import FiniteField
     179            from finite_field import FiniteField
    180180            R = FiniteField(self.characteristic())[name]
    181181            f = self[name]([0,1])
    182182            try:
  • sage/rings/integer_mod.pyx

    diff --git a/sage/rings/integer_mod.pyx b/sage/rings/integer_mod.pyx
    a b  
    710710                R = self.parent()['x']
    711711                modulus = R.gen()**2 - R(self)
    712712                if self._parent.is_field():
    713                     import finite_field
    714                     Q = finite_field.FiniteField(self.__modulus.sageInteger**2, y, modulus)
     713                    from finite_field.all import FiniteField
     714                    Q = FiniteField(self.__modulus.sageInteger**2, y, modulus)
    715715                else:
    716716                    R = self.parent()['x']
    717717                    Q = R.quotient(modulus, names=(y,))
  • sage/rings/integer_mod_ring.py

    diff --git a/sage/rings/integer_mod_ring.py b/sage/rings/integer_mod_ring.py
    a b  
    6565import rational
    6666import quotient_ring
    6767import ideal
    68 import finite_field_element
     68import sage.rings.finite_field.finite_field_element as finite_field_element
    6969from sage.structure.parent_gens import ParentWithGens
    7070
    7171from sage.libs.pari.all import pari, PariError
     
    344344        except AttributeError:
    345345            if not self.is_field():
    346346                raise ValueError, "self must be a field"
    347             import finite_field
    348             k = finite_field.FiniteField(self.order())
     347            from finite_field.all import FiniteField
     348            k = FiniteField(self.order())
    349349            self.__field = k
    350350            return k
    351351
  • sage/rings/number_field/number_field_ideal.py

    diff --git a/sage/rings/number_field/number_field_ideal.py b/sage/rings/number_field/number_field_ideal.py
    a b  
    4343import sage.rings.integer as integer
    4444import sage.rings.arith as arith
    4545import sage.misc.misc as misc
    46 from sage.rings.finite_field import FiniteField
     46from sage.rings.finite_field.all import FiniteField
    4747
    4848import number_field
    4949import number_field_element
  • sage/rings/padics/factory.py

    diff --git a/sage/rings/padics/factory.py b/sage/rings/padics/factory.py
    a b  
    165165        return Qp(q, prec, type, print_mode, halt, names, check)
    166166    base = Qp(F[0][0], prec, type, print_mode, halt, qp_name, check = False)
    167167    if modulus is None:
    168         from sage.rings.finite_field import FiniteField as GF
     168        from sage.rings.finite_field.all import FiniteField as GF
    169169        from sage.rings.integer_ring import ZZ
    170170        from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
    171171        if qp_name is None:
     
    413413        return Zp(q, prec, type, print_mode, halt, names, check)
    414414    base = Zp(F[0][0], prec, type, print_mode, halt, zp_name, check = False)
    415415    if modulus is None:
    416         from sage.rings.finite_field import FiniteField as GF
     416        from sage.rings.finite_field.all import FiniteField as GF
    417417        if zp_name is None:
    418418            zp_name = (str(F[0][0]),)
    419419        modulus = PolynomialRing(base, 'x')(GF(q, names).modulus().change_ring(ZZ))
  • sage/rings/padics/local_generic_element.pyx

    diff --git a/sage/rings/padics/local_generic_element.pyx b/sage/rings/padics/local_generic_element.pyx
    a b  
    22import sage.rings.integer
    33import sage.rings.rational
    44import sage.rings.integer_mod
    5 import sage.rings.finite_field_element
    65from sage.rings.infinity import infinity
    76import sage.rings.arith
    87import sage.rings.padics.precision_error
  • sage/rings/padics/padic_field_capped_relative.py

    diff --git a/sage/rings/padics/padic_field_capped_relative.py b/sage/rings/padics/padic_field_capped_relative.py
    a b  
    111111#import sage.rings.integer_mod
    112112import sage.rings.integer
    113113import sage.rings.rational
    114 #import sage.rings.finite_field
    115114import sage.rings.padics.padic_capped_relative_element
    116115import sage.rings.padics.padic_field_base_generic
    117116import sage.rings.padics.padic_capped_relative_field_generic
  • sage/rings/padics/padic_generic.py

    diff --git a/sage/rings/padics/padic_generic.py b/sage/rings/padics/padic_generic.py
    a b  
    5252#*****************************************************************************
    5353
    5454import sage.rings.infinity
    55 import sage.rings.finite_field
     55import sage.rings.finite_field as finite_field
    5656import sage.rings.padics.local_generic
    5757import sage.rings.integer_mod
    5858import sage.rings.ring
     
    254254            sage: k
    255255                Finite Field of size 3
    256256        """
    257         return sage.rings.finite_field.FiniteField(self.prime())
     257        return finite_field.all.FiniteField(self.prime())
    258258
    259259    residue_field = residue_class_field
    260260
     
    491491            else:
    492492                raise ValueError, "No, %sth root of unity in self"%n
    493493        else:
    494             return self.teichmuller(sage.rings.finite_field.FiniteField(self.prime()).zeta(n).lift())
     494            return self.teichmuller(finite_field.all.FiniteField(self.prime()).zeta(n).lift())
    495495
    496496    def zeta_order(self):
    497497        """
  • sage/rings/padics/unramified_extension_generic.py

    diff --git a/sage/rings/padics/unramified_extension_generic.py b/sage/rings/padics/unramified_extension_generic.py
    a b  
    11import padic_ring_base_generic
    2 import sage.rings.finite_field
    32from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
    43import sage.rings.polynomial.polynomial_quotient_ring as pqr
    54#import sage.rings.padics.unramified_extension_generic_element
  • sage/rings/polynomial/multi_polynomial_libsingular.pyx

    diff --git a/sage/rings/polynomial/multi_polynomial_libsingular.pyx b/sage/rings/polynomial/multi_polynomial_libsingular.pyx
    a b  
    7474
    7575# base ring imports
    7676from sage.rings.rational_field import RationalField
    77 from sage.rings.finite_field_prime_modn import FiniteField_prime_modn
     77from sage.rings.finite_field.finite_field_prime_modn import FiniteField_prime_modn
    7878from sage.rings.ring import FiniteField as FiniteField_generic
    79 from sage.rings.finite_field_givaro cimport FiniteField_givaroElement
    80 from sage.rings.finite_field_givaro cimport FiniteField_givaro
     79from sage.rings.finite_field.finite_field_givaro cimport FiniteField_givaroElement
     80from sage.rings.finite_field.finite_field_givaro cimport FiniteField_givaro
    8181from sage.rings.number_field.number_field_base cimport NumberField
    8282from sage.rings.rational cimport Rational
    8383from sage.rings.complex_field import is_ComplexField
  • sage/rings/polynomial/pbori.pyx

    diff --git a/sage/rings/polynomial/pbori.pyx b/sage/rings/polynomial/pbori.pyx
    a b  
    155155
    156156from sage.misc.randstate import current_randstate
    157157from sage.rings.integer import Integer
    158 from sage.rings.finite_field import FiniteField as GF
     158from sage.rings.finite_field.all import FiniteField as GF
    159159
    160160from sage.rings.polynomial.polynomial_element cimport Polynomial
    161161from sage.rings.polynomial.multi_polynomial_ideal import MPolynomialIdeal
  • sage/rings/polynomial/polynomial_element.pyx

    diff --git a/sage/rings/polynomial/polynomial_element.pyx b/sage/rings/polynomial/polynomial_element.pyx
    a b  
    20072007       
    20082008        from sage.rings.number_field.all import is_NumberField, \
    20092009             is_RelativeNumberField, NumberField
    2010         from sage.rings.finite_field import is_FiniteField
     2010        from sage.rings.finite_field.all import is_FiniteField
    20112011        from sage.rings.integer_mod_ring import is_IntegerModRing
    20122012        from sage.rings.integer_ring import is_IntegerRing
    20132013        from sage.rings.rational_field import is_RationalField
  • sage/rings/polynomial/polynomial_element_generic.py

    diff --git a/sage/rings/polynomial/polynomial_element_generic.py b/sage/rings/polynomial/polynomial_element_generic.py
    a b  
    950950            sage: (x^5 + 2).factor_mod(5)
    951951            (x + 2)^5       
    952952        """
    953         import sage.rings.finite_field as finite_field
     953        from sage.rings.finite_field.all import  FiniteField
    954954        p = integer.Integer(p)
    955955        if not p.is_prime():
    956956            raise ValueError, "p must be prime"
    957957        G = self._pari_().factormod(p)
    958         K = finite_field.FiniteField(p)
     958        K = FiniteField(p)
    959959        R = K[self.parent().variable_name()]
    960960        return R(1)._factor_pari_helper(G, unit=R(self).leading_coefficient())
    961961
  • sage/rings/polynomial/polynomial_integer_dense_flint.pyx

    diff --git a/sage/rings/polynomial/polynomial_integer_dense_flint.pyx b/sage/rings/polynomial/polynomial_integer_dense_flint.pyx
    a b  
    10601060            sage: f.factor_mod(7)
    10611061            (2) * x * (x + 5)^2
    10621062        """
    1063         from sage.rings.finite_field import FiniteField
     1063        from sage.rings.finite_field.all import FiniteField
    10641064        p = Integer(p)
    10651065        if not p.is_prime():
    10661066            raise ValueError, "p must be prime"
  • sage/rings/polynomial/polynomial_singular_interface.py

    diff --git a/sage/rings/polynomial/polynomial_singular_interface.py b/sage/rings/polynomial/polynomial_singular_interface.py
    a b  
    3434#
    3535######################################################################
    3636
    37 import sage.rings.finite_field
    3837import sage.rings.number_field as number_field
    3938
    4039from sage.interfaces.all import singular as singular_default
  • sage/rings/residue_field.pyx

    diff --git a/sage/rings/residue_field.pyx b/sage/rings/residue_field.pyx
    a b  
    7171from sage.rings.all import ZZ, QQ, Integers
    7272from sage.rings.number_field.number_field_ideal import is_NumberFieldIdeal
    7373import weakref
    74 from sage.rings.finite_field import FiniteField as GF
    75 from sage.rings.finite_field_givaro import FiniteField_givaro
    76 from sage.rings.finite_field_prime_modn import FiniteField_prime_modn
    77 from sage.rings.finite_field_ext_pari import FiniteField_ext_pari
     74from sage.rings.finite_field.all import FiniteField as GF
     75from sage.rings.finite_field.finite_field_givaro import FiniteField_givaro
     76from sage.rings.finite_field.finite_field_prime_modn import FiniteField_prime_modn
     77from sage.rings.finite_field.finite_field_ext_pari import FiniteField_ext_pari
    7878from sage.structure.parent_base import ParentWithBase
    7979
    8080from sage.modules.free_module_element import FreeModuleElement
  • sage/rings/ring.pyx

    diff --git a/sage/rings/ring.pyx b/sage/rings/ring.pyx
    a b  
    14321432            Finite Field of size 3
    14331433        """
    14341434        if self.characteristic() == 0:
    1435             import sage.rings.rational_field
    1436             return sage.rings.rational_field.RationalField()
     1435            from sage.rings.rational_field import QQ
     1436            return QQ
    14371437        else:
    1438             import sage.rings.finite_field
    1439             return sage.rings.finite_field.FiniteField(self.characteristic())
     1438            from sage.rings.finite_field.all import FiniteField
     1439            return FiniteField(self.characteristic())
    14401440
    14411441cdef class FiniteFieldIterator:
    14421442    cdef object iter
     
    16891689            sage: K.Hom(K)
    16901690            Automorphism group of Finite Field in a of size 5^2
    16911691        """
    1692         from sage.rings.finite_field_morphism import FiniteFieldHomset
     1692        from sage.rings.finite_field.finite_field_morphism import FiniteFieldHomset
    16931693        return FiniteFieldHomset(self, codomain)
    16941694
    16951695    def gen(self):
     
    19521952            Univariate Polynomial Ring in alpha over Finite Field of size 3
    19531953        """
    19541954        from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
    1955         from sage.rings.finite_field import FiniteField as GF
     1955        from sage.rings.finite_field.all import FiniteField as GF
    19561956       
    19571957        if variable_name is None and self.__polynomial_ring is not None:
    19581958            return self.__polynomial_ring
  • sage/schemes/hyperelliptic_curves/hyperelliptic_finite_field.py

    diff --git a/sage/schemes/hyperelliptic_curves/hyperelliptic_finite_field.py b/sage/schemes/hyperelliptic_curves/hyperelliptic_finite_field.py
    a b  
    178178            sage: len(C.points())
    179179            122
    180180        """
    181         from sage.rings.finite_field import zech_log_bound
     181        from sage.rings.finite_field.finite_field import zech_log_bound
    182182        try:
    183183            return self.__points
    184184        except AttributeError: pass
  • setup.py

    diff --git a/setup.py b/setup.py
    a b  
    258258                       )
    259259
    260260
    261 finite_field_givaro = Extension('sage.rings.finite_field_givaro',
    262                        sources = ["sage/rings/finite_field_givaro.pyx"],
     261finite_field_givaro = Extension('sage.rings.finite_field.finite_field_givaro',
     262                       sources = ["sage/rings/finite_field/finite_field_givaro.pyx"],
    263263                       libraries = ['givaro', 'gmpxx', 'gmp', 'm', 'stdc++', ],   # this order is needed to compile under windows.
    264264                       language='c++'
    265265                       )
    266 finite_field_ntl_gf2e = Extension('sage.rings.finite_field_ntl_gf2e',
    267              sources = ['sage/rings/finite_field_ntl_gf2e.pyx'],
     266finite_field_ntl_gf2e = Extension('sage.rings.finite_field.finite_field_ntl_gf2e',
     267             sources = ['sage/rings/finite_field/finite_field_ntl_gf2e.pyx'],
    268268             libraries = ['ntl', 'gmp'],
    269269             language = 'c++')
    270270
     
    15021502                     'sage.quadratic_forms.genera',
    15031503
    15041504                     'sage.rings',
     1505                     'sage.rings.finite_field',
    15051506                     'sage.rings.number_field',
    15061507                     'sage.rings.padics',
    15071508                     'sage.rings.polynomial',