Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/sage/coding/bch_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
from sage.modules.free_module_element import vector
from sage.misc.misc_c import prod
from sage.categories.fields import Fields
from sage.arith.all import gcd
from sage.rings.all import Zmod
from sage.arith.misc import gcd
from sage.rings.finite_rings.integer_mod_ring import IntegerModRing as Zmod

from .cyclic_code import CyclicCode
from .grs_code import GeneralizedReedSolomonCode
Expand Down
2 changes: 1 addition & 1 deletion src/sage/coding/binary_code.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -4103,7 +4103,7 @@ cdef class BinaryCodeClassifier:
m = BinaryCode(matrix(ZZ, rs))

m_aut_gp_gens, m_labeling, m_size, m_base = self._aut_gp_and_can_label(m)
from sage.arith.all import factorial
from sage.arith.misc import factorial
if True: # size*factorial(n-B.ncols) == m_size:

if len(m_aut_gp_gens) == 0:
Expand Down
9 changes: 6 additions & 3 deletions src/sage/coding/code_bounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,14 @@
# https://www.gnu.org/licenses/
# ****************************************************************************

from sage.arith.misc import binomial, is_prime_power
from sage.libs.gap.libgap import libgap
from sage.rings.all import QQ, RR, ZZ, RDF
from sage.arith.misc import is_prime_power
from sage.arith.all import binomial
from sage.misc.functional import sqrt, log
from sage.rings.integer_ring import ZZ
from sage.rings.rational_field import QQ
from sage.rings.real_double import RDF
from sage.rings.real_mpfr import RR

from .delsarte_bounds import (delsarte_bound_hamming_space,
delsarte_bound_additive_hamming_space)
from sage.features.gap import GapPackage
Expand Down
15 changes: 6 additions & 9 deletions src/sage/coding/code_constructions.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,17 @@
# https://www.gnu.org/licenses/
# ****************************************************************************

from sage.misc.misc_c import prod
from sage.arith.all import quadratic_residues, gcd

from sage.structure.sequence import Sequence, Sequence_generic

from sage.matrix.matrix_space import MatrixSpace
from sage.arith.misc import gcd, quadratic_residues
from sage.matrix.constructor import matrix
from sage.matrix.matrix_space import MatrixSpace
from sage.matrix.special import random_matrix

from sage.misc.misc_c import prod
from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF
from sage.rings.finite_rings.integer_mod import Mod
from sage.rings.finite_rings.integer_mod_ring import IntegerModRing
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
from sage.rings.integer import Integer
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
from sage.structure.sequence import Sequence, Sequence_generic

from .linear_code import LinearCode

Expand Down Expand Up @@ -753,7 +750,7 @@ def ToricCode(P,F):

- David Joyner (07-2006)
"""
from sage.combinat.all import Tuples
from sage.combinat.tuple import Tuples
mset = [x for x in F if x != 0]
d = len(P[0])
pts = Tuples(mset, d).list()
Expand Down
4 changes: 2 additions & 2 deletions src/sage/coding/cyclic_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@
from copy import copy
from sage.rings.integer import Integer
from sage.categories.homset import Hom
from sage.arith.all import gcd
from sage.arith.misc import gcd
from sage.modules.free_module_element import vector
from sage.matrix.constructor import matrix
from sage.misc.cachefunc import cached_method
from sage.rings.all import Zmod
from sage.rings.finite_rings.integer_mod_ring import IntegerModRing as Zmod


def find_generator_polynomial(code, check=True):
Expand Down
7 changes: 3 additions & 4 deletions src/sage/coding/delsarte_bounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def krawtchouk(n, q, l, x, check=True):
...
TypeError: no conversion of this rational to integer
"""
from sage.arith.all import binomial
from sage.arith.misc import binomial
from sage.arith.srange import srange
# Use the expression in equation (55) of MacWilliams & Sloane, pg 151
# We write jth term = some_factor * (j-1)th term
Expand Down Expand Up @@ -171,7 +171,7 @@ def eberlein(n, w, k, u, check=True):
TypeError: either m or x-m must be an integer

"""
from sage.arith.all import binomial
from sage.arith.misc import binomial
from sage.arith.srange import srange

if 2*w > n:
Expand Down Expand Up @@ -275,7 +275,7 @@ def _delsarte_cwc_LP_building(n, d, w, solver, isinteger):

"""
from sage.numerical.mip import MixedIntegerLinearProgram
from sage.arith.all import binomial
from sage.arith.misc import binomial

p = MixedIntegerLinearProgram(maximization=True, solver=solver)
A = p.new_variable(integer=isinteger, nonnegative=True)
Expand Down Expand Up @@ -602,7 +602,6 @@ def _delsarte_Q_LP_building(q, d, solver, isinteger):
EXAMPLES::

sage: from sage.coding.delsarte_bounds import _delsarte_Q_LP_building
sage: from sage.all import *
sage: q = Matrix([[codes.bounds.krawtchouk(6,2,i,j) for j in range(7)] for i in range(7)])
sage: _, p = _delsarte_Q_LP_building(q, 2, "PPL", False)
sage: p.show()
Expand Down
6 changes: 5 additions & 1 deletion src/sage/coding/information_set_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@
# http://www.gnu.org/licenses/
#******************************************************************************

from sage.all import ZZ, Integer, vector, SageObject, binomial
from sage.rings.integer_ring import ZZ
from sage.rings.integer import Integer
from sage.modules.free_module_element import free_module_element as vector
from sage.structure.sage_object import SageObject
from sage.functions.other import binomial
from .decoder import Decoder


Expand Down
35 changes: 18 additions & 17 deletions src/sage/coding/linear_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,32 +205,33 @@ class should inherit from this class. Also ``AbstractLinearCode`` should never
import os
import subprocess

from io import StringIO
from copy import copy
from io import StringIO

from sage.cpython.string import bytes_to_str
from sage.arith.misc import binomial, GCD
from sage.categories.cartesian_product import cartesian_product
from sage.categories.fields import Fields
from sage.coding.decoder import Decoder
from sage.coding.encoder import Encoder
from sage.coding.linear_code_no_metric import AbstractLinearCodeNoMetric
from sage.combinat.subset import Subsets
from sage.cpython.string import bytes_to_str
from sage.features.gap import GapPackage
from sage.groups.all import SymmetricGroup
from sage.groups.perm_gps.permgroup import PermutationGroup
from sage.interfaces.gap import gap
from sage.matrix.matrix_space import MatrixSpace
from sage.misc.cachefunc import cached_method
from sage.misc.functional import is_even
from sage.misc.misc_c import prod
from sage.misc.randstate import current_randstate
from sage.modules.free_module import VectorSpace
from sage.modules.free_module_element import vector
from sage.arith.all import GCD, binomial
from sage.groups.all import SymmetricGroup
from sage.groups.perm_gps.permgroup import PermutationGroup
from sage.rings.rational_field import QQ
from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF
from sage.rings.integer import Integer
from sage.rings.integer_ring import ZZ
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
from sage.rings.integer import Integer
from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF
from sage.misc.misc_c import prod
from sage.misc.functional import is_even
from sage.misc.cachefunc import cached_method
from sage.misc.randstate import current_randstate
from sage.combinat.subset import Subsets
from sage.features.gap import GapPackage
from sage.coding.linear_code_no_metric import AbstractLinearCodeNoMetric
from .encoder import Encoder
from .decoder import Decoder
from sage.rings.rational_field import QQ

# *****************************************************************************
# coding theory functions
Expand Down
21 changes: 11 additions & 10 deletions src/sage/groups/abelian_gps/abelian_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,21 +202,22 @@
# https://www.gnu.org/licenses/
# ****************************************************************************

from sage.rings.integer import Integer
from sage.rings.integer_ring import ZZ
from sage.structure.category_object import normalize_names
from sage.structure.unique_representation import UniqueRepresentation
from sage.rings.infinity import infinity
from sage.arith.all import divisors, gcd, lcm
from sage.arith.functions import lcm
from sage.arith.misc import divisors, gcd
from sage.categories.groups import Groups
from sage.groups.abelian_gps.abelian_group_element import AbelianGroupElement
from sage.misc.cachefunc import cached_method
from sage.misc.misc_c import prod
from sage.misc.mrange import mrange, cartesian_product_iterator
from sage.groups.group import AbelianGroup as AbelianGroupBase
from sage.categories.groups import Groups
from sage.matrix.constructor import matrix
from sage.matrix.special import diagonal_matrix
from sage.misc.cachefunc import cached_method
from sage.misc.misc_c import prod
from sage.misc.mrange import cartesian_product_iterator, mrange
from sage.modules.free_module_element import vector
from sage.rings.infinity import infinity
from sage.rings.integer import Integer
from sage.rings.integer_ring import ZZ
from sage.structure.category_object import normalize_names
from sage.structure.unique_representation import UniqueRepresentation


# TODO: this uses perm groups - the AbelianGroupElement instance method
Expand Down
2 changes: 1 addition & 1 deletion src/sage/groups/abelian_gps/dual_abelian_group_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
# (at your option) any later version.
# https://www.gnu.org/licenses/
# ****************************************************************************
from sage.arith.all import LCM
from sage.arith.functions import lcm as LCM
from sage.groups.abelian_gps.element_base import AbelianGroupElementBase


Expand Down
3 changes: 2 additions & 1 deletion src/sage/groups/abelian_gps/element_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@

from sage.structure.element import MultiplicativeGroupElement
from sage.misc.cachefunc import cached_method
from sage.arith.all import GCD, LCM
from sage.arith.misc import GCD
from sage.arith.functions import lcm as LCM
from sage.rings.integer import Integer
from sage.rings.integer_ring import ZZ
from sage.rings.infinity import infinity
Expand Down
2 changes: 1 addition & 1 deletion src/sage/groups/affine_gps/affine_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from sage.categories.groups import Groups
from sage.groups.matrix_gps.linear import GL
from sage.categories.rings import Rings
from sage.matrix.all import MatrixSpace
from sage.matrix.matrix_space import MatrixSpace
from sage.modules.all import FreeModule
from sage.structure.unique_representation import UniqueRepresentation
from sage.misc.cachefunc import cached_method
Expand Down
2 changes: 1 addition & 1 deletion src/sage/groups/class_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from sage.structure.richcmp import richcmp, richcmp_method
from sage.interfaces.gap import gap
from sage.rings.integer import Integer
from sage.rings.all import CyclotomicField
from sage.rings.number_field.number_field import CyclotomicField
from sage.libs.gap.element import GapElement
from sage.libs.gap.libgap import libgap
from sage.libs.gap.element import GapElement as LibGapElement
Expand Down
2 changes: 1 addition & 1 deletion src/sage/groups/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ def discrete_log(a, base, ord=None, bounds=None, operation='*', identity=None, i
if running_mod > bound:
break # we have log%running_mod. if we know that log<running_mod, then we have the value of log.
l = l[:i + 1]
from sage.arith.all import CRT_list
from sage.arith.misc import CRT_list
return (CRT_list(l, mods) + offset) % ord
except ValueError:
raise ValueError("no discrete log of %s found to base %s" % (a, base))
Expand Down
4 changes: 2 additions & 2 deletions src/sage/groups/libgap_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,13 +563,13 @@ def character_table(self):
irrG = G.Irr()
ct = [[irrG[i][j] for j in range(n)] for i in range(n)]

from sage.rings.all import CyclotomicField
from sage.rings.number_field.number_field import CyclotomicField
e = irrG.Flat().Conductor()
K = CyclotomicField(e)
ct = [[K(x) for x in v] for v in ct]

# Finally return the result as a matrix.
from sage.matrix.all import MatrixSpace
from sage.matrix.matrix_space import MatrixSpace
MS = MatrixSpace(K, n)
return MS(ct)

Expand Down
4 changes: 2 additions & 2 deletions src/sage/groups/matrix_gps/finitely_generated.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
##############################################################################

from sage.rings.integer_ring import ZZ
from sage.rings.all import QQbar
from sage.rings.qqbar import QQbar
from sage.structure.element import is_Matrix
from sage.matrix.matrix_space import MatrixSpace, is_MatrixSpace
from sage.matrix.constructor import matrix
Expand Down Expand Up @@ -792,7 +792,7 @@ def invariant_generators(self):
PR = PolynomialRing(F, n, [VarStr+str(i) for i in range(1,n+1)])

if q == 0 or (q > 0 and self.cardinality() % q):
from sage.all import Matrix
from sage.matrix.constructor import Matrix
try:
elements = [g.matrix() for g in self.list()]
except (TypeError, ValueError):
Expand Down
2 changes: 1 addition & 1 deletion src/sage/groups/matrix_gps/group_element.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ cdef class MatrixGroupElement_gap(ElementLibGAP):
return order.sage()
else:
assert order.IsInfinity()
from sage.rings.all import Infinity
from sage.rings.infinity import Infinity
return Infinity

def word_problem(self, gens=None):
Expand Down
4 changes: 2 additions & 2 deletions src/sage/groups/perm_gps/partn_ref/data_structures.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1411,7 +1411,7 @@ def SC_test_list_perms(list L, int n, int limit, bint gap, bint limit_complain,
if SC_is_giant(n, len(L), perm, 0.9, giant_support):
giant = True
m = bitset_len(giant_support)
from sage.arith.all import factorial
from sage.arith.misc import factorial
if not (order == factorial(m) or order == factorial(m)/2):
print("SC_is_giant failed: %s %s"%(str(L), order))
raise AssertionError
Expand Down Expand Up @@ -1530,7 +1530,7 @@ def SC_test_list_perms(list L, int n, int limit, bint gap, bint limit_complain,
perm[n*j + i] = Lperm[i]
j += 1
if SC_is_giant(n, len(L), perm, 0.9, giant_support):
from sage.arith.all import factorial
from sage.arith.misc import factorial
m = bitset_len(giant_support)
if order != factorial(m) and order != factorial(m)/2:
print("SC_is_giant failed: %s %s"%(str(L), order))
Expand Down
2 changes: 1 addition & 1 deletion src/sage/groups/perm_gps/partn_ref/refinement_matrices.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ def random_tests(n=10, nrows_max=50, ncols_max=50, nsymbols_max=10, perms_per_ma
from sage.combinat.permutation import Permutations
from sage.matrix.constructor import random_matrix, matrix
from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF
from sage.arith.all import next_prime
from sage.arith.misc import next_prime
cdef int h, i, j, nrows, k, num_tests = 0, num_matrices = 0
cdef MatrixStruct M, N
for m in range(n):
Expand Down
13 changes: 7 additions & 6 deletions src/sage/groups/perm_gps/permgroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@
from sage.misc.randstate import current_randstate
from sage.groups.group import FiniteGroup

from sage.rings.all import QQ, Integer
from sage.rings.rational_field import QQ
from sage.rings.integer import Integer
from sage.interfaces.abc import ExpectElement, GapElement
from sage.libs.gap.libgap import libgap
from sage.libs.gap.element import GapElement as LibGapElement
Expand All @@ -151,7 +152,7 @@
from sage.misc.cachefunc import cached_method
from sage.groups.class_function import ClassFunction_libgap
from sage.sets.finite_enumerated_set import FiniteEnumeratedSet
from sage.categories.all import FiniteEnumeratedSets
from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets
from sage.groups.conjugacy_classes import ConjugacyClassGAP
from sage.structure.richcmp import (richcmp_method,
richcmp, rich_to_bool, op_EQ, op_NE)
Expand Down Expand Up @@ -195,7 +196,7 @@ def hap_decorator(f):
@wraps(f)
def wrapped(self, n, p=0):
load_hap()
from sage.arith.all import is_prime
from sage.arith.misc import is_prime
if not (p == 0 or is_prime(p)):
raise ValueError("p must be 0 or prime")

Expand Down Expand Up @@ -3421,13 +3422,13 @@ def character_table(self):
irrG = G.Irr()
ct = [[irrG[i, j] for j in range(n)] for i in range(n)]

from sage.rings.all import CyclotomicField
from sage.rings.number_field.number_field import CyclotomicField
e = irrG.Flat().Conductor()
K = CyclotomicField(e)
ct = [[K(x) for x in v] for v in ct]

# Finally return the result as a matrix.
from sage.matrix.all import MatrixSpace
from sage.matrix.matrix_space import MatrixSpace
MS = MatrixSpace(K, n)
return MS(ct)

Expand Down Expand Up @@ -4742,7 +4743,7 @@ def poincare_series(self, p=2, n=10):

"""
load_hap()
from sage.arith.all import is_prime
from sage.arith.misc import is_prime
if not (p == 0 or is_prime(p)):
raise ValueError("p must be 0 or prime")

Expand Down
Loading